Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

adding to this program :option for the computer to guess as well as

adding to this program :option for the computer to guess as well as

the user to guess a number. import random at the beginning of your code and use a comment block explaining what your program doesa menu system.

old code

print(“Welcome to my Guess the number program!”)

import random at the beginning of your code and use a comment block explaining what your program does

mynumber = random.randint(1, 10)

counter = 0

while (True):

  try:

    counter += 1

    guess = int(input(“Gues a number between 1 and 10: “))

    if guess < 1 or guess > 10:

      print(“Please enter a number between 1 and 10”)

    else:

      if (guess < mynumber):

        print(“Too low”)

      elif (guess > mynumber):

        print(“Too high”)

      elif (guess == mynumber):

        print(“You guessed it!”)

        print(” in “, counter, ” guesses”)

        break

  except:

    print(“Numbers only!.”)

Screen Shot 2019-02-17 at 11.51.47 AM.png
Screen Shot 2019-02-17 at 11.51.36 AM.png

 ATTACHMENT PREVIEW Download attachment

Screen Shot 2019-02-17 at 11.51.36 AM.png

Screen Shot 2019-02-17 at 11.51.36 AM.png

1I.r&quot;I.&quot;hen you run the program you should see something like the following:
1I.r&quot;I.’e|come to my Guess the number program! 1. You guess the number
2. You type a number and see if the computer can guess it
3. Exit 1What is your choice: 1 Please guess a number between 1 and 1t]: 3
Too high Please guess a number between 1 and 1t]: 1&quot;
You guessed it! it tool: you 2 attempts 1. You guess the number
2. You type a number and see if the computer can guess it
3. Exit 1What is your choice: 2 Please enter a number between 1 and 1D for the computer to guess: 5
The computer guessed i&quot; which is too high The computer guessed 2 which is too low The computer guessed El which is too high The computer guessed E which is too high The computer guessed ti which is too high The computer guessed 1 which is too low

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"