源代码:
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)
choice = int(input("请输入你的选择:"))
while choice == 1:
username = input("请输入您的用户名称:")
password = input("请输入您的用户密码:")
if username == "kio" and password == "121212":
print("用户名登录成功!!!")
break
print("""
自定义商城首页
1、进入商城
2、休闲小游戏
3、退出页面
""")
select = int(input("请输入你的选择:"))
if choice == 1:
print("新款皮肤折扣3折,需支付28元人民币")
purchase = int(input("请输入购买数量:"))
money = 28 * purchase
print("你购买的皮肤,所需金额为%s"%(money))
money1 = int(input("请支付购买商品所需金额:"))
if money1 == money:
print("购买成功!")
break
if choice == 2:
print("各种各样的小游戏...")
break
if choice == 3:
print("退出页面!")
break
while choice == 2:
phone = input("请输入您要注册的手机号码:")
if len(phone) != 11:
print("该手机号已注册或您输入的手机号有误,请重新输入!")
break
elif len(phone) == 11:
print("继续下一步!")
message = input("请输入短信验证码:")
if len(message) != 6:
print("输入的短信验证码有误,请你重新验证!")
break
password01 = input("请输入密码:")
password02 = input("请再次输入密码:")
if password01 == password02 and len(password01) >= 6 :
print("注册成功,请重新登录。")
break
while choice == 3:
break
print("退出成功!")
实现结果:
期待下一次的再见~
和你们一起学习的小夏~