Question: . Import the random module. 6 . Define the isSingleDigit ( userStr ) function. Parameter: userStr is a string that holds input from the user
Import the random module. Define the isSingleDigituserStr function. Parameter: userStr is a string that holds input from the user Return value: a boolean True or False depending if userStr is a string containing one single digit This function determines if the user entered a string containing a single digit o Check to see if the userStr parameter contains only digit and the length is If so return True. If not, return False. To do this, call the len function and the strisdigit method. o You will call this function in the createUserGuess function. Define the createSecretCodenumDigits function. Parameter: numDigits is an integer which determines the number of digits in the secret code list Return value: a list containing randomly selected integers between and inclusive and the length of the list is the numDigits parameter This function create a list of single digits. o Create a varible that initially holds an empty list.
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
