Oct-25-2022, 05:17 PM
So, another way would be:
import random RNumber = random.randint(1, 10) user_input = 0 while user_input != RNumber: user_input = int(input("please guess a number between 1 and 10: ")) if user_input > RNumber: print("choose a lower number: \n") elif user_input < RNumber: print("choose a higher number: \n") print("the number you chose is correct (", RNumber, ")")
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein