asked 211k views
5 votes
Assume there is a decimal variable temperature write if-else statement to display the message warm

asked
User ZLMN
by
8.2k points

1 Answer

3 votes

Answer:

Step-by-step explanation:

Here's an example of an if-else statement in Python to display the message "warm" based on a decimal variable called temperature:

temperature = 23.5 # Example temperature value

if temperature > 20.0:

print("Warm")

else:

print("Not warm")

In this example, the if-else statement checks if the temperature variable is greater than 20.0. If it is, it prints "Warm." Otherwise, it prints "Not warm." You can adjust the value of temperature to see the different outputs based on the condition.

No related questions found

Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.