Q. Ask the user to enter a temperature in Celsius. the program should print a message based on the temperature:
(i) If the temperature is less than -273.15 print that the temperature is invalid because it is below absolute zero.
(ii) If is exactly -273.15 ,print that the temperature is absolute 0.
(iii) If the temperature is between -273.15 and 0 ,print that the temperature is below freezing.
(iv) If it is 0 ,print that the temperature is at the freezing point.
(v) If it is between 0 and 100 , print that the temperature is in the normal range.
(vi) If it is 100 ,print that the temperature is at the boiling point.
(vii) If it above 100 , print that the temperature is above the boiling point.
You can understand by Watching video :-
Answer :-
temp = float(input("Enter temperature in celsius= ")) if temp < -273.15 : print ("The temperature is invalid ") elif temp == -273.15 : print ("The temperature is absolute 0 ") elif temp > -273.15 and temp < 0 : print("The temperature is below freezing") elif temp == 0: print("The temperature is at the freezing point .") elif temp > 0 and temp < 100 : print("The temperature is in the normal range") elif temp == 100 : print("The temperature is at the boiling point .") else : print ("The temperature is above the boiling point ")
Output :-
Enter temperature in celsius= -300
The temperature is invalid
>>>
Enter temperature in celsius= -273.15
The temperature is absolute 0
>>>
Enter temperature in celsius= -1
The temperature is below freezing
>>>
Enter temperature in celsius= 0
The temperature is at the freezing point .
>>>
Enter temperature in celsius= 50
The temperature is in the normal range
>>>
Enter temperature in celsius= 100
The temperature is at the boiling point .
>>>
Enter temperature in celsius= 159
The temperature is above the boiling point
>>>
thankyou
ReplyDeleteWelcome : )
Deletecheck it again. i think you have done some mistake bcoz it is showing invalid syntax
ReplyDeleteSorry, I have corrected it : )
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )