top of page

Temperature_Classification​

The Python script will prompt a user to enter a temperature as an integer then 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. Then it prints “Good bye!” and escape from your script. 

# Ehsan Momeni

 

iter=1  # to iterate

while iter==1:
    Temp=int(raw_input("\nEnter temprature as an integer: \t"))
    if Temp !=0: #if you have to continue
        if Temp>=100:
            print "The temperature of %d is hot"%Temp
        elif Temp <=60:
            print "The temperature of %d is cold"%Temp
        else:
               print "The temperature of %d is just right"%Temp
    else:
        iter=0 #if u want to stop iteration


print "Good bye!"
 

google_scholar1-300x150.png
ResearchGate.png
Ehsan Momeni ORCID GIS Remote Sensing Ur
Ehsan Momeni LinkedIn GIS Remote Sensing
ncbi-300x150.png
academia.png

(Information on this website may not be up to date)

bottom of page