Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions