Python problem:
Write a program in which the program guesses the number that the user is thinking about. Example of

output per screen:

Think of a number from 1 to 4.

Answer S (yes) or N (no) to my questions.

Is the number thought to be greater than 2? S

Is the number thought to be greater than 3? N

The number thought about is 3

See you next time!

Respuesta :

print("Think of a number from 1 to 4")

print("Answer S (yes) or N (no) to my questions.")

choice = input("Is the number thought to be greater than 2? ")

if choice == "S":

   choice = input("Is the number thought to be greater than 3? ")

   if choice == "S":

       print("The number thought about is 4")

   elif choice == "N":

       print("The number thought about is 3")

elif choice == "N":

   choice = input("Is the number thought to be greater than 1? ")

   if choice == "S":

       print("The number thought about is 2")

   elif choice == "N":

       print("The number thought about is 1")

print("See you next time!")

This works for me. Best of luck!

ACCESS MORE