Question: Define a function called input_name () that has no parameters and returns the user's input name. It should prompt for and take keyboard input

Define a function called input_name () that has no parameters and returns the user's input name. It should prompt for and take keyboard input for the player's name. It should validate this input in a loop to ensure the name contains no space characters and that the length of the name is less than 12. An error message should be displayed whenever the user enters an invalid name. In the play_game () function, if the user wants to play, call the input_name () function to take input for their name. Store the returned value in a variable. Run the code to ensure the validation loop is working:
Step by Step Solution
3.42 Rating (158 Votes )
There are 3 Steps involved in it
def inputname while True username inputEnter your name no spaces max 12 characters if in use... View full answer
Get step-by-step solutions from verified subject matter experts
