最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

基于Python編寫一個(gè)刷題練習(xí)系統(tǒng)

 更新時(shí)間:2023年02月21日 09:16:41   作者:Want595  
這篇文章主要為大家詳細(xì)介紹了如何基于Python語(yǔ)言編寫一個(gè)簡(jiǎn)單的刷題練習(xí)系統(tǒng),文中的示例代碼講解詳細(xì),感興趣的小伙伴可以了解一下

用python給自己做個(gè)練習(xí)系統(tǒng)刷題吧!

實(shí)現(xiàn)效果

實(shí)現(xiàn)代碼

選擇題

def xuanze():
    global flag2
    if flag2==1:
        def insert():
            num=var1.get()
            question=var2.get()
            choice=var3.get()
            answer=var4.get()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.1.pickle','rb') as file:
                lst1=pickle.load(file)
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.2.pickle','rb') as file:
                lst2=pickle.load(file)
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.3.pickle','rb') as file:
                lst3=pickle.load(file)
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.4.pickle','rb') as file:
                lst4=pickle.load(file)
            if num not in lst1:
                lst1.append(num)
                lst2.append(question)
                lst3.append(choice)
                lst4.append(answer)
                var5.set('錄入成功')
            else:
                var5.set('錄入失敗')
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.1.pickle','wb') as file:
                pickle.dump(lst1,file)
                file.close()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.2.pickle','wb') as file:
                pickle.dump(lst2,file)
                file.close()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.3.pickle','wb') as file:
                pickle.dump(lst3,file)
                file.close()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.4.pickle','wb') as file:
                pickle.dump(lst4,file)
                file.close()
        def delete():
            num=var1.get()
            question=var2.get()
            choice=var3.get()
            answer=var4.get()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.1.pickle','rb') as file:
                lst1=pickle.load(file)
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.2.pickle','rb') as file:
                lst2=pickle.load(file)
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.3.pickle','rb') as file:
                lst3=pickle.load(file)
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.4.pickle','rb') as file:
                lst4=pickle.load(file)
            if num in lst1:
                t=lst1.index(num)
                lst1.pop(t)
                lst2.pop(t)
                lst3.pop(t)
                lst4.pop(t)
                var5.set('刪除成功')
            else:
                var5.set('刪除失敗')
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.1.pickle','wb') as file:
                pickle.dump(lst1,file)
                file.close()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.2.pickle','wb') as file:
                pickle.dump(lst2,file)
                file.close()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.3.pickle','wb') as file:
                pickle.dump(lst3,file)
                file.close()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)三3.4.pickle','wb') as file:
                pickle.dump(lst4,file)
                file.close()

填空題

def tiankong():
    global flag2
    if flag2==1:
        def insert():
            num=var1.get()
            question=var2.get()
            answer=var3.get()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)一1.1.pickle','rb') as file:
                lst1=pickle.load(file)
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)一1.2.pickle','rb') as file:
                lst2=pickle.load(file)
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)一1.3.pickle','rb') as file:
                lst3=pickle.load(file)
            if num not in lst1:
                lst1.append(num)
                lst2.append(question)
                lst3.append(answer)
                var4.set('錄入成功')
            else:
                var4.set('錄入失敗')
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)一1.1.pickle','wb') as file:
                pickle.dump(lst1,file)
                file.close()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)一1.2.pickle','wb') as file:
                pickle.dump(lst2,file)
                file.close()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)一1.3.pickle','wb') as file:
                pickle.dump(lst3,file)
                file.close()
        def delete():
            num=var1.get()
            question=var2.get()
            answer=var3.get()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)一1.1.pickle','rb') as file:
                lst1=pickle.load(file)
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)一1.2.pickle','rb') as file:
                lst2=pickle.load(file)
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)一1.3.pickle','rb') as file:
                lst3=pickle.load(file)
            if num in lst1:
                t=lst1.index(num)
                lst1.pop(t)
                lst2.pop(t)
                lst3.pop(t)
                var4.set('刪除成功')
            else:
                var4.set('刪除失敗')
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)一1.1.pickle','wb') as file:
                pickle.dump(lst1,file)
                file.close()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)一1.2.pickle','wb') as file:
                pickle.dump(lst2,file)
                file.close()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)一1.3.pickle','wb') as file:
                pickle.dump(lst3,file)
                file.close()

判斷題

