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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!