奋斗资源网-python文字学生管理系统

实现原理

  1. 首先需要统计学生数量 0 因为刚开始一个学生也没用所以为0.
  2. 创建一个元组把学生全部存进去 初始化= list=[ ]
  3. 让用户自定义输入输出学生名称!
  4. 删除之类不多说了,看我在奋斗资源网写的代码理解吧!
'''奋斗资源网-小黄鸭管理系统'''
import os
def Author_information(): #开始定义小黄鸭作者信息类
    Author_name='小黄鸭'
    Author_QQ=725433548
    print('作者:{} \n QQ:{}'.format(Author_name,Author_QQ))
    return Author_name and Author_QQ
Author_information() #结束小黄鸭信息展示
def Student_system(): #定义小黄鸭信息存储
    count = 0  # 统计学生数量
    print('欢迎使用小黄鸭学生管理系统')
    General_list=[] #初始化所有学生名单
    while True:
        Student_list = str(input('请输入你要增加的学生名字:')) #自定义学生名
        if Student_list==Student_list and Student_list!='删除' and Student_list!='清空列表' and Student_list!='写文件' and Student_list!='高级字典':
            Student_list_two = General_list.append(Student_list)
            count=count+1 #学生数量 增加 1
            for i in General_list:
                print('当前学生列表有:{},总学生数量:{}'.format(i,count))
        elif Student_list=='删除':
            for shanchu in General_list:
                delte_input=str(input('请输入你要删除的学生:'))
                if delte_input==General_list:
                    delte=General_list.remove(shanchu)
                    count=count-1 #学生数量- 1
                    print('你成功删除了{}学生,当前学生数量:{}'.format(delte,count))
        elif Student_list=='清空列表':
            clear_Student=General_list.clear()
            count=0
            print('已经清空所有列表{},当前学生数量:{}'.format(clear_Student,count))
        elif Student_list=='写文件':
            Desktop_route_input=str(input('请输入自定义路径:'))
            Desktop_route=os.chdir(Desktop_route_input)
            Desktop_open_input=str(input('请输入你要保存的文档名:'))
            Desktop_open_w=open(Desktop_open_input,'w')
            Desktop_open_w.write(str(General_list))
            print('保存成功')
            Desktop_open_w.close()
        elif Student_list=='高级字典':
            Dictionaries_input_one=str(input('请输入合格或者不合格:'))
            Dictionaries_input_two= str(input('请输入合格或者不合格学生名字:'))
            Dictionaries_list_one={Dictionaries_input_one}
            Dictionaries_list_two={Dictionaries_input_two}
            Dictionary_collection=dict(zip(Dictionaries_list_one,Dictionaries_list_two))
            print(Dictionary_collection)
Student_system()

 

原文地址:https://fendou.gqr5.cn/4162.html
------本页内容已结束,喜欢请分享------

感谢您的来访,获取更多精彩文章请收藏本站。

THE END
喜欢就打个赏呗
点赞2 分享
评论 共1条

请登录后发表评论