Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program B Your program will randomly pick a 3-digit numeric code, then repeatedly prompt the user to guess the code. For each guess the program
Program B Your program will randomly pick a 3-digit numeric code, then repeatedly prompt the user to guess the code. For each guess the program will repeat the guess and tell the user how many digits in the guess match in the same positions in the code Keep processing guesses until the user gets the code correct or enters O to quit the game. Here is a sample run of the program. User input is shown in red ehavion Guess my 3-digit codel Your guess? 123 123 digits correct Your guess? 444 444 - 2 digits correct Your guess? 144 144 1 digit correct Your guess? 424 424 2 digits correct Your guess? 434 434 - 2 digits correct Your guess? 454 454 2 digits correct Your guess? 464 464 - 2 digits correct Your guess? 474 474 - 3 digits correct You got it in 8 turns! When the user gets the code correct, print a final message indicating the number of turns it took (as shown above). If the user quits the game before finishing (by entering a guess of 0), print the message "Ok. Maybe another time." You may assume the user will enter a valid 3-digit integer on each guess. Make sure your output and prompts look like the example above
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started