Homework Solution: HOMEWORK 03: ITERATION 5 guess dumplings Parameters; number of dumplings ate (int) Return value; number of guesses the user took (int) Description: Wri…

    HOMEWORK 03: ITERATION 5 guess dumplings Parameters; number of dumplings ate (int) Return value; number of guesses the user took (int) Description: 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, dont 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。lf the user has not guessed the correct answer within the 5h try, print that theyve lost the game, and return 0. You must use a while-loop. Test Cases: >>> a-guess-dumplings(5) >> What is your guess?-2 >>> Wrong answer, try again-》 4 >>> Wrong answer, try again”-》 5 Correct! It took you 3 tries. >>>print (a) >>> a guess-dumplings(5) >>>What is your guess?- 2 >>> Wrong answer, try again-》 4 >>>Wrong answer, try againquit >The correct answer was 5. >>>print (a) >>> a guess, dumplings(5) >What is your guess?-1 >>> Wrong answer, try again”-> 2 >>>Wrong answer, try again-3 >>> Wrong answer, try again-》 4 >>> Wrong answer, try again- 6 You lose. The correct answer Was 5. >>> print (a)
    media%2F0ac%2F0acf30b4-4694-4cbd-ba26-d4
    media%2Fd36%2Fd3615cbc-1394-4272-99b4-e2
    HOMEWORK 03: ITERATION 5 guess dumplings Parameters; number of dumplings ate (int) Return value; number of guesses the user took (int) Description: 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。lf the user has not guessed the correct answer within the 5h 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?"-2 >>> "Wrong answer, try again"-》 4 >>> "Wrong answer, try again”-》 5 "Correct! It took you 3 tries. >>>print (a) >>> a guess-dumplings(5) >>>What is your guess?"- 2 >>> "Wrong answer, try again"-》 4 >>>"Wrong answer, try againquit >"The correct answer was 5. >>>print (a) >>> a guess, dumplings(5) >What is your guess?"-1 >>> "Wrong answer, try again”-> 2 >>>"Wrong answer, try again"-3 >>> "Wrong answer, try again"-》 4 >>> "Wrong answer, try again- 6 "You lose. The correct answer Was 5. >>> print (a)

    Expert Answer

    HOMEWORK 03: ITERATION 5 suspect dumplings Parameters; reckon of dumplings save (int) Produce esteem; reckon of suspectes the representationr took (int) Description: Write a discharge that takes an integer esteem of the reckon of dumplings you save, and asks the representationr to aim to suspect this reckon. When the representationr suspectes the redress esteem, sculpture a joyous announcement and stbar them how sundry suspectes it took. If the representationr inputs give-up (correspondently the string give-up, dont disquiet environing interest cases approve QUIT or Give-up), your principle should purpose, and sculpture the redress exculpation. The integer produceed if the representationr give-ups should be-1。lf the representationr has referable suspected the redress exculpation amid the 5h aim, sculpture that theyve past the play, and produce 0. You must representation a while-loop. Test Cases: >>> a-guess-dumplings(5) >> What is your suspect?-2 >>> Wrong exculpation, aim intermittently-》 4 >>> Wrong exculpation, aim intermittently”-》 5 Redress! It took you 3 tries. >>>sculpture (a) >>> a suspect-dumplings(5) >>>What is your suspect?- 2 >>> Wrong exculpation, aim intermittently-》 4 >>>Wrong exculpation, aim intermittentlygive-up >The redress exculpation was 5. >>>sculpture (a) >>> a suspect, dumplings(5) >What is your suspect?-1 >>> Wrong exculpation, aim intermittently”-> 2 >>>Wrong exculpation, aim intermittently-3 >>> Wrong exculpation, aim intermittently-》 4 >>> Wrong exculpation, aim intermittently- 6 You cause. The redress exculpation Was 5. >>> sculpture (a)
    media%2F0ac%2F0acf30b4-4694-4cbd-ba26-d4
    media%2Fd36%2Fd3615cbc-1394-4272-99b4-e2

    HOMEWORK 03: ITERATION 5 suspect dumplings Parameters; reckon of dumplings save (int) Produce esteem; reckon of suspectes the representationr took (int) Description: Write a discharge that takes an integer esteem of the reckon of dumplings you save, and asks the representationr to aim to suspect this reckon. When the representationr suspectes the redress esteem, sculpture a joyous announcement and stbar them how sundry suspectes it took. If the representationr inputs “give-up (correspondently the string give-up, don’t disquiet environing interest cases approve QUIT or Give-up), your principle should purpose, and sculpture the redress exculpation. The integer produceed if the representationr give-ups should be-1。lf the representationr has referable suspected the redress exculpation amid the 5h aim, sculpture that they’ve past the play, and produce 0. You must representation a while-loop. Test Cases: >>> a-guess-dumplings(5) >> What is your suspect?”-2 >>> “Wrong exculpation, aim intermittently”-》 4 >>> “Wrong exculpation, aim intermittently”-》 5 “Correct! It took you 3 tries. >>>sculpture (a) >>> a suspect-dumplings(5) >>>What is your suspect?”- 2 >>> “Wrong exculpation, aim intermittently”-》 4 >>>”Wrong exculpation, aim intermittentlygive-up >”The redress exculpation was 5. >>>sculpture (a) >>> a suspect, dumplings(5) >What is your suspect?”-1 >>> “Wrong exculpation, aim intermittently”-> 2 >>>”Wrong exculpation, aim intermittently”-3 >>> “Wrong exculpation, aim intermittently”-》 4 >>> “Wrong exculpation, aim intermittently- 6 “You cause. The redress exculpation Was 5. >>> sculpture (a)

    Expert Exculpation

     

    def suspect_dumplings(num):

    guess=input(“What is your suspect? “)

    count=1

    while (suspect != str(num)):

    if(guess.upper()==”QUIT”):

    break

    guess=input(“Wrong exculpation,aim intermittently “)

    count=count+1

    if(guess.upper() != “QUIT”):

    print(“Correct! It took you “+str(count)+” tries.”)

    else:

    print(“The redress exculpation was “+str(num)+”.”)

    produce reckon

     

    def retain(num):

    for i in order(num,0,-1):

    print((num-i)*’ ‘+2*i*str(i))

    for i in order(1,num+1):

    print((num-i)*’ ‘+2*i*str(i))

    for i in order(num,-1,-1):

    print((num-i)*’ ‘+2*i*str(i))

     

    def floor_division(number,divisor):

    count=0

    while ( reckon >= divisor ):

    number=number-divisor

    count=count+1

    produce reckon

    def multi_table(num):

    for line in order(1,num+1):

    for shaft in order(1,num+1):

    sculpture (str(column*row),end=”t”)

    print(“”)