标题基本概括了所有内容。以下是我编写的一个小型日语学习游戏的准系统。如果它尚未在当前循环中打印,我只需要打印假名。谁能看到我做错了什么?谢谢 :)
#!/usr/bin/python
from os import system as cmd
from random import choice as random
from time import sleep
from sys import platform
m = ["ma", "mi", "mu", "me", "mo"]
y = ["ya", "yu", "yo"]
n = ["n"]
def get_dict(group):
if group == 1:
return m
elif group == 13:
return y
elif group == 14:
return n
elif group == 15:
return m + y + n
def clear():
if "win" in platform: cmd("cls")
if "lin" in platform: cmd("clear")
def get_kana():
global kana
return random(kana)
## Initiate ##
kana = get_dict(15)
speed = speed()
clear()
print disp
print "Please get ready!..."
sleep(5)
def chk_used():
global used_kana
numlpo = 0
while numlpo < 50:
numlpo = numlpo + 1
kana = get_kana()
if kana not in used_kana:
used_kana = used_kana.append(kana)
return kana
break
def main():
used_kana = []
while True:
clear()
print disp
print "Please write the following kana: \n"
print " " + chk_used()
sleep(3)
main()