Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Hi, I am having trouble writing a Python program code for this pseudocode. #Random number, loop while true #ask user for number.

Hi,

I am having trouble writing a Python program code for this pseudocode. Please help thank you.

#Random number, loop while true

#ask user for number. Check to see if the value is a number between 1 and 10

#if number is too high or too low, tell user, if they guessed it break out of loop

Display "Welcome to my Guess the number program!"

random mynumber

count=1

while True

  try

   Display "Guess a number between 1 and 10"

    Get guess

   while guess<1 or guess>10

     Display "Guess a number between 1 and 10"

      Get guess

  except

     Display "numbers only"

     continue

  if (guess<mynumber)

     Display "Too low"

     count=count+1

  else if (guess>mynumber)

     Display "Too high"

     count=count+1

  else if (guess==mynumber)

    Display "You guessed it in "+ count + " attempts"

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question