Question: You must not use continue, break or while True as they do not demonstrate your understanding of loops. Design the function print _ name _

You must not use continue, break or while True as they do not demonstrate your understanding of loops.
Design the function print_name_age_v1 that does not take any arguments but prompts the user to enter their name and then prompts them to enter their age. It then prints hello followed by the name and the category of the age.
Age categories are as follows:
child is younger than 18adult is 18 to 64 inclusivesenior is 65 or older
Note: Examples within your docstring can be omitted. Be sure to test your function from the shell!
What happens if when you test this function you enter an invalid age? (ie. 'four', 4.25,-20)
Dont fix the problem here, you will handle this in the next version of this function.
TIP: This function should NOT have a loop.
Design the function print_name_age_v2 that does not take any arguments but prompts the user to enter their name and then prompts them to enter their age. It then prints hello followed by the name and the category of the age. If the user enters an invalid age (ie, letters, a number smaller than 0, etc...) it prints the name followed by you are lying about your age.
Age categories are as described in version 1.
Note: Examples within your docstring can be omitted. Be sure to test your function from the shell!
TIP: Pythons string isdigit() function will be helpful. Again, this function should NOT have a loop.
Design the function get_num that takes two arguments: an integer that represents a minimum value and a string to use as a prompt for the user. The function should repeatedly ask the user with the given prompt to enter a number until the user enters a valid integer greater than or equal to the given minimum. The function should return the valid entry as an integer.
Your function should assume the given minimum will be non-negative.
Note: Examples within your docstring can be omitted. Be sure to test your function from the shell!
TIP: Again, Pythons string isdigit() function will be helpful
Design the function print_name_age_v3 that does not take any arguments but prompts the user to enter their name and then prompts them to enter a number for their age. It then prints hello followed by the name and the category of the age. If the user enters an invalid age (ie, letters, a number smaller than 0) it will continue to ask the user for a number until they enter a number that is a valid age.
Age categories are as described in version 1.
Note: Examples within your docstring can be omitted. Be sure to test your function from the shell!
TIP: Your function should call the get_num function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!