Hi Can someone have a look at the question below to be writt

Hi, Can someone have a look at the question below to be written in the Python language. Thanks

Write a program that will prompt a user to enter a temperature as an integer. Your program will print ”it is hot” if the temperature is over 100, ”it is cold” if the temperature is under 60, and ”it is just right” if the temperature is between 61 and 99 inclusive. The program continues to ask for temperatures, and evaluates them as above, until the user enters a temperature of 0.

Solution

f=1#set flag
while f!=0: #run till f becomes 0
   print \"Enter temperature\"
   temp=input()#accept temperature
   f=temp

   if f==0:#if temperature 0 break it
       break;
   if temp >100:
       print \"It is hot\"
   elif temp <60:
       print \"It is cold\"
   elif temp >61 and temp <99:
       print \"It is just right\"


  
  

  
  

================================================

akshay@akshay-Inspiron-3537:~/Chegg$ python fun.py
Enter temperature
110
It is hot
Enter temperature
50
It is cold
Enter temperature
62
It is just right
Enter temperature
0

Hi, Can someone have a look at the question below to be written in the Python language. Thanks Write a program that will prompt a user to enter a temperature as

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site