Skip to content

Instantly share code, notes, and snippets.

@kelvintaywl
Last active December 17, 2015 14:59
Show Gist options
  • Save kelvintaywl/5628241 to your computer and use it in GitHub Desktop.
Save kelvintaywl/5628241 to your computer and use it in GitHub Desktop.
A quick 'flashcard' script I wrote in less than an hour to test my knowledge of the Japanese Hiragana characters learnt so far. Feel free to use this in whatever way you like, especially if you have also just started learning Japanese as well :)
#!/usr/bin/python
# -*- coding: utf-8 -*-
# hiragana flashcards by Kelvin Tay [[email protected]]
import random
hira = [['-a', u'あ'],['-i', u'い'],['-u', u'う'],['-e', u'え'],['-o', u'お'],
['ka', u'か'],['ki', u'き'],['ku', u'く'],['ke', u'け'],['ko', u'こ'],
['sa', u'さ'],['shi', u'し'],['su', u'す'],['se', u'せ'],['so', u'そ'],
['ta', u'た'],['chi', u'ち'],['tsu', u'つ'],['te', u'て'],['to', u'と'],
['na', u'な'],['ni', u'に'],['nu', u'ぬ'],['ne', u'ね'],['no', u'の'],
['ha', u'は'],['hi', u'ひ'],['hu', u'ふ'],['he', u'へ'],['ho', u'ほ'],
['ma', u'ま'],['mi', u'み'],['mu', u'む'],['me', u'め'],['mo', u'も'],
['ya', u'や'],['yu', u'ゆ'],['yo', u'よ'],
['ra', u'ら'],['ri', u'り'],['ru', u'る'],['re', u'れ'],['ro', u'ろ'],
['wa', u'わ'],['wo', u'を'],['n', u'ん'],
['ga', u'が'],['gi', u'ぎ'],['gu', u'ぐ'],['ge', u'げ'],['go', u'ご'],
['za', u'ざ'],['ji/zi', u'じ'],['zu', u'ず'],['ze', u'ぜ'],['zo', u'ぞ'],
['da', u'だ'],['ji/di', u'ぢ'],['zu/du', u'づ'],['de', u'で'],['do', u'ど'],
['ba', u'ば'],['bi', u'び'],['bu', u'ぶ'],['be', u'べ'],['bo', u'ぼ'],
['pa', u'ぱ'],['pi', u'ぴ'],['pu', u'ぷ'],['pe', u'ぺ'],['po', u'ぽ']
]
count = 1
print "WELCOME TO HIRAGANA FLASHo CARDo\nversion 1.0 updated 22.05.2013 by kelvin tay ([email protected])\n\nthere are %d flashcards today.\n" % (len(hira))
while len(hira) >= 1:
ran = random.randint(0, len(hira)-1)
num = hira.pop(ran)
if num:
print 'Q' + str(count) + ': ' + num[0]
count = count + 1
raw_input('Press <ENTER> to see its Hiragana > ')
print num[1]
raw_input('\n------------------------------------------ Press <ENTER> for NEXT > ')
print "Yay! DONE."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment