homework 1

#User input Celsius temperature 
celsius=float(input( ' Enter Celsius temperature: ' ))

#Calculate Fahrenheit temperature 
fahrenheit=(celsius*9/5)+32     # f=c*9/5+32

#Output Fahrenheit temperature to the user 
print ( ' {:.2f} Celsius temperature is converted to Fahrenheit temperature as {:.2f} ' .format(celsius,fahrenheit))
# °C=5/9 (°F-32)

# 1. Input 
f=float(input( ' Please enter the temperature in Fahrenheit: ' ))

# 2. Calculate 
c=5/9*(f-32 )

# 3. Output 
print ( ' {:.2f} Fahrenheit to Celsius is ;{:.2f} ' .format(f,c))

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324687589&siteId=291194637