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

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.

User Ramashish Baranwal
by
8.4k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.

9.4m questions

12.2m answers

Categories