|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- import random
- secret = random.randint(1,50)
- print("-------------Guess number game--------------")
- temp = input("Guess what number I am thinking in 1-50 (try 5 times) : ")
- guess = int(temp)
- if guess == secret:
- print("You get it!")
- print("It was it!")
- else:
- if guess > secret:
- print("It was bigger than the number")
- else:
- print("It was smaller than the number")
- counts = 4
- if guess != secret:
- while counts > 0:
- temp = input("Incorrect ,try again: ")
- guess = int(temp)
- if guess == secret:
- print("You get it!")
- print("It was it! ")
- else:
- if guess > secret:
- print("It was bigger than the number")
- else:
- print("It was smaller than the number")
- counts = counts - 1
- print("Game Over^_^")
复制代码 |
|