<Back #29.1) Drinking Function (3/5 completed) Next> /#29.2) Possibly Undefined #29.3) Animal Rater /#29.4 Stay Positive #29.5 Redundant If
Last
BlockPy: #29.1) Drinking Function
Create a function named can_drink that takes in age and has_license. Then, use your logic from question #27.2 as the function's body. Change the function's body to return strings (not print!). Call the function with your own information (again, or make it up) and print the result of calling it.
Here is the logic from #27.2:
If you are 21 or older, if you are less than 1000 years old, if you have a license, then return "can drink". Otherwise, if you don't have a license, then return "Doesn't have a license". Otherwise, if you are too old, then return "Too old". Otherwise, if you are too young, then return "Too young".