python
Suppose that a variable named temp exists and contains a valid integer temperature in degrees Fahrenheit. Write one if-elif-else statement that would output cold if the value in temp is below 40; mild if the temp is in the range 40 through 79; and Hot if temp is 80 or above. You may hard-code in numeric literals such as 40, 79, and 80 without creating named constants.
/*If you any query do comment in the comment section else like the solution*/
temp = int(input("Enter temperature in Fahrenheit: "))
if temp < 40:
print("cold")
elif temp >= 40 and temp <= 79:
print("mild")
else:
print("Hot")
Get Answers For Free
Most questions answered within 1 hours.