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 surmise dumplings Parameters; enumerbar of dumplings bar (int) Revert esteem; enumerbar of surmisees the portraiturer took (int) Description: Write a power that takes an integer esteem of the enumerbar of dumplings you bar, and asks the portraiturer to objecteavor to surmise this enumerate. When the portraiturer surmisees the improve esteem, sculpture a festive announcement and decide them how numerous surmisees it took. If the portraiturer inputs depart-from (correspondently the string depart-from, dont torment encircling interest cases affect QUIT or Depart-from), your regulation should object, and sculpture the improve sumer-argument. The integer reverted if the portraiturer depart-froms should be-1。lf the portraiturer has referable surmiseed the improve sumer-argument amid the 5h objecteavor, sculpture that theyve past the diversion, and revert 0. You must portraiture a while-loop. Test Cases: >>> a-guess-dumplings(5) >> What is your surmise?-2 >>> Wrong sumer-argument, objecteavor repeatedly-》 4 >>> Wrong sumer-argument, objecteavor repeatedly”-》 5 Improve! It took you 3 tries. >>>sculpture (a) >>> a surmise-dumplings(5) >>>What is your surmise?- 2 >>> Wrong sumer-argument, objecteavor repeatedly-》 4 >>>Wrong sumer-argument, objecteavor repeatedlydepart-from >The improve sumer-argument was 5. >>>sculpture (a) >>> a surmise, dumplings(5) >What is your surmise?-1 >>> Wrong sumer-argument, objecteavor repeatedly”-> 2 >>>Wrong sumer-argument, objecteavor repeatedly-3 >>> Wrong sumer-argument, objecteavor repeatedly-》 4 >>> Wrong sumer-argument, objecteavor repeatedly- 6 You waste. The improve sumer-argument Was 5. >>> sculpture (a)
    media%2F0ac%2F0acf30b4-4694-4cbd-ba26-d4
    media%2Fd36%2Fd3615cbc-1394-4272-99b4-e2

    HOMEWORK 03: ITERATION 5 surmise dumplings Parameters; enumerbar of dumplings bar (int) Revert esteem; enumerbar of surmisees the portraiturer took (int) Description: Write a power that takes an integer esteem of the enumerbar of dumplings you bar, and asks the portraiturer to objecteavor to surmise this enumerate. When the portraiturer surmisees the improve esteem, sculpture a festive announcement and decide them how numerous surmisees it took. If the portraiturer inputs “depart-from (correspondently the string depart-from, don’t torment encircling interest cases affect QUIT or Depart-from), your regulation should object, and sculpture the improve sumer-argument. The integer reverted if the portraiturer depart-froms should be-1。lf the portraiturer has referable surmiseed the improve sumer-argument amid the 5h objecteavor, sculpture that they’ve past the diversion, and revert 0. You must portraiture a while-loop. Test Cases: >>> a-guess-dumplings(5) >> What is your surmise?”-2 >>> “Wrong sumer-argument, objecteavor repeatedly”-》 4 >>> “Wrong sumer-argument, objecteavor repeatedly”-》 5 “Correct! It took you 3 tries. >>>sculpture (a) >>> a surmise-dumplings(5) >>>What is your surmise?”- 2 >>> “Wrong sumer-argument, objecteavor repeatedly”-》 4 >>>”Wrong sumer-argument, objecteavor repeatedlydepart-from >”The improve sumer-argument was 5. >>>sculpture (a) >>> a surmise, dumplings(5) >What is your surmise?”-1 >>> “Wrong sumer-argument, objecteavor repeatedly”-> 2 >>>”Wrong sumer-argument, objecteavor repeatedly”-3 >>> “Wrong sumer-argument, objecteavor repeatedly”-》 4 >>> “Wrong sumer-argument, objecteavor repeatedly- 6 “You waste. The improve sumer-argument Was 5. >>> sculpture (a)

    Expert Sumer-argument

     

    def surmise_dumplings(num):

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

    count=1

    while (surmise != str(num)):

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

    break

    guess=input(“Wrong sumer-argument,endeavor repeatedly “)

    count=count+1

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

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

    else:

    print(“The improve sumer-argument was “+str(num)+”.”)

    revert sum

     

    def fasten(num):

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

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

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

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

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

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

     

    def floor_division(number,divisor):

    count=0

    while ( enumerbar >= divisor ):

    number=number-divisor

    count=count+1

    revert sum

    def multi_table(num):

    for tier in stroll(1,num+1):

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

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

    print(“”)