Home / Expert Answers / Computer Science / hot-chocolate-should-be-nice-and-warm-but-not-so-much-that-it-burns-your-mouth-the-perfect-tempera-pa640

(Solved): Hot chocolate should be nice and warm, but not so much that it burns your mouth. The perfect tempera ...



Hot chocolate should be nice and warm, but not so much that it burns your mouth. The perfect temperature is between 115°F and 130°F. Write a function with the name hot_chocolate that takes in a temperature as an argument.

The temperature will be a number such as 116.5, 130.0, 40, or similar. These represent Fahrenheit numbers. Return a string describing what the hot chocolate is like: If the temperature is below or exactly 32, return exactly: Your hot chocolate is ice chocolate. If the temperature is above 32 and below 115, return exactly: Your hot chocolate has become plain chocolate. If the temperature is 115-130 (including 115 and 130), return exactly: Your hot chocolate is ready to drink! If the temperature is above 130, return exactly: Your hot chocolate is too hot. Wait a bit.

I put this in 

def hot_chocolate(temp):

if temp <= 32:

return "Your hot chocolate is ice chocolate."

elif temp > 32 and temp < 115:

return "Your hot chocolate has become plain chocolate."

elif temp >= 115 and temp <= 130:

return "Your hot chocolate is ready to drink!"

else:

return "Your hot chocolate is too hot. Wait a bit."

But I keep getting this back from the program every time I try to run it.

File "/home/hot_chocolate.py", line 4, in if hot_chocolate > 32 and hot_chocolate < 115: TypeError: '>' not supported between instances of 'function' and 'int'



We have an Answer from Expert

View Expert Answer

Expert Answer


def hot_chocolate(temp): if temp <= 32: return "Your hot chocolate is ice cho
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe