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 printnameagev 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 adult is to inclusivesenior is 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',
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 printnameagev 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 etc... it prints the name followed by you are lying about your age.
Age categories are as described in version
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 getnum 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 nonnegative.
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 printnameagev 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 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
Note: Examples within your docstring can be omitted. Be sure to test your function from the shell!
TIP: Your function should call the getnum function
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
