# 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 )
print 'Try to guess what is the translation of' , r, '?\n '
m = raw_input ( 'Guess\n ' )
if m in dictEnWrd[ r] :
print 'Congratulations!'
else :
print 'Fail! Try again'
print 'さよなら!'
raw_input ( '\n \n P' )
IyBlbmNvZGluZzogdXRmLTgKCiNyZWF0aW5nIGRpY3Rpb25hcnkKI2lmIDAgLSBxdWl0CiNpZiB0ZXJtaW5wdXQgLSB0cm5zbGF0ZQojeW91IGNhbiByZWFhc2lnbiB2YWx1ZSB0byBhIGtleQojeW91IGNhbiBhZGQgbmV3IGtleQojeW91IGNhbiBkZWxldGUga2V5CgpwcmludCAnJycK44GE44KJ44Gj44GX44KE44GEIQowIC0gRXhpdAoxIC0gRW50ZXIgeW91ciBFbmdsaXNoIHdvcmQgdG8gZ2V0IEphcGFuZXNlIGVxdWl2YWxlbnQKMiAtIEVudGVyIHlvdXIgSmFwYW5lc2Ugd29yZCB0byBnZXQgRW5nbGlzaCBlcXVpdmFsZW50CjMgLSBBZGQgbmV3IEphcGFuZXNlIHdvcmQgdG8gZGljdGlvbmFyeSBhbmQgc2V0IGl0J3MgPGJvdGggd2F5cz4gdHJhbnNsYXRpb24KNCAtIEFkZCBFbmdsaXNoIHdvcmQgdG8gZGljdGlvbmFyeSBhbmQgc2V0IGl0J3MgPGJvdGggd2F5cz4gdHJhbnNsYXRpb24KNSAtIERlbGV0ZSB3b3JkcyBmcm9tIGRpY3Rpb25hcnkKNiAtIFBsYXkgZ2FtZQonJycKZGljdEVuQWxwaCA9IHsnc28nOifjgZ0nLCAnd28nOifjgpInLCAnbm8nOifjga4nLCAndG8nOifjgagnLCAna28nOifjgZMnLCAncm8nOifjgo0nLCAnaG8nOifjgbsnLCAnbW8nOifjgoInLCAneW8nOifjgognLCAnbyc6J+OBiicsICdhJzon44GCJywgJ2thJzon44GLJywgJ3RhJzon44GfJywgJ3NhJzon44GVJywgJ21hJzon44G+JywgJ25hJzon44GqJywgJ2hhJzon44GvJywgJ3lhJzon44KEJywgJ3dhJzon44KPJywgJ3JhJzon44KJJywgJ24nOifjgpMnLCAnZSc6J+OBiCcsICdrZSc6J+OBkScsICdzZSc6J+OBmycsICd0ZSc6J+OBpicsICduZSc6J+OBrScsICdyZSc6J+OCjCcsICdoZSc6J+OBuCcsICdtZSc6J+OCgScsICdpJzon44GEJywgJ2tpJzon44GNJywgJ2hpJzon44GyJywgJ25pJzon44GrJywgJ21pJzon44G/JywgJ3NoaSc6J+OBlycsICdjaGknOifjgaEnLCAncmknOifjg6onLCAndSc6J+OBhicsICdudSc6J+OBrCcsICdrdSc6J+OBjycsICdmdSc6J+OBtScsICd0c3UnOifjgaQnLCAneXUnOifjgoYnLCAnbXUnOifjgoAnLCAnc3UnOifjgZknLCAncnUnOifjgosnLCAnd2UnOifjgpEnLCAnd2knOifjgpAnfQpkaWN0SnBBbHBoID0ge3Y6IGsgZm9yIGssIHYgaW4gZGljdEVuQWxwaC5pdGVtcygpfQpkaWN0RW5XcmQgPSB7J3BpY3R1cmUnOifjgYgnLCAnaG91c2UnOign44GE44GIJywgJ+OBhuOBoScpLCAneWVzJzon44GI44GIJywgJ25vJzon44GE44GE44GIJywgJ21ldGFsIGJ1Y2tldCc6J+OBi+OBkycsICdraWQnOifjgZMnLCAndm9pY2UnOifjgZPjgYgnLCAnZW5nbGlzaCc6J+OBiOOBhOOBlCcsICdtb3ZpZSc6J+OBiOOBhOOBi+OCnCcsICd0cmVlJzon44GNJywgJ3N0dWRlbnQnOifjgYzjgY/jgZvjgYQnLCAndW5pdmVyc2l0eSc6J+OBoOOBhOOBjOOBjycsICdtaXN0ZXInOifjgYvjgZ8nLCAnZW5naW5lZXInOifjgY7jgZcnLCAnY2hhaXInOifjgYTjgZknLCAnd2hlbic6J+OBhOOBpCcsICdzdWNoJzon44Gd44GGJywgJ2hvdyc6J+OBqeOBhicsICdwbGVhc2UnOifjganjgYbjgZ4nLCAndGFibGUnOifjgaTjgY/jgYgnLCAnaG91c2UnOifjgYbjgaEnLCAnbW9ybmluZyc6J+OBguOBlScsICdtYW4nOifjgbLjgagnLCAneW91IChmYW1pbGlhciknOifjgYLjgarjgZ8nLCAnaGUobWlzd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