一个能帮助你背单词的程序,不喜勿喷!
废话不多说,直接放代码:{:10_256:}import random
word_list = ["nice","good","wow","cow","car","jar","mud","you","human","wine"] #可自行添加
mean_list = ["棒的","好的","表示吃惊","奶牛","车","坛子","泥土","你","人类","红酒"] #可自行添加
heavy = 10
heavy_list = #默认每个要背出的次数列表
now_heavy = 9
now_heavy_list = #每个已背出的次数列表
finish = == each]
finish = True if len(finish) == len(word_list) else False #只要结束的项与总共要结束的量相同,就代表全都结束了,就算结束了
while not finish: #如果没有结束背诵任务
i_list = random.sample(range(len(word_list)),len(word_list)) #不重复的随机抽选要提问的单词的先后顺序
for i in i_list:
ranswer = mean_list
guess = word_list
number1 = random.randint(0,len(mean_list) - 1)
number2 = random.randint(1,(len(mean_list) - (number1)))
button = ,mean_list]
button_list = random.sample(range(0,3),3)
button_dict = {i:button)] for i in zip(,["A","B","C"])}
for each in button_dict.items():
print(each,".",each)
answer = input(f"请选择单词 {guess} 的意思在上方选项中的最贴切的一项:")
while answer.isspace() or answer == "":
answer = input("请选择正确的一项:")
answer = answer.strip()
if button_dict.get(answer) == ranswer: #如果猜对
now_heavy_list += 1
print("答对了!")
else: #如果没猜对
heavy_list += 1
print("答错了!")
for i in range(70):
print(f"{'|':^156}")
print()
finish = == each]
finish = True if len(finish) == len(word_list) else False
print("你已成功记下了这些单词:{}!".format(",".join(word_list)))
这段代码还没有优化!{:10_266:} 所以我会在下一个版本中优化的!
制作不易,喜欢的话,就评个分吧!{:10_254:} {:10_297:} {:10_281:} {:10_298:}
最后,祝大家新年快乐,寒假作业不被老师检查......{:10_297:} {:5_108:} 这里面好多bug?为什么选项里面会有两个一模一样? shiyouroc 发表于 2022-2-9 17:54
这里面好多bug?为什么选项里面会有两个一模一样?
我知道,修改中 666 shiyouroc 发表于 2022-2-9 17:54
这里面好多bug?为什么选项里面会有两个一模一样?
没有好多吧?! python爱好者. 发表于 2022-2-9 18:12
没有好多吧?!
不算多。 shiyouroc 发表于 2022-2-9 18:30
不算多。
"不算"? —— 还有哪些 python爱好者. 发表于 2022-2-9 18:31
"不算"? —— 还有哪些
我编了一个差不多的,你可以看看还没编完。
#!/usr/bin/python
# Write Python 3 code in this online editor and run it.
# coding=utf-8
from random import randint
x = randint(0,5)
d=['good','eat','apple','happy',
'sad','you','me','our','banana',
'oranger','bear']
z={'good':'好的','eat':'吃',
'apple':'苹果','you':'你',
'happy':'开心','sad':'伤心',}
a=d
e=z
if x>=4:
i=x-1
lk=x-1
ii=randint(0,i)
kj=randint(0,lk)
while ii==kj:
ii=randint(0,i)
hh=int(ii)
kk=int(kj)
elif x>1:
s=x+1
l=x-1
ss=randint(s,5)
ll=randint(0,l)
hh=int(ss)
kk=int(ll)
else:
f=x+1
j=x+1
ff=randint(f,5)
jj=randint(j,5)
while ff==jj:
ff=randint(f,5)
hh=int(ff)
kk=int(jj)
{:5_95:} 666 你们都是大神,我只是一个小白{:10_247:}
页:
[1]