Q2. A vender wants to determine whether he should serve foods to someone. He only serves
foods to people whose age is 18 or more and when he is not on fasting. Given the person's age,
and whether fasting time is in session, create a function which returns whether he should serve
foods.
Examples
should_serve_foods(17, True) ➞ False(No serve foods)
should_serve_foods(19, False) ➞ True(serve foods)
should_serve_foods(30, True) ➞ False(No serve foods)
1
Expert's answer
2021-09-27T01:17:15-0400
defshould_serve_foods(age:int, fasting:bool):
if age >= 18andnot fasting:
returnTrueelse:
returnFalse
Comments