python program : Guess the number program

profileadelen
 (Not rated)
 (Not rated)
Chat

 

Welcome to my Guess the number program!

  1. You guess the number
  2. Type a number and see if the computer can guess it
  3. Exit

What is your choice: 1

Please guess a number between 1 and 10: 5

Too high

Please guess a number between 1 and 10: 4

Too high

Please guess a number between 1 and 10: 3

Too high

Please guess a number between 1 and 10: 2

Too high

Please guess a number between 1 and 10: 1

You guessed it! It took you 5 attempts

You picked the following numbers: [5, 4, 3, 2, 1]

  1. You guess the number
  2. Type aTnumber and see if the computer can guess it
  3. Exit

What is your choice: 2

Please enter a number between 1 and 10 for the computer to guess: 5

The computer guessed 8 which is too high

The computer guessed 7 which is too high

The computer guessed 4 which is too low

The computer guessed 7 which is too high

The computer guessed 4 which is too low

The computer guessed 7 which is too high

The computer guessed 2 which is too low

The computer guessed 1 which is too low

The computer guessed 7 which is too high

The computer guessed 6 which is too high

The computer guessed 3 which is too low

The computer guessed it! It took 12 attempts

The computer guessed the following numbers: [8, 7, 4, 7, 4, 7, 2, 1, 7, 6, 3, 5]

  1. You guess the number
  2. Type a number and see if the computer can guess it
  3. Exit

What is your choice: 3

Thank you for playing the guess the number game!

    • 7 years ago
    python file attached
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      guess.py