Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I was instructed to write a Python program that will ask the user to enter 4 tem

ID: 3553914 • Letter: I

Question

I was instructed to write a Python program that will ask the user to enter 4 temperatures in degrees Fahrenheit. The program then

converts each temperature to the corresponding degrees Celsius and shows the color code according to the heat

index chart below.


Heat Index /Temperature Color Code


above 110 (F>110) red

between 90 and 110 (90<F?110) orange

between 90 and 32 (32?F?90) yellow

below 32 (F<32) blue


The program should produce the output similar to the sample output below (assuming

the user input is 0, 32, 100, 200 in the sample output)


Fahrenheit Celsius Color Code

-------------------------------------------------------------------

0 -17.8 blue

32 0.0 yellow

100 37.8 orange

200 93.3 red

------------------------------------------------------------------




So far I have written a program producing the Fahrehiet to Celsius conversion. But I am having trouble using the dictionary and get commands to create an output for the Heat Index.





def main():

fah1,fah2,fah3,fah4=eval(input("Enter 4 temperatures in degrees Fahrenheit separated by a comma:"))

print(" Farenhiet"," ","Celsius"," ","Color Code")


ColorCode = {"F>110" :"red", "90<F<=110":"orange", "32<=F<=90":"yellow","F<32":"blue"}

if F in ColorCode > 110 : red

if 90 < temperature <= 110 then "Color Code" = orange

if 32 <= temperature <= 90 then "Color Code" = yellow

if temperature < 32 then "Color Code" = blue


print('-------------------------------------------------')

  

cels1=(fah1-32)*5//9

print(fah1,end=' ')

print(cels1)

  

  

cels2=(fah2-32)*5//9

print(fah2,end=' ')

print(cels2)

  

cels3=(fah3-32)*5//9

print(fah3,end=' ')

print(cels3)

  

cels4=(fah4-32)*5//9

print(fah4,end=' ')

print(cels4)


main()

Explanation / Answer

def main():


fah1,fah2,fah3,fah4=input("Enter 4 temperatures in degrees Fahrenheit separated by a comma:")


print(" Farenhiet"," ","Celsius"," ","Color Code")



ColorCode = {"F>110" :"red", "90<F<=110":"orange", "32<=F<=90":"yellow","F<32":"blue"}

for temperature in ColorCode:


if temperature in ColorCode > 110 : print'red'


if 90 < temperature <= 110 :print'orange'


if 32 <= temperature <= 90 : print'yellow'


if temperature < 32: print'blue'



print('-------------------------------------------------')


  


cels1=(fah1-32)*5//9


print(fah1)


print(cels1)


  


  


cels2=(fah2-32)*5//9


print(fah2)


print(cels2)


  


cels3=(fah3-32)*5//9


print(fah3)


print(cels3)


  


cels4=(fah4-32)*5//9


print(fah4)


print(cels4)


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote