import random
while True:
print("\t\t\t英雄商城登录界面\n")
print("~*"*38)
print("\t\t\t1.用户登录\n")
print("\t\t\t2.用户注册\n")
print("\t\t\t3.退出系统\n")
print("~*"*38)
num_1 = int(input("请输入您的选择,召唤师:"))
ls_user = ["张三"]
ls_passwd = ["123456"]
if num_1 == 2:
user_1 = str(input("输入您的用户名,召唤师:"))
ls_user.append(user_1)
passwd_1 = str(input("输入您的密码,召唤师:"))
passwd_2 = str(input("确认您的密码,召唤师:"))
while passwd_1 != passwd_2:
print("您输入的两次密码不同,请重新输入")
passwd_1 = str(input("输入您的密码,召唤师:"))
passwd_2 = str(input("确认您的密码,召唤师:"))
ls_passwd.append(passwd_1)
print("用户注册成功!")
elif num_1 == 1:
user_2 = str(input("输入您的用户名,召唤师:"))
passwd_3 = str(input("输入您的密码,召唤师:"))
use = ",".join(ls_user).find(user_2)
pwd = ",".join(ls_passwd).find(passwd_3)
while use == -1 or pwd == -1:
print("账号或者密码出现错误!请您检查一下英文大小写区分或者标点符号!")
user_1 = str(input("输入您的用户名,召唤师:"))
passwd_1 = str(input("输入您的密码,召唤师:"))
print("登录成功...")
while True:
print("\t\t\t英雄商城首页\n")
print("~*"*38)
print("\t\t\t1.进入英雄商店\n")
print("\t\t\t2.休闲小游戏\n")
print("\t\t\t3.退出页面\n")
print("~*"*38)
num_2 = int(input("请输入您的选择,召唤师:"))
if num_2 == 1:
print("新款皮肤只需99$\n英雄仅需45$")
print("请问您需要购买几个英雄几个皮肤?")
need_1 = int(input("英雄:"))
need_2 = int(input("皮肤:"))
all_money = (need_2 * 99) + (need_1 * 45)
print("您购买的总金额为:",all_money)
pay = float(input("请支付金额:"))
while pay != all_money:
print("支付错误,请重新支付:")
pay = float(input("请支付金额:"))
print("付款成功")
elif num_2 == 2:
index_comp = 0
index_hump = 0
num_comp = random.randint(0,2)
while index_hump < 2 or index_comp < 2:
num_hump = int(input("输入你选择出的(0代表石头,1代表剪刀,2代表布):"))
if num_hump == 0:
if num_comp == 0:
print("双方平局")
elif num_comp == 1:
print("电脑赢")
index_comp += 1
else:
print("用户赢")
index_hump += 1
elif num_hump == 1:
if num_comp == 0:
print("电脑赢")
index_comp += 1
elif num_comp == 1:
print("双方平局")
else:
print("用户赢")
index_hump += 1
else:
if num_comp == 0:
print("用户赢")
index_hump += 1
elif num_comp == 1:
print("电脑赢")
index_comp += 1
else:
print("双方平局")
if index_hump == 2:
print("用户先获胜")
break
elif index_comp == 2:
print("电脑先获胜")
break
elif num_2 == 3:
break
elif num_1 == 3:
break
登陆注册作业
最新推荐文章于 2024-11-08 13:43:44 发布