In: Computer Science
Design a Python program to prompt the user for 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 stored into a 2nd array. This entire array should then 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. Document the values you chose for the thresholds in your comments as well.
code and output
Code for copying
t=list(map(float,input("Enter the temparature:
").rstrip().split()))
list2=[]
for i in t:
list2.append((i*1.8)+32)
print(list2)
cool_days=0
warm_days=0
hot_days=0
for i in list2:
if i<60: #temparatures lesss than 60 F are cool days
cool_days+=1
if 60<=i<=100: #temparatures greater than 60 F and less than
100F are warm days
warm_days+=1
if 100<i: #temparatures greater than 100F are Hot days
hot_days+=1
print("cool days = {}".format(cool_days))
print("warm days = {}".format(warm_days))
print("hot days = {}".format(hot_days))
Code snippet
t=list(map(float,input("Enter the temparature: ").rstrip().split()))
list2=[]
for i in t:
list2.append((i*1.8)+32)
print(list2)
cool_days=0
warm_days=0
hot_days=0
for i in list2:
if i<60: #temparatures lesss than 60 F are cool days
cool_days+=1
if 60<=i<=100: #temparatures greater than 60 F and less than 100F are warm days
warm_days+=1
if 100<i: #temparatures greater than 100F are Hot days
hot_days+=1
print("cool days = {}".format(cool_days))
print("warm days = {}".format(warm_days))
print("hot days = {}".format(hot_days))