# Python 3
import random
number = random.randrange(1, 100)
while 1==1:
guess = int(input("Guess a number(1~100):"))
if guess == number:
print ("Great! You win!")
break
elif guess < number:
print ("Too small!")
else:
print ("Too big!")
import random
number = random.randrange(1, 100)
while 1==1:
guess = int(input("Guess a number(1~100):"))
if guess == number:
print ("Great! You win!")
break
elif guess < number:
print ("Too small!")
else:
print ("Too big!")
# Python 3 import random number = random.randrange(1, 100) while 1==1: guess = int(input("Guess a number(1~100):")) if guess == number: print ("Great! You win!") break elif guess < number: print ("Too small!") else: print ("Too big!")
沒有留言:
張貼留言