python循环语句简单登录系统

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

import os
import random
password1 = 0
while True :
    os.system("cls")
    print("\t\t英雄商城登录界面")
    print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")
    print("\t\t1.用户登录\n")
    print("\t\t2.用户注册\n")
    print("\t\t3.退出系统\n")
    print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")
    chioce = int(input("请输入您的选择:"))
    if chioce == 1 :
        if password1 == 0 :
            print("\t\t您还没有账号!请注册后登录。")
            os.system("pause")
        else :
            while True :
                new_name = input("输入您的用户名称:")
                new_password = int(input("请输入您的密码:"))
                if new_name == name1 and new_password == password1 :
                    os.system("cls")
                    print("\t\t登录成功......")
                    os.system("pause")
                    while True :
                        os.system("cls")
                        print("\t\t英雄商城首页")
                        print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")
                        print("\t\t1.进入英雄超市\n")
                        print("\t\t2.休闲小游戏\n")
                        print("\t\t3.返回上一层\n")
                        print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")
                        chioce2 = int(input("请输入您的选择:"))
                        if chioce2 == 1 :
                            while True :
                                print("\t\t英雄联盟新款皮肤1折起,只需要支付28元人民币!")
                                quantity = int(input("请输入需要购买的数量:"))
                                price = quantity * 28
                                print("\t\t总共需要支付金额为:",price)
                                print("是否支付 是/否:",end = "")
                                chioce3 = input()  
                                if chioce3 == '是' :
                                    while True :
                                        money = int(input("请支付商品所需要的金额:"))
                                        if money == price :
                                            print("\t\t支付成功!谢谢您的支持!")
                                            os.system("pause")
                                            os.system("cls")
                                            break
                                        else :
                                            print("\t\t支付金额错误!请重新支付。")
                                    break
                                else :
                                    os.system("cls")
                                    break
                        if chioce2 == 2 :
                            while True :
                                os.system("cls")
                                chaos_word = ''
                                chioce4 = ''
                                words = ['answer','difficult','python','hello','look','orange']
                                print("\t\t欢迎来到猜词游戏!")
                                choice = input("是否进行游戏 是/否 :")
                                if choice == '是' :
                                    choice_word = random.choice(words)
                                    length_word = len(choice_word)
                                    k = random.sample(choice_word,length_word)
                                    for i in range(length_word) :
                                        chaos_word += k[i]
                                    print("乱序单词为:"+chaos_word)
                                    word = input("请输入您猜测的英文单词:")
                                    if word == choice_word :
                                        print("恭喜你猜对了!")
                                        chioce4 = input("还想继续吗? Yes/No:")
                                        if chioce4 == 'No' :
                                            break
                                    else :
                                        print("偶~!猜错了,正确答案是:"+choice_word)
                                        chioce4 = input("还想继续吗? Yes/No:")
                                        if chioce4 == 'No' :
                                            break
                                else :
                                    print("\t\t欢迎下次光临!")
                                    os.system("pause")
                                    break
                        if chioce2 == 3 :
                            break
                    break
    if chioce == 2 :
        while True :
            phone_number = int(input("请您输入您要注册的电话号码:"))
            if 10000000000 < phone_number < 99999999999 :
                while True :
                    Verification_code = int(input("请输入验证码:"))
                    if 100000 < Verification_code < 999999 :
                        while True :
                            name1 = input("请设置用户名称:")
                            name2 = input("请在输入一遍名称:")
                            password1 = int(input("请设置密码:"))
                            password2 = int(input("请再次输入密码:"))
                            if password1 == password2 and name1 == name2:
                                print("\t\t注册成功!请重新登录。")
                                os.system("pause")
                                break
                            else :
                                print("\t密码输入不一致,请重新输入!")
                        break
                    else :
                        print("\t验证码错误!请重新输入。")
                break
            else :
                print("\t该手机号已注册或您输入的手机号有误!请重新输入。")  
    if chioce == 3 :
        print("\t\tGame over !\n")
        break
    if chioce != 1 and chioce != 2 and chioce != 3 :
        print("\t\t你选择错误,呜呜呜~~~~") 
        os.system("pause")
    os.system("cls")

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值