美文网首页
day8 作业

day8 作业

作者: 13147abc | 来源:发表于2018-10-10 11:37 被阅读0次

学生成绩管理系统

print('************************************************************')
print('                    欢迎来到学生管理系统                     ')
stu_name1 = []
stu_age1 = []
stu_tel1 = []
while True:
    print('1.添加学生                                                  ')
    print('2.查找学生                                                  ')
    print('3.删除学生                                                  ')
    print('9.退出系统                                                  ')
    print('************************************************************')

    num1 = int(input('>>>'))
    if num1 == 1:
        stu_name = input('请输入学生姓名:')
        stu_name1.append(stu_name)
        stu_age = input('请输入学生年龄:')
        stu_age1.append(stu_age)
        stu_tel = input('请输入学生电话:')
        stu_tel1.append(stu_tel)

        print('1.继续添加')
        print('2.返回上一层')
        num2 = int(input('>>>'))
        if num2 == 1:
            while True:
                stu_name = input('请输入学生姓名:')
                stu_name1.append(stu_name)
                stu_age = input('请输入学生年龄:')
                stu_age1.append(stu_age)
                stu_tel = input('请输入学生电话:')
                stu_tel1.append(stu_tel)
                print('1.继续添加')
                print('2.返回上一层')
                num3 = int(input('>>>'))
                if num3 == 1:
                    continue
                else:
                    break
        elif num2 == 2:
            continue

    if num1 == 2:
        print('1.查看所有学生信息')
        print('2.根据名字查找学生信息')
        print('3.返回上一层')
        num3 = int(input('>>>'))
        if num3 == 1:
            print('名字:%s\n 年龄:%s\n 电话:%s\n'%(stu_name1,stu_age1,stu_tel1))
            continue
        elif num3 == 2:
            stu_find = input('请输入你要查找的名字')
            if stu_find in stu_name1:
                stu_place = stu_name1.index(stu_find)
                name1 = stu_name1[stu_place]
                age1 = stu_age1[stu_place]
                tel1 = stu_tel1[stu_place]
                print('%s\n年龄:%s\n 电话是:%s\n'%(name1,age1,tel1))
            else:
                print('查无此人')
            continue
        elif num3 == 3:
            continue

    if num1 == 3:
        stu_del = input('要删除的学生姓名:')
        if stu_del in stu_name1:
            stu_name1.remove(stu_del)
            print('成功删除')
            print('1.继续删除')
            print('2.返回上一层')
            num3 = int(input('>>>'))
            if num3 == 1:
                while True:
                    stu_del = input('要删除的学生姓名:')
                    if stu_del in stu_name1:
                        stu_name1.remove(stu_del)
                        print('成功删除')
                        print('1.继续删除')
                        print('2.返回上一层')
                        num3 = int(input('>>>'))
                        if num3 == 1:
                            continue
                        else:
                            break
            elif num3 == 2:
                continue
        else:
            print('没有您要删除的学生')

    if num1 == 9:
        break


相关文章

网友评论

      本文标题:day8 作业

      本文链接:https://www.haomeiwen.com/subject/xmnuaftx.html