Python(二)控制语句

import random
secret = random.randint(1,10)
print("---------------Welcome----------------")

result = False
while(result == False):
tmp = input("不妨猜猜现在awen心里想的哪一个幸运数字?")
guess = int(tmp)

if guess == secret:
print("真牛逼,你第一次就猜对了!\n")
print("欢迎下次再来")
result = True
else:
if guess > secret:
print("好可惜,猜大了")
else:
print("哎哟,猜小了")
print("Game Over...")

猜你喜欢

转载自awenhaowenchao.iteye.com/blog/2408123