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
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