day11作业

学生管理系统的界面

home_page = """
=======学生管理系统=======
    1.查看学生信息
    2.添加学生信息
    0.退出
========================
"""

student_info_page = """
========学生信息=========
%s
1. 查看
2. 添加
3. 删除
0. 返回
=======================
"""

change_stu_info = """
=======修改学生信息======


"""

add_student_page = """
=======添加学生==========
请输入学生信息

1. 保存
2. 返回
=======================
"""

students = []   #一个保存所有学生信息的列表

while True:
    print(home_page)    #启动程序时打印学生管理系统首页
    num1 = int(input())     #第一次选择输入num1
    if num1 == 1:
        if students == []:
            print(student_info_page % "暂无学生信息") #没有学生信息时打印默认画面
        else:
            print(student_info_page % students)     #有学生信息时打印
        num2 = int(input())     #第二次选择输入num2
        # if num2 == 1:         #查看某个学生的信息
        #     stu_name = input("请输入你要查看的学生的姓名:")
        #     if stu_name in students
        #     students['姓名'] = input()
        #     students['出生日期'] = input()
        #     students['籍贯'] = input()
        #     students['手机号码'] = input()
        #     students['学号'] = input()
        if num2 == 2:
            print(add_student_page)         #打印添加学生信息页面
            name = input("姓名:")
            birth = input("出生日期:")
            position = input("籍贯:")
            tel = input("手机号码:")
            stu_num = input("学号:")

            print("是否保存")
            save = input()         #输入是否保存
            if save == "是" or "yes":
                student = {"姓名": name, "出生日期": birth, \
                           "籍贯": position, "手机号码": tel, "学号": stu_num}
                students.append(student)
                print("保存成功")
                print("按0返回")
                save = input()
                if save == "0":
                    continue
            else:
                continue
        if num2 == 0:
            continue
    if num1 == 2:
        print(add_student_page)
        student['姓名'] = input("姓名:")
        student['出生日期'] = input("出生日期:")
        student['籍贯'] = input("籍贯:")
        student['手机号码'] = input("手机号码:")
        student['学号'] = input("学号:")
        print("是否保存")
        save = input()
        if save == "是" or "yes":
            student = {"姓名": name, "出生日期": birth, \
                       "籍贯": position, "手机号码": tel, "学号": stu_num}
            students.append(student)
            print("保存成功")
            print("按0返回")
            save = input()
            if save == "0":
                continue
        else:
            continue
    if num1 == 0:
        print("谢谢使用")
        break

你可能感兴趣的:(day11作业)