Question

In: Computer Science

> * Read the high value. > 1- First, initialize the constant NUMS as 3: NUMS=3...

>

* Read the high value.

>

  1. 1- First, initialize the constant NUMS as 3: NUMS=3

    2- Print the title of the application.

    >---=== Python Temperature Analyzer ===---<

Enter the high value for day 1:

< (or day 2, or day 3)

Enter the low value for day 1:

< (or day 2, or day 3)

3- Using a for loop, prompt the user to enter the high and low values for each of NUMS days. The values entered must be between -40 and 40, and high must be greater than low.

Print the following messages:

* Read the low value.
IMPORTANT: You may only declare two (2) int type variables for the high and low values

4- Useanestedwhile(ordo-while)looptoanalyzetheresults,highmustbegreaterthan low, high must be less than 41, low must be greater than -41

*If any entry is incorrect, prompt the user to enter again until the entries pass the tests:

>
<

Then prompt again for the high and low temperatures for the day.

OUTPUT EXAMPLE (Red numbers show the input)

--== Python Temperature Analyzer ==-- Enter the high value for day 1: 8

Enter the low value for day 1: -2

Enter the high value for day 2: 41

Enter the low value for day 2: -4

Incorrect values, temperatures must be in the range -40 to 40, high must be greater than low.

Enter the high value for day 2: 9

Enter the low value for day 2: -4

Enter the high value for day 3: 5

Enter the low value for day 3: 11

Incorrect values, temperatures must be in the range -40 to 40, high must be greater than low.

Enter the high value for day 3: 11 Enter the low value for day 3: 5

Solutions

Expert Solution

NUMS=3
print("--== Python Temperature Analyzer ==--",end=' ')
for i in range(NUMS):
    print("Enter the high value for day %d:" %(i+1),end=' ')
    high=int(input())
    print("Enter the low value for day %d:" %(i+1),end=' ')
    low=int(input())
    while (high<41 and low>-41 and high>low)==False:
        print("Incorrect values, temperatures must be in the range -40 to 40, high must be greater than low.")
        print("Enter the high value for day %d:" %(i+1),end=' ')
        high=int(input())
        print("Enter the low value for day %d:" %(i+1),end=' ')
        low=int(input())

OUTPUT EXAMPLE

--== Python Temperature Analyzer ==-- Enter the high value for day 1: 8
Enter the low value for day 1: -2
Enter the high value for day 2: 41
Enter the low value for day 2: -4
Incorrect values, temperatures must be in the range -40 to 40, high must be greater than low.
Enter the high value for day 2: 9
Enter the low value for day 2: -4
Enter the high value for day 3: 5
Enter the low value for day 3: 11
Incorrect values, temperatures must be in the range -40 to 40, high must be greater than low.
Enter the high value for day 3: 11
Enter the low value for day 3: 5

#If have any query any in comment box


Related Solutions

* Read the high value. > 1- First, initialize the constant NUMS as 3: NUMS=3 2-...
* Read the high value. > 1- First, initialize the constant NUMS as 3: NUMS=3 2- Print the title of the application. >---=== Python Temperature Analyzer ===---<. 3- Using a for loop, prompt the user to enter the high and low values for each of NUMS days. The values entered must be between -40 and 40, and high must be greater than low. Print the following messages: > Enter the high value for day 1: < (or day 2, or...
PYTHON 1- First, initialize the constant NUMS as 3: NUMS=3 2- Print the title of the...
PYTHON 1- First, initialize the constant NUMS as 3: NUMS=3 2- Print the title of the application. >---=== Python Temperature Analyzer ===---< 3- Using a for loop, prompt the user to enter the high and low values for each of NUMS days. The values entered must be between -40 and 40, and high must be greater than low. Print the following messages: > * Read the high value. > Enter the high value for day 1: < (or day 2,...
Declare a string variable and initialize it with your first name ( in C++)
Declare a string variable and initialize it with your first name ( in C++)
Write a script that will first initialize a string variable that will store x and y...
Write a script that will first initialize a string variable that will store x and y coordinates of a point in the form ‘x 3.1 y 6.4’. Then, use string manipulating functions to extract the coordinates and plot them. ANS % create a string variable of the form 'x 3.1 y 6.4' % extract the x and y coordinates and plot str = 'x 2.3 y 4.5'; [letter rest] = strtok(str); [x rest] = strtok(rest); [letter rest] = strtok(rest); y...
1)A reaction(A-products) is found to be first order with a rate constant of 2.97*10^-3 / min....
1)A reaction(A-products) is found to be first order with a rate constant of 2.97*10^-3 / min. What is the half life for this reaction? 2) If the reaction described in probrem 1 starts with an initial concentration of 1.00M of reactant A, What is the concentration of A after 300min? 3) What is the reaction oreder and what is the value of the rate constant? IN(H2O2) y=0.00835x-0.00493 1/H2O2 y=0.00460x-0.847 H2O2 y=-0.000264x+0.841
In C++, create a 3-by-3 array that is capable of storing integers and initialize each entry...
In C++, create a 3-by-3 array that is capable of storing integers and initialize each entry to 0. Ask the user to supply a row and a column and a value, then put the value into the array at that row and column. Print the array to the screen as a table with 3 rows and 3 columns, and ask the user for another row, column, and value. Repeat until user inputs values for all entries. Once finished, compute and...
Modify the Assignment program from Module 1 to read a user's first and last name read...
Modify the Assignment program from Module 1 to read a user's first and last name read three integer scores, calculate the total and average determine the letter grade based on the following criteria - Average 90-100 grade is A, 80-89.99 grade is B, 70-79.99 grade is C, all others F (use a nested if) Output formatted results consisting of the full name, the three scores, the total, average (to 2 decimal places), and the letter grade go to step 1...
a. A certain first-order reaction (A→products) has a rate constant of 3.00×10−3 s−1 at 45 ∘C....
a. A certain first-order reaction (A→products) has a rate constant of 3.00×10−3 s−1 at 45 ∘C. How many minutes does it take for the concentration of the reactant, [A], to drop to 6.25% of the original concentration? b. A certain second-order reaction (B→products) has a rate constant of 1.85×10−3M−1⋅s−1 at 27 ∘C and an initial half-life of 300 s . What is the concentration of the reactant B after one half-life?
X value:1, 1, 1, 3, 3, 3, 3, 5, 5, 5 (months) Y value: 4.7, 3.1,...
X value:1, 1, 1, 3, 3, 3, 3, 5, 5, 5 (months) Y value: 4.7, 3.1, 4.0, 14.8, 13.4, 15.6, 14.2, 23.5, 22.2, 24.4 (kg) 1. Find the value of the linear correlation coefficient, write down the formula 2. Find the equation of the least squares regression line y = b0 + b1x 3. If a 4-month old puppy comes , what do you expect its weight? 4. If you record 2-months old puppy's weight by its residual value of...
Calculate the average value of the numbers 3, 3, 5, 5 first by calculating the normal...
Calculate the average value of the numbers 3, 3, 5, 5 first by calculating the normal average and then by calculating the weighted average. Are the two results the same?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT