In: Computer Science
The sixth assignment involves writing a Python program to read in the temperatures for ten consecutive days in Celsius and store them into an array. The entire array should then be displayed. Next each temperature in the array should be converted to Fahrenheit and the entire array should be again be displayed. The formula for converting Celsius to Fahrenheit is °F = (°C × 1.8) + 32. Finally, the number of cool, warm and hot days should be counted and the number of each type of days should be displayed. You should decide on the thresholds for determining whether a day is cool, warm or hot.. The program should include the pseudocode used for your design in the comments. Document the values you chose for the thresholds in your comments as well. Please provide a test report. In the test report document, please provide detailed explanation on the input, expected output, and actual output.
celsius = []
fahrenheit = []
cool = 0
hot = 0
warm = 0
#read input temp from user and append themp to celcius
list
#convert given temp to fahrenheit and append it to fahrenheit
list
#based on temp in celcius count cool warm and hot days
for i in range(0,10):
temp = float(input("Enter temperature in celcius
for day {}: ".format(i)))
celsius.append(temp)
temp_f = (temp * 1.8) + 32
fahrenheit.append(temp_f)
#We Consider below 15°C - Cool
#We Consider 16 to 28°C - Warm
#We Consider above 28°C - Hot
if(temp<=15):
cool+=1
elif(temp<=28):
warm+=1
else:
hot+=1
#print results
print("The temperatures for ten consecutive days in Celsius
{}".format(celsius))
print("The temperatures for ten consecutive days in fahrenheit
{}".format(fahrenheit))
print("The number of cool days are {}".format(cool))
print("The number of warm days are {}".format(warm))
print("The number of hot days are {}".format(hot))
Thank You...!