Question: Rewrite the functionrecord_check(age, gender, location)below so that only a single if-statement is used. def record_check (age, gender, location) : buy only less than 5%
Rewrite the functionrecord_check(age, gender, location)below so that only a single if-statement is used.
def record_check(age, gender, location): """ buy only less than 5% """ if age > 18: if gender == "M": if location == "Perth": print("Found him!") elif location == "Sydney": print("Found him!") else: print("Did not find him.") else: print("Did not find him.") else: print("Did not find him.")

print ( "Did not find him.") else: print ("Did not find him.") else : print ( "Did not find him.") For example: Test Result record_check ( 16, 'F', 'Brisbane' ) Did not find him. record check (19, 'M', 'Perth' ) Found him! record_check (19, 'F', 'Melbourne' ) Did not find him. Answer: (penalty regime: 0, 10, ... %) 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
