# encoding: utf-8
#reating dictionary
#if 0 - quit
#if terminput - trnslate
#you can reaasign value to a key
#you can add new key
#you can delete key
print '''
いらっしやい!
0 - Exit
1 - Enter your English word to get Japanese equivalent
2 - Enter your Japanese word to get English equivalent
3 - Add new Japanese word to dictionary and set it's <both ways> translation
4 - Add English word to dictionary and set it's <both ways> translation
5 - Delete words from dictionary
6 - Play game
'''
dictEnAlph = { 'so' :'そ' , 'wo' :'を' , 'no' :'の' , 'to' :'と' , 'ko' :'こ' , 'ro' :'ろ' , 'ho' :'ほ' , 'mo' :'も' , 'yo' :'よ' , 'o' :'お' , 'a' :'あ' , 'ka' :'か' , 'ta' :'た' , 'sa' :'さ' , 'ma' :'ま' , 'na' :'な' , 'ha' :'は' , 'ya' :'や' , 'wa' :'わ' , 'ra' :'ら' , 'n' :'ん' , 'e' :'え' , 'ke' :'け' , 'se' :'せ' , 'te' :'て' , 'ne' :'ね' , 're' :'れ' , 'he' :'へ' , 'me' :'め' , 'i' :'い' , 'ki' :'き' , 'hi' :'ひ' , 'ni' :'に' , 'mi' :'み' , 'shi' :'し' , 'chi' :'ち' , 'ri' :'リ' , 'u' :'う' , 'nu' :'ぬ' , 'ku' :'く' , 'fu' :'ふ' , 'tsu' :'つ' , 'yu' :'ゆ' , 'mu' :'む' , 'su' :'す' , 'ru' :'る' , 'we' :'ゑ' , 'wi' :'ゐ' }
dictJpAlph = { v: k for k, v in dictEnAlph.items ( ) }
dictEnWrd = { 'picture' :'え' , 'house' :( 'いえ' , 'うち' ) , 'yes' :'ええ' , 'no' :'いいえ' , 'metal bucket' :'かこ' , 'kid' :'こ' , 'voice' :'こえ' , 'english' :'えいご' , 'movie' :'えいか゜' , 'tree' :'き' , 'student' :'がくせい' , 'university' :'だいがく' , 'mister' :'かた' , 'engineer' :'ぎし' , 'chair' :'いす' , 'when' :'いつ' , 'such' :'そう' , 'how' :'どう' , 'please' :'どうぞ' , 'table' :'つくえ' , 'house' :'うち' , 'morning' :'あさ' , 'man' :'ひと' , 'you (familiar)' :'あなた' , 'he(mister)' :'あなかた' , 'he' :'あのひと' , 'dog' :'いぬ' , 'wall' :'かべ' , 'flower' :'はな' , 'box' :'はこ' , 'magazine' :'ざっし' , 'map' :'ちず' , 'cat' :'ねこ' , 'brush' :'ふど' }
dictJpWrd = { v: k for k, v in dictEnWrd.items ( ) }
import random
t = None
t1 = None
t3 = None
t33 = None
t2 = None
t22 = None
t4 = None
t44 = None
#print inv_map
#print len(inv_map)
#list1 = slogodictionary.keys()
#list2 = slogodictionary.values()
#print list1
#for v in list2:
# print v
#dict2 = {}
#x = 0
#print len(slogodictionary.values())
#while True:
# if x < len(slogodictionary.values()):
# term = list2[x]
# value = list1[x]
# dict2[term] = value
# x += 1
# print len(dict2)
#
# if x == len(slogodictionary.values()):
# break
#dict2
while True :
if t != 0 :
t = int ( raw_input ( 'Enter your choice of action between 0 and 6\n ' ) )
if t == 1 :
t1 = raw_input ( 'Enter your English word here to see Japanese translation\n ' )
if t1 in dictEnAlph:
print dictEnAlph[ t1]
elif t1 in dictEnWrd:
print dictEnWrd[ t1]
if t == 2 :
t3 = raw_input ( 'Enter your Japanese word here to see English translation\n ' )
if t3 in dictJpAlph:
print dictJpAlph[ t3]
elif t3 in dictJpWrd:
print dictJpWrd[ t3]
if t == 3 :
t2 = raw_input ( 'Enter your Japanese word with Hiragana symbols\n ' )
t22 = raw_input ( 'Enter the translation value of this Hiragana word\n ' )
if t2 not in dictJpWrd:
dictJpWrd[ t2] = t22
dictEnWrd[ t22] = t2
print t2, 'and' , dictJpWrd, dictEnWrd, 'has been updated!'
if t == 4 :
t4 = raw_input ( 'Enter your English word' )
t44 = raw_input ( 'Enter its Japanese translation' )
if t4 not in dictEnWrd:
dictEnWrd[ t4] = t44
dictJpWrd[ t44] = t4
if t == 6 :
#r = random.choice([dictEnWrd.keys()])
r = random .sample ( dictEnWrd, 1 )
n = r[ 0 ]
print 'Try to guess what is the translation of' , r, '?\n '
m = raw_input ( 'Guess\n ' )
if m == dictEnWrd[ n] :
print 'Congratulations!'
else :
print 'Fail! Try again'
print 'さよなら!'
raw_input ( '\n \n P' )
IyBlbmNvZGluZzogdXRmLTgKIAojcmVhdGluZyBkaWN0aW9uYXJ5CiNpZiAwIC0gcXVpdAojaWYgdGVybWlucHV0IC0gdHJuc2xhdGUKI3lvdSBjYW4gcmVhYXNpZ24gdmFsdWUgdG8gYSBrZXkKI3lvdSBjYW4gYWRkIG5ldyBrZXkKI3lvdSBjYW4gZGVsZXRlIGtleQogCnByaW50ICcnJwrjgYTjgonjgaPjgZfjgoTjgYQhCjAgLSBFeGl0CjEgLSBFbnRlciB5b3VyIEVuZ2xpc2ggd29yZCB0byBnZXQgSmFwYW5lc2UgZXF1aXZhbGVudAoyIC0gRW50ZXIgeW91ciBKYXBhbmVzZSB3b3JkIHRvIGdldCBFbmdsaXNoIGVxdWl2YWxlbnQKMyAtIEFkZCBuZXcgSmFwYW5lc2Ugd29yZCB0byBkaWN0aW9uYXJ5IGFuZCBzZXQgaXQncyA8Ym90aCB3YXlzPiB0cmFuc2xhdGlvbgo0IC0gQWRkIEVuZ2xpc2ggd29yZCB0byBkaWN0aW9uYXJ5IGFuZCBzZXQgaXQncyA8Ym90aCB3YXlzPiB0cmFuc2xhdGlvbgo1IC0gRGVsZXRlIHdvcmRzIGZyb20gZGljdGlvbmFyeQo2IC0gUGxheSBnYW1lCicnJwpkaWN0RW5BbHBoID0geydzbyc6J+OBnScsICd3byc6J+OCkicsICdubyc6J+OBricsICd0byc6J+OBqCcsICdrbyc6J+OBkycsICdybyc6J+OCjScsICdobyc6J+OBuycsICdtbyc6J+OCgicsICd5byc6J+OCiCcsICdvJzon44GKJywgJ2EnOifjgYInLCAna2EnOifjgYsnLCAndGEnOifjgZ8nLCAnc2EnOifjgZUnLCAnbWEnOifjgb4nLCAnbmEnOifjgaonLCAnaGEnOifjga8nLCAneWEnOifjgoQnLCAnd2EnOifjgo8nLCAncmEnOifjgoknLCAnbic6J+OCkycsICdlJzon44GIJywgJ2tlJzon44GRJywgJ3NlJzon44GbJywgJ3RlJzon44GmJywgJ25lJzon44GtJywgJ3JlJzon44KMJywgJ2hlJzon44G4JywgJ21lJzon44KBJywgJ2knOifjgYQnLCAna2knOifjgY0nLCAnaGknOifjgbInLCAnbmknOifjgasnLCAnbWknOifjgb8nLCAnc2hpJzon44GXJywgJ2NoaSc6J+OBoScsICdyaSc6J+ODqicsICd1Jzon44GGJywgJ251Jzon44GsJywgJ2t1Jzon44GPJywgJ2Z1Jzon44G1JywgJ3RzdSc6J+OBpCcsICd5dSc6J+OChicsICdtdSc6J+OCgCcsICdzdSc6J+OBmScsICdydSc6J+OCiycsICd3ZSc6J+OCkScsICd3aSc6J+OCkCd9CmRpY3RKcEFscGggPSB7djogayBmb3IgaywgdiBpbiBkaWN0RW5BbHBoLml0ZW1zKCl9CmRpY3RFbldyZCA9IHsncGljdHVyZSc6J+OBiCcsICdob3VzZSc6KCfjgYTjgYgnLCAn44GG44GhJyksICd5ZXMnOifjgYjjgYgnLCAnbm8nOifjgYTjgYTjgYgnLCAnbWV0YWwgYnVja2V0Jzon44GL44GTJywgJ2tpZCc6J+OBkycsICd2b2ljZSc6J+OBk+OBiCcsICdlbmdsaXNoJzon44GI44GE44GUJywgJ21vdmllJzon44GI44GE44GL44KcJywgJ3RyZWUnOifjgY0nLCAnc3R1ZGVudCc6J+OBjOOBj+OBm+OBhCcsICd1bml2ZXJzaXR5Jzon44Gg44GE44GM44GPJywgJ21pc3Rlcic6J+OBi+OBnycsICdlbmdpbmVlcic6J+OBjuOBlycsICdjaGFpcic6J+OBhOOBmScsICd3aGVuJzon44GE44GkJywgJ3N1Y2gnOifjgZ3jgYYnLCAnaG93Jzon44Gp44GGJywgJ3BsZWFzZSc6J+OBqeOBhuOBnicsICd0YWJsZSc6J+OBpOOBj+OBiCcsICdob3VzZSc6J+OBhuOBoScsICdtb3JuaW5nJzon44GC44GVJywgJ21hbic6J+OBsuOBqCcsICd5b3UgKGZhbWlsaWFyKSc6J+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