Extend the program by writing another function getClues() that: – that takes player’s guess and the secret number as parameters – if player’s guess is equal to secret number retur
Extend the program by writing another function getClues() that: – that takes player’s guess and the secret number as parameters – if player’s guess is equal to secret number return “You got it” – if none of the three digits in player’s guess is in the secret number, return “Bagels” if one of the digits in the player’s guess is in the secret number, but the digit is in the wrong position, add Pico to the clue if one of the digits in the player’s guess has a correct digit in the correct position, add Fermi to the clue – return the clue. Save the file as BAGLES2___.py Extend your program to create a user interface. The program must: – print out a welcome message – inform the player that he has 10 guesses – inform the players the remaining number of guesses – if players exceeds the number of guesses, print the answer – calls the function getSecretNum – calls the function inGuess – calls the function getClue. You are writing a program for a game called Bagels in which the player tries to guess random three-digit secret number (with no repeating digits) generated by the computer After each guess, the computer gives the player three type of clues: – Bagels – None of the three digits guessed is in the secret number – Pico – One of the digits guessed is in the secret number, but the position is wrong – Fermi – One of the digits guessed is in the secret number and the position is correct. The computer can give multiple clues, which are sorted in alphabetical order. For example, if the secret number is 456 and the player’s guess is 546 , the clues would be Fermi Pico Pico. The Fermi is from the 6 and Pico Pico are from 4 and 5. Open the file BAGLES.py You will see the following function that create the secret number: import random NUM_DIGITS =3 MAX_GUESS =10 def getSecretNum (): numbers = list (‘0123456789’) random.shuffle (numbers) secretNum = ‘ ‘ for i in range (NUM_DIGITS): secretNum += str(numbers [i]) return secretNum import random NUM_DIGITS =3 MAX_GUESS =10 def getSecretNum(): numbers = list (′0123456789 ‘) random. shuffle (numbers) secretNum = ‘ ‘ for i in range (NUM_DIGITS): secretNum +=str (numbers[i]) return secretNum 11 Extend the program by writing another function inGuess() that: – ask the player to input his guess – validates that the player’s guess is 3 digits in length and only consist of digits – ask for input again if the player’s guess is not valid – returns the user guess if it is valid.
OR