def panduan():
    global flag2
    if flag2==1:
        def insert():
            num=var1.get()
            question=var2.get()
            answer=var3.get()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)二2.1.pickle','rb') as file:
                lst1=pickle.load(file)
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)二2.2.pickle','rb') as file:
                lst2=pickle.load(file)
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)二2.3.pickle','rb') as file:
                lst3=pickle.load(file)
            if num not in lst1:
                lst1.append(num)
                lst2.append(question)
                lst3.append(answer)
                var4.set('錄入成功')
            else:
                var4.set('錄入失敗')
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)二2.1.pickle','wb') as file:
                pickle.dump(lst1,file)
                file.close()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)二2.2.pickle','wb') as file:
                pickle.dump(lst2,file)
                file.close()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)二2.3.pickle','wb') as file:
                pickle.dump(lst3,file)
                file.close()
        def delete():
            num=var1.get()
            question=var2.get()
            answer=var3.get()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)二2.1.pickle','rb') as file:
                lst1=pickle.load(file)
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)二2.2.pickle','rb') as file:
                lst2=pickle.load(file)
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)二2.3.pickle','rb') as file:
                lst3=pickle.load(file)
            if num in lst1:
                t=lst1.index(num)
                lst1.pop(t)
                lst2.pop(t)
                lst3.pop(t)
                var4.set('刪除成功')
            else:
                var4.set('刪除失敗')
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)二2.1.pickle','wb') as file:
                pickle.dump(lst1,file)
                file.close()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)二2.2.pickle','wb') as file:
                pickle.dump(lst2,file)
                file.close()
            with open('d:\\練習(xí)系統(tǒng)\\練習(xí)二2.3.pickle','wb') as file:
                pickle.dump(lst3,file)
                file.close()

到此這篇關(guān)于基于Python編寫一個(gè)刷題練習(xí)系統(tǒng)的文章就介紹到這了,更多相關(guān)Python刷題練習(xí)系統(tǒng)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • python多進(jìn)程間通信代碼實(shí)例

    python多進(jìn)程間通信代碼實(shí)例

    這篇文章主要介紹了python多進(jìn)程間通信代碼實(shí)例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-09-09
  • python安裝pil庫(kù)方法及代碼

    python安裝pil庫(kù)方法及代碼

    在本篇內(nèi)容里我們給大家分享的是關(guān)于python安裝pil庫(kù)方法及代碼內(nèi)容,有此需要的朋友們可以參考下。
    2019-06-06
  • keras輸出預(yù)測(cè)值和真實(shí)值方式

    keras輸出預(yù)測(cè)值和真實(shí)值方式

    這篇文章主要介紹了keras輸出預(yù)測(cè)值和真實(shí)值方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-06-06
  • 詳解Python中Pytest和Unittest的區(qū)別

    詳解Python中Pytest和Unittest的區(qū)別

    Pytest?和?Unittest是Python中屬于最常用的兩個(gè)測(cè)試框架。那么他們有些什么區(qū)別呢??Playwright?為什么只給了Pytest的深度支持,而不是Unittest呢?本文就來(lái)和大家詳細(xì)聊聊
    2023-03-03
  • python3 selenium自動(dòng)化測(cè)試 強(qiáng)大的CSS定位方法

    python3 selenium自動(dòng)化測(cè)試 強(qiáng)大的CSS定位方法

    今天小編就為大家分享一篇python3 selenium自動(dòng)化測(cè)試 強(qiáng)大的CSS定位方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2019-08-08
  • 如何通過(guò)Python3和ssl實(shí)現(xiàn)加密通信功能

    如何通過(guò)Python3和ssl實(shí)現(xiàn)加密通信功能

    這篇文章主要介紹了如何通過(guò)Python3和ssl實(shí)現(xiàn)加密通信功能,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-05-05
  • python模擬Django框架實(shí)例

    python模擬Django框架實(shí)例

    這篇文章主要為大家詳細(xì)介紹了python模擬Django框架實(shí)例,了解一個(gè)web框架需要的基本功能,感興趣的小伙伴們可以參考一下
    2016-05-05
  • 解決安裝Python的第三方庫(kù)pandas報(bào)錯(cuò)問題

    解決安裝Python的第三方庫(kù)pandas報(bào)錯(cuò)問題

    這篇文章主要介紹了解決安裝Python的第三方庫(kù)pandas報(bào)錯(cuò)問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-08-08
  • Python爬蟲爬取糗事百科段子實(shí)例分享

    Python爬蟲爬取糗事百科段子實(shí)例分享

    在本篇文章里小編給大家整理了關(guān)于Python爬蟲爬取糗事百科段子實(shí)例內(nèi)容,需要的朋友們可以參考下。
    2020-07-07
  • Python中列表list常用方法總結(jié)

    Python中列表list常用方法總結(jié)

    在?Python?中,列表(List)是一種有序的數(shù)據(jù)集合,可以存儲(chǔ)任意類型的數(shù)據(jù)。本文主要幫大家總結(jié)了一下列表list的常用方法,需要的可以參考一下
    2023-05-05

最新評(píng)論

固始县| 南雄市| 娱乐| 慈溪市| 九龙县| 天津市| 彭水| 莫力| 宜城市| 绥滨县| 遂昌县| 芜湖县| 金沙县| 云林县| 荣成市| 静海县| 如东县| 左权县| 汾西县| 台中市| 习水县| 滦平县| SHOW| 南宁市| 昌吉市| 轮台县| 贞丰县| 濮阳县| 湖口县| 白山市| 萨迦县| 栖霞市| 尼勒克县| 开江县| 嘉祥县| 沾化县| 高州市| 武宁县| 建水县| 十堰市| 北宁市|