Python 3.6 language
Write a function that takes an integer value of the number of dumplings you ate, and asks the user to try to guess this number. When the user guesses the correct value, print a congratulatory statement and tell them how many guesses it took. If the user inputs “quit” (exactly the string quit, don’t worry about edge cases like ‘QUIT’ or ‘Quit’), your code should end, and print the correct answer. The integer returned if the user quits should be-1. If the user has not guessed the correct answer within the 5^th try, print that they’ve lost the game, and return 0. You must use a while-loop. Test Cases: > > > a = guess_dumplings(5) > > > “What is your guess?” rightarrow 2 > > > “Wrong answer, try again” rightarrow 4 > > > “Wrong answer, try again” rightarrow 5 > > > “Correct! It took you 3 tries.” > > > print (a) > > > 3 > > > a = guess_dumplings(5) > > > “What is your guess?” rightarrow 2 > > > “Wrong answer, try again” rightarrow 4 > > > “Wrong answer, try again” rightarrow quit > > > “The correct answer was 5.” > > > print (a) > > > -1 > > > a = guess_dumplings(5) > > > “What is your guess?” rightarrow 1 > > > “Wrong answer, try again” rightarrow 2 > > > “Wrong answer, try again” rightarrow 3 > > > “Wrong answer, try again” rightarrow 4 > > > “Wrong answer, try again” rightarrow 6 > > > “You lose. The correct answer Was 5.” > > > print (a) > > > 0