黄色网页视频 I 影音先锋日日狠狠久久 I 秋霞午夜毛片 I 秋霞一二三区 I 国产成人片无码视频 I 国产 精品 自在自线 I av免费观看网站 I 日本精品久久久久中文字幕5 I 91看视频 I 看全色黄大色黄女片18 I 精品不卡一区 I 亚洲最新精品 I 欧美 激情 在线 I 人妻少妇精品久久 I 国产99视频精品免费专区 I 欧美影院 I 欧美精品在欧美一区二区少妇 I av大片网站 I 国产精品黄色片 I 888久久 I 狠狠干最新 I 看看黄色一级片 I 黄色精品久久 I 三级av在线 I 69色综合 I 国产日韩欧美91 I 亚洲精品偷拍 I 激情小说亚洲图片 I 久久国产视频精品 I 国产综合精品一区二区三区 I 色婷婷国产 I 最新成人av在线 I 国产私拍精品 I 日韩成人影音 I 日日夜夜天天综合

python學(xué)生管理系統(tǒng)

系統(tǒng) 1944 0
            student = []


def print_menu():
    print("學(xué)生管理系統(tǒng)V2.0")
    print("=" * 30)
    print("1.添加學(xué)生基本信息")
    print("2.通過(guò)學(xué)號(hào)刪除學(xué)生信息")
    print("3.顯示全部學(xué)生信息")
    print("4.通過(guò)姓名查找學(xué)生的信息")
    print("5.通過(guò)學(xué)號(hào)修改學(xué)生信息")
    print("6.導(dǎo)出學(xué)生基本信息到指定路徑的文件中")
    print("7.查詢成績(jī)最高的學(xué)生基本信息")
    print("8.查詢成績(jī)最低的學(xué)生基本信息")
    print("9.根據(jù)學(xué)生綜合成績(jī)排序后顯示基本信息")
    print("10.根據(jù)輸入的綜合成績(jī),統(tǒng)計(jì)大于輸入成績(jī)的人數(shù)")
    print("11.計(jì)算當(dāng)前所有學(xué)生綜合成績(jī)的平均值")
    print("12.退出系統(tǒng)")
    print("=" * 30)

def add():
    xh = input("請(qǐng)輸入學(xué)生的學(xué)號(hào):")
    xm = input("請(qǐng)輸入學(xué)生姓名:")
    xb = input("請(qǐng)輸入學(xué)生性別:(男/女)")
    phone = input("請(qǐng)輸入學(xué)生的手機(jī)號(hào)碼:")
    score = input("請(qǐng)輸入學(xué)生的綜合成績(jī):")
    student_infos = {}
    student_infos["xuehao"] = xh
    student_infos["name"] = xm
    student_infos["sex"] = xb
    student_infos["phone"] = phone
    student_infos["score"] = score
    student.append(student_infos)
    print(student)





def del_info():
    stdId =input("請(qǐng)輸入需要?jiǎng)h除學(xué)生的學(xué)號(hào):")
    z = 0
    for temp in student:
            if stdId == temp['xuehao']:
                    indexxuehao = student.index(temp)
                    z = 1
                    break
            else:
                    continue
    if z ==1:
            fina = input ("確認(rèn)是否刪除?(yes or no):")
            if fina == "yes":
                del student[indexxuehao]
                print("恭喜您已成功刪除該新學(xué)生了!")
            else:
                print("您放棄刪除該學(xué)生信息了!")
    else:
            print("很抱歉,系統(tǒng)不存在該學(xué)生信息!")

def display():
    print("*" * 30)
    print("學(xué)生的信息如下:")
    print("*" * 30)
    print("序號(hào)    學(xué)號(hào)    姓名    性別   手機(jī)號(hào)碼    綜合成績(jī)")
    i = 1
    for temp in student:
        print("%d      %s      %s      %s     %s      %s" % (
            i, temp["xuehao"], temp["name"], temp["sex"], temp["phone"], temp["score"]))
        i += 1






def find():
    while True:
        name = input("請(qǐng)輸入要查找的學(xué)生姓名")
        for temp in student:
            if temp['name'] == name:
                print("找到此學(xué)生,信息如下:")
                print("學(xué)號(hào):%s  姓名:%s  性別:%s  手機(jī)號(hào)碼:%s  綜合成績(jī):%s  " % (
                    temp["xuehao"], temp["name"], temp["sex"], temp["phone"], temp["score"]))
                break
            else:
                print("沒(méi)有這個(gè)學(xué)生")

