21 lines
460 B
Python
21 lines
460 B
Python
#!/usr/bin/python3
|
|
|
|
import random
|
|
|
|
from util.io import readvalue
|
|
|
|
if( __name__ == "__main__"):
|
|
random_value = random.randint(1, 6)
|
|
print("I just generated a random number between 1 and 6")
|
|
guess = -1
|
|
while(1):
|
|
guess = readvalue("Could you guess it? Try: ", int)
|
|
if(not(1 <= guess <= 6)):
|
|
print("Your number is not in the interval.")
|
|
else:
|
|
break
|
|
if(guess != random_value):
|
|
print("Wrong, it was", random_value, "!")
|
|
else:
|
|
print("Nice try")
|