Temperature Warning

Print a warning if the temperature exceeds a high or low threshold.

In [2]:
def main():
    celsius = float(input("Enter a temp in °C: "))
    fahrenheit = 9/5 * celsius + 32
    print("The temperature is {0:0.2f} degrees fahrenheit.".format(fahrenheit))
In [3]:
main()
Enter a temp in °C: 20
The temperature is 68.00 degrees fahrenheit.
In [5]:
def temp_conv_warn():
    celsius = float(input("Enter a temp in °C: "))
    fahrenheit = 9/5 * celsius + 32
    print("The temperature is {0:0.2f} degrees fahrenheit.".format(fahrenheit))
    
    if fahrenheit >= 90:
        print("It's really hot out there, be careful!")
        
    if fahrenheit <= 30:
        print("It's really cold out there, brrrrr!")
In [9]:
temp_conv_warn()
Enter a temp in °C: -3
The temperature is 26.60 degrees fahrenheit.
It's really cold out there, brrrrr!