中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何使用Python編寫一個刷題練習系統

發布時間:2023-05-18 16:25:47 來源:億速云 閱讀:153 作者:iii 欄目:編程語言

這篇文章主要介紹“如何使用Python編寫一個刷題練習系統”,在日常操作中,相信很多人在如何使用Python編寫一個刷題練習系統問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”如何使用Python編寫一個刷題練習系統”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!

實現效果

如何使用Python編寫一個刷題練習系統

實現代碼

選擇題
def xuanze():
    global flag2
    if flag2==1:
        def insert():
            num=var1.get()
            question=var2.get()
            choice=var3.get()
            answer=var4.get()
            with open('d:\\練習系統\\練習三3.1.pickle','rb') as file:
                lst1=pickle.load(file)
            with open('d:\\練習系統\\練習三3.2.pickle','rb') as file:
                lst2=pickle.load(file)
            with open('d:\\練習系統\\練習三3.3.pickle','rb') as file:
                lst3=pickle.load(file)
            with open('d:\\練習系統\\練習三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:\\練習系統\\練習三3.1.pickle','wb') as file:
                pickle.dump(lst1,file)
                file.close()
            with open('d:\\練習系統\\練習三3.2.pickle','wb') as file:
                pickle.dump(lst2,file)
                file.close()
            with open('d:\\練習系統\\練習三3.3.pickle','wb') as file:
                pickle.dump(lst3,file)
                file.close()
            with open('d:\\練習系統\\練習三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:\\練習系統\\練習三3.1.pickle','rb') as file:
                lst1=pickle.load(file)
            with open('d:\\練習系統\\練習三3.2.pickle','rb') as file:
                lst2=pickle.load(file)
            with open('d:\\練習系統\\練習三3.3.pickle','rb') as file:
                lst3=pickle.load(file)
            with open('d:\\練習系統\\練習三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:\\練習系統\\練習三3.1.pickle','wb') as file:
                pickle.dump(lst1,file)
                file.close()
            with open('d:\\練習系統\\練習三3.2.pickle','wb') as file:
                pickle.dump(lst2,file)
                file.close()
            with open('d:\\練習系統\\練習三3.3.pickle','wb') as file:
                pickle.dump(lst3,file)
                file.close()
            with open('d:\\練習系統\\練習三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:\\練習系統\\練習一1.1.pickle','rb') as file:
                lst1=pickle.load(file)
            with open('d:\\練習系統\\練習一1.2.pickle','rb') as file:
                lst2=pickle.load(file)
            with open('d:\\練習系統\\練習一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:\\練習系統\\練習一1.1.pickle','wb') as file:
                pickle.dump(lst1,file)
                file.close()
            with open('d:\\練習系統\\練習一1.2.pickle','wb') as file:
                pickle.dump(lst2,file)
                file.close()
            with open('d:\\練習系統\\練習一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:\\練習系統\\練習一1.1.pickle','rb') as file:
                lst1=pickle.load(file)
            with open('d:\\練習系統\\練習一1.2.pickle','rb') as file:
                lst2=pickle.load(file)
            with open('d:\\練習系統\\練習一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:\\練習系統\\練習一1.1.pickle','wb') as file:
                pickle.dump(lst1,file)
                file.close()
            with open('d:\\練習系統\\練習一1.2.pickle','wb') as file:
                pickle.dump(lst2,file)
                file.close()
            with open('d:\\練習系統\\練習一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:\\練習系統\\練習二2.1.pickle','rb') as file:
                lst1=pickle.load(file)
            with open('d:\\練習系統\\練習二2.2.pickle','rb') as file:
                lst2=pickle.load(file)
            with open('d:\\練習系統\\練習二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:\\練習系統\\練習二2.1.pickle','wb') as file:
                pickle.dump(lst1,file)
                file.close()
            with open('d:\\練習系統\\練習二2.2.pickle','wb') as file:
                pickle.dump(lst2,file)
                file.close()
            with open('d:\\練習系統\\練習二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:\\練習系統\\練習二2.1.pickle','rb') as file:
                lst1=pickle.load(file)
            with open('d:\\練習系統\\練習二2.2.pickle','rb') as file:
                lst2=pickle.load(file)
            with open('d:\\練習系統\\練習二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:\\練習系統\\練習二2.1.pickle','wb') as file:
                pickle.dump(lst1,file)
                file.close()
            with open('d:\\練習系統\\練習二2.2.pickle','wb') as file:
                pickle.dump(lst2,file)
                file.close()
            with open('d:\\練習系統\\練習二2.3.pickle','wb') as file:
                pickle.dump(lst3,file)
                file.close()

到此,關于“如何使用Python編寫一個刷題練習系統”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

白河县| 新泰市| 凭祥市| 新源县| 长春市| 博客| 双柏县| 乡城县| 海阳市| 招远市| 育儿| 滨海县| 哈尔滨市| 晴隆县| 潜山县| 南川市| 岳普湖县| 克东县| 祁东县| 香格里拉县| 东台市| 禹州市| 合川市| 九龙县| 清涧县| 姚安县| 鄂州市| 武胜县| 大埔县| 周口市| 穆棱市| 陵水| 武隆县| 滁州市| 库尔勒市| 盈江县| 永安市| 昭苏县| 壤塘县| 右玉县| 海南省|