• 大爽Python入门教程 56 实践练习 功能添加


    大爽Python入门公开课教案 点击查看教程总目录

    需求简介

    在上一节:
    控制台版本——简易成绩管理系统
    的基础上
    添加一个新的功能:
    新增学生分数。

    详细介绍

    英文版本

    新增一个命令c用于新建学生分数。
    对应主菜单中,多展示这个命令

    - c: create student score
    

    玩家输入c
    提醒玩家输入学生姓名

    Enter new student's name:
    

    玩家输入名字后,去除名字首尾空格。
    然后检查名字是否已存在,已存在则提醒玩家重新输入。

    The name already exists and cannot be created.
    

    名字不存在则提醒玩家输入成绩

    Enter new student's score:
    

    成绩为不小于0,不大于100的整数。
    (输入不符合规范则提醒Invalid Input.,并再次让用户输入)

    输入符合,则提醒新增成功

    Successfully added student scores.
    

    对应中文

    菜单新增

    - c: 新建学生
    

    输入名字

    请输入新增学生姓名(or 'r' for return):
    

    名字已存在

    名字已存在,无法创建。
    

    输入分数

    请输入新增学生分数:
    

    新增成功

    成功新增学生分数。
    

    运行效果

    英文版本

    ---------------
    Welcome!
    You can enter `c`, `f`, `u`, `l` or `e`.
    The meaning is as follows
    - c: create student score
    - f: filter student by a score
    - u: update score
    - l: show all student with scores
    - e: exit
    Enter your command: c
    Enter new student's name: Zhouxin
    Enter new student's score: 88
    Successfully added student scores.
    ---------------
    Welcome!
    You can enter `c`, `f`, `u`, `l` or `e`.
    The meaning is as follows
    - c: create student score
    - f: filter student by a score
    - u: update score
    - l: show all student with scores
    - e: exit
    Enter your command: l
    Students Scores:
    Smith          : 84
    Anderson       : 91
    Clark          : 75
    ZhangSan       : 82
    Allen          : 90
    Green          : 91
    Lee            : 85
    Scott          : 71
    Martin         : 65
    Wang           : 91
    Taylor         : 88
    Zhouxin        : 88
    ---------------
    Welcome!
    You can enter `c`, `f`, `u`, `l` or `e`.
    The meaning is as follows
    - c: create student score
    - f: filter student by a score
    - u: update score
    - l: show all student with scores
    - e: exit
    Enter your command: e
    Bye
    
  • 相关阅读:
    [USACO07JAN]平衡的阵容Balanced Lineup
    洛谷 P4389 付公主的背包 解题报告
    多项式Ⅱ
    半平面交 板子
    Problem C Dist 解题报告
    二维凸包的板子
    洛谷 P4841 城市规划 解题报告
    广二模拟赛 Problem A: 青春野狼不做理性小魔女的梦 解题报告
    CF 997E 解题报告
    洛谷 P4244 [SHOI2008]仙人掌图 II 解题报告
  • 原文地址:https://www.cnblogs.com/BigShuang/p/15594537.html
Copyright © 2020-2023  润新知