(PYTHON) For Checkpoint B, you will extend your code from Checkpoint A by calculating the WCT for several locations. For that purpose, you will need to: Prompt the user to enter the number of locations for which WCT will be calculated. If a user inputs a zero or a negative value for 'number of locations' then print a message and exit (see samples below). Thereafter, you will print the following summary statistics, using the user's requested decimal precision: Print the average WCT collected across all locations. Print the location with the lowest WCT. Print the average air temperature collected across all locations. Print the location with the lowest air temperature. Print the average wind velocity collected across all locations. Print the location with the highest wind velocity. HERES MY CODE IN PART A: print("==> Windchill Temperature (WCT) Weather Report Calculator <==") precision = int(input("Select decimal precision for the report [1--4]:\n")) if precision<1 or precision>4: print ("Error:",precision,"is not in the range 1--4.") else: location = input("Enter name of ** Location 1 **:\n") T = int(input("\tEnter air temperature [in deg F]:\n")) V = int(input("\tEnter wind velocity [in mph]:\n")) wct = 35.74+0.6215*T-35.75*(V**0.16)+0.4275*T*(V**0.16) print ("\tWCT is",round(wct, precision),"deg F.")
(PYTHON) For Checkpoint B, you will extend your code from Checkpoint A by calculating the WCT for several locations. For that purpose, you will need to:
- Prompt the user to enter the number of locations for which WCT will be calculated.
- If a user inputs a zero or a negative value for 'number of locations' then print a message and exit (see samples below).
Thereafter, you will print the following summary statistics, using the user's requested decimal precision:
- Print the average WCT collected across all locations.
- Print the location with the lowest WCT.
- Print the average air temperature collected across all locations.
- Print the location with the lowest air temperature.
- Print the average wind velocity collected across all locations.
- Print the location with the highest wind velocity.
HERES MY CODE IN PART A:
print("==> Windchill Temperature (WCT) Weather Report Calculator <==")
precision = int(input("Select decimal precision for the report [1--4]:\n"))
if precision<1 or precision>4:
print ("Error:",precision,"is not in the range 1--4.")
else:
location = input("Enter name of ** Location 1 **:\n")
T = int(input("\tEnter air temperature [in deg F]:\n"))
V = int(input("\tEnter wind velocity [in mph]:\n"))
wct = 35.74+0.6215*T-35.75*(V**0.16)+0.4275*T*(V**0.16)
print ("\tWCT is",round(wct, precision),"deg F.")
I am trying to get the code to print an 'error' shown in sample output 2 (images attached)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images