1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alona [7]
3 years ago
13

12.28 LAB: Output values in a list below a user defined amount - functions Write a program that first gets a list of integers fr

om input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, and output all integers less than or equal to that value. Ex: If the input is: 5 50 60 140 200 75 100 the output is: 50 60 75 The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75.
Engineering
1 answer:
Anastaziya [24]3 years ago
8 0

Answer:

def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold):

   for value in user_values:

       if value < upper_threshold:

           print(value)  

def get_user_values():

   n = int(input())

   lst = []

   for i in range(n):

       lst.append(int(input()))

   return lst  

if __name__ == '__main__':

   userValues = get_user_values()

   upperThreshold = int(input())

   output_ints_less_than_or_equal_to_threshold(userValues, upperThreshold)

You might be interested in
I really need help ASAP!!!
ValentinkaMS [17]

Explanation:

He would work on the thing like in the method you work on your question.

8 0
3 years ago
Given: A graphite-moderated nuclear reactor. Heat is generated uniformly in uranium rods of 0.05m diameter at the rate of 7.5 x
sineoko [7]

Answer:

The maximum temperature at the center of the rod is found to be 517.24 °C

Explanation:

Assumptions:

1- Heat transfer is steady.

2- Heat transfer is in one dimension, due to axial symmetry.

3- Heat generation is uniform.

Now, we consider an inner imaginary cylinder of radius R inside the actual uranium rod of radius Ro. So, from steady state conditions, we know that, heat generated within the rod will be equal to the heat conducted at any point of the rod. So, from Fourier's Law, we write:

Heat Conduction Through Rod = Heat Generation

-kAdT/dr = qV

where,

k = thermal conductivity = 29.5 W/m.K

q = heat generation per unit volume = 7.5 x 10^7 W/m³

V = volume of rod = π r² l

A = area of rod = 2π r l

using these values, we get:

dT = - (q/2k)(r dr)

integrating from r = 0, where T(0) = To = Maximum center temperature, to r = Ro, where, T(Ro) = Ts = surface temperature = 120°C.

To -Ts = qr²/4k

To = Ts + qr²/4k

To = 120°C + (7.5 x 10^7 W/m³)(0.025 m)²/(4)(29.5 W/m.°C)

To = 120° C + 397.24° C

<u>To = 517.24° C</u>

5 0
4 years ago
Which of the following is true about ideal standards? a.Ideal standards provide allowance for normal breakdowns and interruption
marysya [2.9K]

Answer: D. All of the choice A, B and C are correct.

8 0
3 years ago
What is the core domain for Accenture’s Multi-party Systems practice?
12345 [234]

Answer:

a

Explanation:

digital identity is the answer

6 0
3 years ago
java Your program class should be called RomanNumerals Write a program that asks the user to enter a number within the range of
Ann [662]

Answer:

// Scanner class is imported to allow program

// receive input

import java.util.Scanner;

// RomanNumerals class is defined

public class RomanNumerals {

   // main method that signify beginning of program execution

   public static void main(String args[]) {

       // Scanner object scan is created

       // it receive input via keyboard

       Scanner scan = new Scanner(System.in);

       // Prompt is display asking the user to enter number

       System.out.println("Enter your number: ");

       // the user input is stored at numberOfOrder

       int number = scan.nextInt();

     

           // switch statement which takes number as argument

           // the switch statement output the correct roman numeral

           // depending on user input

          switch(number){

           case 1:

               System.out.println("I");

               break;

           case 2:

               System.out.println("II");

               break;

           case 3:

               System.out.println("III");

               break;

           case 4:

               System.out.println("IV");

               break;

           case 5:

               System.out.println("V");

               break;

           case 6:

               System.out.println("VI");

               break;

           case 7:

               System.out.println("VII");

               break;

           case 8:

               System.out.println("VIII");

               break;

           case 9:

               System.out.println("IX");

               break;

           case 10:

               System.out.println("X");

               break;

           // this part is executed if user input is not between 1 to 10

           default:

               System.out.println("Error. Number must be between 1 - 10.");

     }

   }

}

Explanation:

The program is well commented. A sample image of program output is attached.

The switch statement takes the user input (number) as argument as it goes through each case block in the switch statement and match with the corresponding case to output the roman version of that number. If the number is greater 10 or less than 1; the default block is executed and it display an error message telling the user that number must be between 1 - 10.

6 0
3 years ago
Read 2 more answers
Other questions:
  • A parison is extruded from a die with outside diameter = 11.5 mm and inside diameter = 7.5 mm. The observed die swell = 1.25. Th
    8·1 answer
  • Consider a two-dimensional incompressible velocity potential phi = ???????? cos theta + ????????theta, where B and L are constan
    8·1 answer
  • In your opinion, what is the external opportunity cost of a successful biking company in a community
    7·1 answer
  • A flywheel made of Grade 30 cast iron (UTS = 217 MPa, UCS = 763 MPa, E = 100 GPa, density = 7100 Kg/m, Poisson's ratio = 0.26) h
    9·1 answer
  • An open vat in a food processing plant contains 500 L of water at 20°C and atmospheric pressure. If the water is heated to 80°C,
    9·1 answer
  • Hi I have a question!! Please answer it ASAP, tysm!
    13·1 answer
  • What is the function rule for the line? f(x)=−32x−2f(x)=−23x−2f(x)=32x−2f(x)=−32x+2A coordinate grid with x and y axis ranging f
    6·1 answer
  • Please help, Artificial Intelligence class test
    12·1 answer
  • Rod of steel, 200 mm length reduces its diameter (50 mm) by turning by 2 mm with feed speed 25 mm/min. You are required to calcu
    11·1 answer
  • How can input from multiple individuals improve design solutions for problems that occur because of a natural disaster, such as
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!