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. 6. Define the isSingleDigit(userStr) 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 (09). o Check to see if the userStr parameter contains only digit and the length is 1. If so, return True. If not, return False. To do this, call the len() function and the str.isdigit() method. o You will call this function in the createUserGuess() function. 7. Define the createSecretCode(numDigits) 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 0 and 9(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 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!