|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
# p2_1.py
"""---第一个小游戏---"""
temp = input("不妨猜猜我心中想的哪个数字:")
guess = int(temp)
while guess != 30:
if guess > 30:
print("太大了太大了")
else:
print("小了小了,胆子放大点")
temp = input("勉强给你个机会,请再试试吧:")
guess = int(temp)
times = times + 1
if (times <= 3) and (guess == 30):
print("猜对啦")
print("哈哈哈!真是太不可思议了!您抽中一杯圣诞杯!!!")
else:
print("啊,给3次机会都猜错,送你一坨便便,不玩啦!!!")
------------------------------------IDLE画面-------------------------------------------------------------------------
不妨猜猜我心中想的哪个数字:15
小了小了,胆子放大点
勉强给你个机会,请再试试吧:30
Traceback (most recent call last):
File "C:\Users\szz00054\Desktop\第二个游戏.py", line 14, in <module>
times = times + 1
NameError: name 'times' is not defined |
|