Question: Using Python.Thanks Q3 - Alfonso will only wear a jacket outside if it is below 60 degrees or it is raining. Write a function that

Using Python.Thanks

Q3 - Alfonso will only wear a jacket outside if it is below 60 degrees or it is raining.

Write a function that takes in the current temperature and a boolean value telling

if it is raining and it should return True if Alfonso will wear a jacket and False otherwise.

First, try solving this problem using an if statement.

def wears_jacket_with_if(temp, raining):

"""

>>> wears_jacket(90, False)

False

>>> wears_jacket(40, False)

True

>>> wears_jacket(100, True)

True

"""

Note that we'll either return True or False based on a single condition, whose truthiness value will also be either True or False. Knowing this, try to write this function using a single line.

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!