|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
现在还是很懵逼的状态,不说了,分享:
username = "123"
password = "123"
import random
secret = random.randint(1,10)
count = 0
counts = 0
oks = "ok"
ev = 0
en = 0
whe = 1
at = 0
while count < 3:
input_name = input("请用户输入账号:")
input_pass = input("请用户输入密码:")
if input_name == username and input_pass == password:
print("登陆成功")
plays = input("请确定进入:")
if plays == oks:
while counts < 3:
guess = input(f"请输入你猜的数字(1-10),你还有{ 3 - counts}机会:")
while not guess.isdigit():
guess = input("抱歉,您的输入有误,请输入一个整数:")
guess = int(guess)
if guess < 1 or guess > 10:
print("请输入1-10之间的数字!")
continue
counts += 1
if guess == secret:
print("恭喜你,猜对了")
break
elif guess > secret:
print("猜错了,大了")
else:
print("猜错了,小了")
if counts == 3:
print(f"游戏结束!正确答案是{secret}")
print("-" * 40)
print("现在可以进行下一个游戏了哦,开心吗?")
input("大声告诉我你现在的感受:")
options = ["大吉","大福","横财"]
result = random.choice(options)
print("你本次抽到的签是:",result)
print(f"你很幸运,抽中{result},恭喜你哦,如果你愿意,我们可以进行下一个知识点.")
print("-" * 40)
leap = input("你想知道哪一年是闰年吗?想知道输入ok哦.您的输入是:")
if leap == oks:
year = input("请输入一个年份:")
while not year.isdigit():
year = input("抱歉,你输入有误,请输入一个整数:")
year = int(year)
if year % 400 == 0:
print(year, "是闰年!")
else:
if year % 4 == 0 and year % 100 != 0:
print(year, "是闰年!")
else:
print(year, "不是闰年!")
print("-" * 40)
print("非常棒,现在我们继续下一个游戏")
print("我们一起玩一个猜拳游戏吧")
choices = ["石头","剪刀","布"]
computer = random.choice(choices)
player = input("请出拳(石头/剪刀/布):")
print("你出的是:",player)
print("电脑出的是:",computer)
if player == computer:
print("平局")
elif (player == "石头" and computer == "剪刀") or\
(player == "剪刀" and computer == "布") or\
(player == "布" and computer == "石头"):
print("你赢了,太棒了")
else:
print("您输了")
print("-" * 40)
print("现在我们复习一下取偶数游戏")
while ev <= 1000000:
if ev % 2 == 0:
en += ev
ev += 1
print("1000000以内所有偶数的和是:", en)
print("-" * 40)
print("现在复习麦子游戏,循环计数N+64次方")
while whe <= 64:
wheats = pow(2, whe-1)
at += wheats
whe += 1
print("大王应该给农民",at,"麦粒子")
break
else:
print("老规矩,不OK退出了哦")
break
else:
print("不ok自动退出了哦")
break
else:
print("用户名或者密码错误")
count += 1
if count == 3:
print("错误三次,账户锁定")
print("-" * 40)
|
|