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,...
Basic arithmetic calculation. Use instruction “li” to initialize register $t1 with a constant value 10. li...
Basic arithmetic calculation. Use instruction “li” to initialize register $t1 with a constant value 10. li $t1, 10   # [$t1] <- 10 finish the following calculation using MIPS assembly code. $t2 = $t1 + $t1 $t3 = $t1 << 2 (shift to left by 2 bits) $t4 = $t1 & 0x0000ffff (bitwise AND) $t5 = $t1 | 0x0000fffff (bitwise OR) $t6 = $t2 + $t3 + $t4 + $t5 Write MIPS assembly code to finish the above calculation and print...
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++)
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
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...
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...
swapArrayEnds(int[] nums): swaps the first and last elements of its array parameter. Ex: {10, 20, 30,...
swapArrayEnds(int[] nums): swaps the first and last elements of its array parameter. Ex: {10, 20, 30, 40} becomes {40, 20, 30, 10}. removeTen(int[] nums): returns a version of the given array where all the 10's have been removed. The remaining elements should shift left towards the start of the array as needed, and the empty spaces at the end of the array should be set to 0. Ex: {1, 10, 10, 2} yields {1, 2, 0, 0}. You can make...
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?
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT