zoukankan      html  css  js  c++  java
  • 大爽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
    
  • 相关阅读:
    1.3 Starting a New Job 1.3.3 Background Reading(I)
    1.3 Starting a New Job 1.3.1 Preparation
    1.2 Interview 1.2.4 Sample Test(IV)
    1.2 Interview 1.2.4 Sample Test(III)
    Jquery获取元素集合并遍历
    Oracle21c RAC+DG生产项目实战(RHEL8+Oracle集群+容灾+CDB/PDB)
    Django
    Linux 实用命令
    Python人工智能:原理、实践及应用-资料分享
    关于HDFS的NameNode和SecondaryNameNode的一些疑问解答
  • 原文地址:https://www.cnblogs.com/BigShuang/p/15594537.html
Copyright © 2011-2022 走看看