zoukankan      html  css  js  c++  java
  • day10

    在猜年龄的基础上编写登录、注册方法,并且把猜年龄游戏分函数处理,如

    1. 登录函数
    2. 注册函数
    3. 猜年龄函数
    4. 选择奖品函数

    登录函数

    def login():
        """登录功能"""
    count = 0
    while count < 3
        username_inp = input('请输入用户名')
        pwd_ino = input('请输入密码')
        if username.strip()  == username_inp and pwd.strip () == pwd_inp
            print('登录成功')
        else:
            continue
    else:
        print('登录失败')
        break
    

    注册函数

    def register():
        """注册功能"""
    count = 0
    while count < 3
        username_inp = input('请输入用户名')
        pwd_ino = input('请输入密码')
        re_pwd_inp = input('请再次输入密码')
        if not pwd_inp ==re_ped_inp
            print('密码错误')
        else:
            print('密码正确')
            count += 1
            break
    

    猜年龄函数

    count = 0
    while count < 3
        age = 18
        age_inp_int = input('请输入年龄')
        if not age_inp_int < age :
            print9('猜小了')
            if not age_inp_int > age :
                print('猜大; ')
        else:
            print('正确')
            count += 1
            break
    

    选择奖品函数

    prize_dict={'0':"比蒂"
                '1':'psp''2':"手办"'3':"手机"}
    prize_choice = input('请选择;prize_dict')
    print('恭喜prize_choice')
    count = 0
    while count < 2
        print(f'奖品如下:{prize_dict}')
    prize_choice = input('请选择')
    print{f'prize_dict[prize_choicec}'}
    count += 1
    break
    
    
  • 相关阅读:
    朴素贝叶斯分类器实现
    Puppeteer使用
    神经网络常用名词
    Mysql binlog的基本使用和数据库恢复步骤
    webpack之代码分割及页面缓存优化
    webpack之常用loader的配置和使用
    webpack之常用plugin的配置和使用
    第11章 面向对象
    第10章 面向对象
    第9章 模块与包
  • 原文地址:https://www.cnblogs.com/yu521/p/11552285.html
Copyright © 2011-2022 走看看