1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        用Python寫了一個(gè)背單詞的小程序

        共 2895字,需瀏覽 6分鐘

         ·

        2021-03-04 17:46

        來源:https://s.yam.com/463yR


        英語差就閑來無事用python寫了一個(gè)背單詞的小程序,英語不好的博友們可以參考參考,哈哈~~~

        程序代碼:


        import random as t#創(chuàng)建單詞序列words=("easy","difficult","answer","continue")zi=("容易","困難","回答","繼續(xù)")hanzi={ "easy":"容易", "difficult":"困難","answer":"回答", "continue":"繼續(xù)","blue":"藍(lán)色"}yin={"容易":"easy","困難":"difficult","回答":"answer","繼續(xù)":"continue","藍(lán)色":"blue"}def jiemian():    print("""                     歡迎來到背單詞        根據(jù)English回答漢語或者根據(jù)漢語回答English        -------------------------------------------                    1.English——>漢語                                        2.漢語——>English                                        3.單詞列表                                        4.退出系統(tǒng)""")#######Zhang######  English——>漢語   ################################    def yyihan():     n=0    m=0    su=0    iscontinue="y"    while iscontinue=="y" or iscontinue=="Y":        word=t.choice(words)        print("隨機(jī)生成在單詞:")        print(">------>   "+word)        guess=input("\n輸入漢語: ").strip()# 防止用戶誤操作錄入空白        while guess!=hanzi[word]:            print("對(duì)不起,不正確。")            n=n+1            print('\n——>正確率:%.2f'%(m/(n+m)))            guess=input("繼續(xù)輸入:").strip()        if guess==hanzi[word]:             print("真棒!答對(duì)了?。?)             m=m+1             print('\n——>正確率:%.2f'%(m/(n+m)))        iscontinue=input("\nn\是否繼續(xù)(Y/N):")        ###############  漢語——>English   #########wei####################
        def hanyiy(): n=0; m=0; su=0; iscontinue="y" while iscontinue=="y" or iscontinue=="Y": hz=t.choice(zi) print("隨機(jī)生成在漢語:") print(">------> "+hz) guess=input("\n輸入Ehglish: ").strip() while guess!=yin[hz]: print("對(duì)不起,不正確。") n=n+1 print('\n——>正確率:%.2f'%(m/(n+m))) guess=input("繼續(xù)輸入:").strip() if guess==yin[hz]: print("真棒!答對(duì)了?。?) m=m+1 print('\n——>正確率:%.2f'%(m/(n+m))) iscontinue=input("\nn\是否繼續(xù)(Y/N):")
        ####bu##########################################################
        def lib(): print("************************") print("\n") for i in range (len(words)): print(words[i]," ",zi[i],"\n") print("\n") print("************************") a=input("輸入 1 背誦單詞結(jié)束——>: ")

        ################################################################### while True: jiemian() a=int(input("\n\n\n\選擇需要進(jìn)行的操作(1、2、3、4):")) if(a==1): yyihan() elif a==2: hanyiy() elif a==3: lib() elif a==4: exit() else: print("輸入格式錯(cuò)誤,重新輸入??!")    


        PS:如果覺得我的分享不錯(cuò),歡迎大家隨手點(diǎn)贊、在看。


        (完)

        回復(fù)關(guān)鍵字“簡(jiǎn)明python ”,立即獲取入門必備書籍簡(jiǎn)明python教程》電子版

        回復(fù)關(guān)鍵字爬蟲”,立即獲取爬蟲學(xué)習(xí)資料

        python入門與進(jìn)階
        每天與你一起成長(zhǎng)

        推薦閱讀

        瀏覽 95
        點(diǎn)贊
        評(píng)論
        收藏
        分享

        手機(jī)掃一掃分享

        分享
        舉報(bào)
        評(píng)論
        圖片
        表情
        推薦
        點(diǎn)贊
        評(píng)論
        收藏
        分享

        手機(jī)掃一掃分享

        分享
        舉報(bào)
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            亚洲中文字幕在线播放视频 | 国产精品自拍网站 | 亚洲 无码 在线 播放 | 亚洲中文字幕在线观看免费视频 | 日本XXXX毛少妇高清HD | 日本青草色第一页 | 日韩美女性猛交 | 精产国品少妇在线视频 | 亚洲精品福利网站 | 被夫上司蹂躏的七日乃葵 |