# 首先建立一个空字典 students = {} students2 = [] # 添加功能 def add(): """ 添加学员信息 :return: None """ while True: name = input('请输入学员的姓名:') age = input('请输入学员的年龄:') sex = input('请输入学员的性别:') while sex != '男' and sex != '女': sex = input('请正确输入学员性别(男/女):') phone = input('请输入学员的手机号:') # 将信息组装成一个字典 students = { 'name': name, 'age': age, 'sex': sex, 'phone': phone} students2.append(students) print('添加成功!') is_next = input('回车继续添加,输入q结束:') if is_next =='q': break # 修改功能 def modify(): """ 修改学员信息 :return: None """ if len(students2) == 0: print('* 没有学员信息,请稍后修改 *') return
python学生管理系统3.0版本
最新推荐文章于 2024-05-28 21:38:25 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)