python模拟背单词问题求助

 

import random
values = ['ancient', 'application', 'ash', 'avenue', 'adventure']  # 把4级单词表读入为列表
score = 0
while True:
    print(random.choice(values)) 
    n = int(input('1:认识,2:不认识:,-1:退出'))
    if n == -1:
        break
    elif n == 1:
        score += 1
    else:
        pass
print(score)

 

import random
import turtle as t

WORDS = {"easy":"简单", "difficult":"困难", "answer":"答案"}

iscontinue="y"
while iscontinue=="y" or iscontinue=="Y":
      
      
      print(
"""
                          欢迎使用BillChen单词速背系统 
             英译汉请输入Y    汉译英请输入N   添加单词请按L
             模拟练习请按T    结束程序请按W   开发详情请按任意键
"""
)
      F=input()
      if F=='N'or F=='n':
                        new_WORDS = {v : k for k, v in WORDS.items()}
                        n=input("请输入需要查询的单词或词语:")
                        if n in new_WORDS:
                              print(new_WORDS[n])
                        else:
                              print('暂未收录,敬请期待')
                        iscontinue=input("\n\n是否继续(Y/N):")      
      elif F=='Y'or F=='y':
                        n=input("请输入需要查询的单词或词语:")
                        if n in WORDS:
                              print(WORDS[n])
                        else:
                              print('暂未收录,敬请期待')
                        iscontinue=input("\n\n是否继续(Y/N):")
      elif F=='L'or F=='l':
                        new_value=input('请输入一个新的单词的释义:')
                        new_key=input('请输入这个新单词:')
                        WORDS[new_key]= new_value
                        print(WORDS)
      elif F=='T'or F=='t':
                        i=0
                        z=0
                        while  i<5:
                             
                              key=random.choice(list(WORDS))
                              right_key=WORDS[key]
                              print(key)
                              user_key=input("请输入这个单词的释义:")
                              if user_key == right_key:
                                    print('恭喜您,此题答对了')
                                    
                                    z=z+1
                                    
                                    
                              else:
                                    print('很遗憾,此题打错了,再接再厉哦')
                                    print('正确答案是:{}'.format(right_key))
                                    '''
                                       2021/2/7根据树扇风吹云起的提议增添答错时会输出正确答案
                                    '''

                                    
                              i=i+1
                              
                        print('恭喜您,本次模拟结束,本次您的正确率为:{:.2%}'.format(z/5))
      elif F=='W'or F=='w':
                        print("程序已经退出,欢迎您的下次使用")
                        iscontinue="n"
      else:
            t.setup(1800,800,0,0)
            t.bgcolor('pink')
            t.color('red')
            t.shape('turtle')
            t.speed(5)
            t.begin_fill()
            t.up()
            t.goto(-120,100)
            t.down()
            for i in range(5):
                    t.forward(240)
                    t.right(144)
            t.end_fill()
            t.penup()
            t.goto(200,100)
            t.pendown
            t.color('black')
            t.write('开发人员:BillChen',font=("Arial" , 34 , "normal"))
            t.right(90)
            t.fd(100)
            t.color('red')
            t.write('♥',font=("Arial" , 34 , "italic"))
            t.left(90)
            t.fd(50)
            t.color('black')
            t.write('学号:201805050118',font=("Arial" , 34 , "italic"))
            t.right(90)
            t.fd(100)
            t.write('班级:18计科本1班',font=("Arial" , 34 , "bold"))
            t.right(90)
            t.fd(500)
            t.write('考试必过',font=("Arial" , 34 , "bold"))
            t.right(90)
            t.fd(300)
            t.write('单词速背系统',font=("Arial" , 34 , "bold"))
            t.hideturtle()
            t.exitonclick()



                             
                        
                        

 

您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632