def change():
    print("您選擇了修改學(xué)生信息功能")
    gai = input("請(qǐng)輸入你要修改學(xué)生的學(xué)號(hào):")
    i = 0
    ii = 0
    for temp in student:
        if temp["xuehao"] == gai:
            ii = 1
            break
        else:
            i = i + 1
    if ii == 1:
        while True:
            xiaocaidan = int(input(" 1.修改學(xué)號(hào)\n 2.修改姓名 \n 3.修改性別 \n 4.修改手機(jī)號(hào)碼 \n 5.修改綜合成績(jī) \n 6.退出修改 \n"))
            if xiaocaidan == 1:
                aaa = input("輸入更改后的學(xué)號(hào):")
                # 修改后的學(xué)號(hào)要驗(yàn)證是否唯一
                i = 0
                ii1 = 0
                for temp1 in student:
                    if temp1["xuehao"] == aaa:
                        ii1 = 1
                        break
                    else:
                        i = i + 1
                if ii1 == 1:
                    print("輸入學(xué)號(hào)不可重復(fù),修改失敗!")
                else:
                    temp["xuehao"] = aaa
                    print("學(xué)號(hào)已修改")
            elif xiaocaidan == 2:
                bbb = input("輸入新的姓名:")
                temp["name"] = bbb
                print("姓名已修改")
            elif xiaocaidan == 3:
                ccc = input("輸入新的性別(男/女):")
                temp["sex"] = ccc
                print("性別已修改")
            elif xiaocaidan == 4:
                ddd = input("輸入新的手機(jī)號(hào)碼:")
                temp["phone"] = ddd
                print("手機(jī)號(hào)碼已修改")
            elif xiaocaidan == 5:
                eee = input("輸入新的成績(jī):")
                temp["score"] = eee
                print("綜合成績(jī)已修改")
            elif xiaocaidan == 6:
                break
            else:
                print("輸入錯(cuò)誤請(qǐng)重新輸入")
    else:
        print("學(xué)號(hào)輸入錯(cuò)誤,修改失敗!")


def baocun():
    file = open("xueshengxinxi.txt", "w")
    file.write(str(student))
    file.write('\n')
    file.close()


def findmax():
    studentone = []
    for temp in student:  # 遍歷字典的成績(jī)
        studentone.append(temp["score"])  # 將遍歷的成績(jī)加入空列表
        studentone.sort(reverse=True)  # 將列表的值從大到小排序
        n = studentone[0]
    i = 0
    j = 0
    for temp in student:
        if temp["score"] == n:
            j = 1
            break
        else:
            i = i + 1
    if j == 0:
        print("沒(méi)有此學(xué)生,查詢失敗!")
    else:
        print("找到此學(xué)生,信息如下:")
        print("學(xué)號(hào):%s  姓名:%s  性別:%s  手機(jī)號(hào)碼:%s  綜合成績(jī):%s" % (
            temp["xuehao"], temp["name"], temp["sex"], temp["phone"], temp["score"]))


def findmin():
    studenttwo = []
    for temp in student:  # 遍歷字典的成績(jī)
        studenttwo.append(temp["score"])  # 將遍歷的成績(jī)加入空列表
        studenttwo.sort()  # 將列表的值從小到大排序
        n = studenttwo[0]
    i = 0
    j = 0
    for temp in student:
        if temp["score"] == n:
            j = 1
            break
        else:
            i = i + 1
    if j == 0:
        print("沒(méi)有此學(xué)生,查詢失敗!")
    else:
        print("找到此學(xué)生,信息如下:")
        print("學(xué)號(hào):%s  姓名:%s  性別:%s  手機(jī)號(hào)碼:%s  綜合成績(jī):%s  " % (
            temp["xuehao"], temp["name"], temp["sex"], temp["phone"], temp["score"]))


def paixu():
    print("從高到低成績(jī)排序:")
    print("序號(hào)    學(xué)號(hào)    姓名    性別   手機(jī)號(hào)碼    綜合成績(jī)")
    studentthree = []
    for temp in student:  # 遍歷字典的成績(jī)
        studentthree.append(temp["score"])  # 將遍歷的成績(jī)加入空列表
        studentthree.sort(reverse=True)  # 將列表的值從大到小排序
    for n in studentthree:
        i = 0
        j = 0
        for temp in student:
            if temp["score"] == n:
                j = 1
                break
            else:
                i = i + 1
        if j == 0:
            print("沒(méi)有此學(xué)生,查詢失敗!")
        else:
            print("%d      %s      %s      %s     %s      %s" % (
                i, temp["xuehao"], temp["name"], temp["sex"], temp["phone"], temp["score"]))


def count():
    studentfour = []
    studentfive = []
    for temp in student:  # 遍歷字典的成績(jī)
        studentfour.append(temp["score"])  # 將遍歷的成績(jī)加入空列表
    a = input("請(qǐng)輸入需要統(tǒng)計(jì)人數(shù)的成績(jī)線(大于該成績(jī)的人數(shù)):")
    i = 0
    for temp in studentfour:
        if temp[i] >= a:
            studentfive.append(temp[i])
        else:
            pass
        i += 1
    print("大于該成績(jī)的人數(shù)有:%s" % (len(studentfive)))


def average():
    studentsix = []
    for temp in student:  # 遍歷字典的成績(jī)
        studentsix.append(temp["score"])  # 將遍歷的成績(jī)加入空列表
        studentsix = [int(x) for x in studentsix]
        tt = sum(studentsix)
        pingjun = tt / len(studentsix)
        print(pingjun)


def quit():
    while True:
        d = input("確定退出嗎?(Yes or No):")
        if d == "Yes":
            break
        else:
            print("輸入有誤,請(qǐng)重新輸入")


def last():
    while True:
        print_menu()
        key = input("請(qǐng)輸入功能對(duì)應(yīng)的數(shù)字:")
        if key == "1":
            add()
        elif key == "2":
            del_info()
        elif key == "3":
            display()
        elif key == "4":
            find()
        elif key == "5":
            change()
        elif key == "6":
            baocun()
        elif key == "7":
            findmax()
        elif key == "8":
            findmin()
        elif key == "9":
            paixu()
        elif key == "10":
            count()
        elif key == "11":
            average()
        elif key == "12":
            quit()

last()


          

更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論