大爽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

相关文章:

  • 2021-08-10
  • 2022-02-23
  • 2021-06-23
  • 2022-01-14
  • 2021-09-14
  • 2021-06-05
  • 2022-01-04
  • 2021-08-12
猜你喜欢
  • 2021-08-01
  • 2021-06-10
  • 2021-07-16
  • 2021-10-10
  • 2021-12-04
  • 2021-11-15
  • 2021-08-28
相关资源
相似解决方案