Question
Q4 python question Consider the following scenario about using if-elif-else statements: The fall weather is unpredictable. If the temperature is below 32 degrees Fahrenheit, a
Q4 python question
Consider the following scenario about using if-elif-else statements:
The fall weather is unpredictable. If the temperature is below 32 degrees Fahrenheit, a heavy coat should be worn. If it is above 32 degrees but not above 50 degrees, then a jacket should be sufficient. If it is above 50 but not above 65 degrees, a sweatshirt is appropriate, and above 65 degrees a t-shirt can be worn.
Fill in the blanks in the function below so it returns the proper clothing type for the temperature. -
def clothing_type(temp):
if ___:
clothing = "T-Shirt"
elif ___:
clothing = "Sweatshirt"
elif ___:
clothing = "Jacket"
else:
clothing = "Heavy Coat"
return clothing
print(clothing_type(72)) # Should print T-Shirt
print(clothing_type(55)) # Should print Sweatshirt
print(clothing_type(65)) # Should print Sweatshirt
print(clothing_type(50)) # Should print Jacket
print(clothing_type(45)) # Should print Jacket
print(clothing_type(32)) # Should print Heavy Coat
print(clothing_type(0)) # Should print Heavy Coat
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started