Answer to Question #242611 in Python for Ajay D'Cruze

Question #242611
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
def should_serve_foods(age:int, fasting:bool):
	if age >= 18 and not fasting:
		return True
	else:
		return False

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS