fork download
  1. # encoding: utf-8
  2.  
  3. #reating dictionary
  4. #if 0 - quit
  5. #if terminput - trnslate
  6. #you can reaasign value to a key
  7. #you can add new key
  8. #you can delete key
  9.  
  10. print '''
  11. いらつしやい!
  12. 0 - Exit
  13. 1 - Enter your English word to get Japanese equivalent
  14. 2 - Enter your Japanese word to get English equivalent
  15. 3 - Add new Japanese word to dictionary and set it's translation
  16. 4 - Change definition of Japanese word in the dictionary
  17. 5 - Delete words from dictionary
  18. '''
  19. slogodictionary = {'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':'う'}
  20.  
  21. t = None
  22. t1 = None
  23. t2 = None
  24. t22 = None
  25. slogodictionary1 = None
  26. inv_map = {v: k for k, v in slogodictionary.items()}
  27. print inv_map
  28. print len(inv_map)
  29. list1 = slogodictionary.keys()
  30. list2 = slogodictionary.values()
  31. print list1
  32. #for v in list2:
  33. # print v
  34. dict2 = {}
  35. x = 0
  36. #print len(slogodictionary.values())
  37. while True:
  38. if x < len(slogodictionary.values()):
  39. term = list2[x]
  40. value = list1[x]
  41. dict2[term] = value
  42. x += 1
  43. print len(dict2)
  44.  
  45. if x == len(slogodictionary.values()):
  46. break
  47.  
  48. #while True:
  49. # if t != 0:
  50. # t = int(raw_input('Enter your choice of action between 0 and 5\n'))
  51. # if t == 1:
  52. # t1 = raw_input('Enter your English word here\n')
  53. # if t1 in slogodictionary:
  54. # print slogodictionary[t1]
  55. # if t == 3:
  56. # t2 = raw_input('Enter you Japanese word with Hiragana symbols\n')
  57. # t22 = raw_input('Enter the translation value of this Hiragana word\n')
  58. # if t2 not in slogodictionary:
  59. # slogodictionary[t2] = t22
  60. # print t2, 'and', slogodictionary[t2], 'has been updated!'
  61. #
  62.  
  63.  
  64. print 'さよなら!'
  65.  
  66.  
  67. raw_input('\n\nP')
  68.  
  69.  
  70.  
Runtime error #stdin #stdout #stderr 0.01s 8976KB
stdin
Standard input is empty
stdout
いらつしやい!
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 translation
4 - Change definition of Japanese word in the dictionary
5 - Delete words from dictionary

{'\xe3\x81\xbb': 'ho', '\xe3\x82\x82': 'mo', '\xe3\x82\x81': 'me', '\xe3\x81\xbf': 'mi', '\xe3\x81\xbe': 'ma', '\xe3\x82\x84': 'ya', '\xe3\x81\xb2': 'hi', '\xe3\x82\x88': 'yo', '\xe3\x82\x89': 'ra', '\xe3\x82\x8f': 'wa', '\xe3\x82\x8c': 're', '\xe3\x82\x8d': 'ro', '\xe3\x81\xab': 'ni', '\xe3\x81\xaa': 'na', '\xe3\x81\xb8': 'he', '\xe3\x81\xaf': 'ha', '\xe3\x81\xae': 'no', '\xe3\x81\xad': 'ne', '\xe3\x83\xaa': 'ri', '\xe3\x81\xa1': 'sa', '\xe3\x81\xa6': 'te', '\xe3\x81\x9b': 'se', '\xe3\x81\x9f': 'ta', '\xe3\x81\x9d': 'so', '\xe3\x81\x93': 'ko', '\xe3\x81\x91': 'ke', '\xe3\x81\x97': 'shi', '\xe3\x81\x8b': 'ka', '\xe3\x81\x8a': 'o', '\xe3\x81\x88': 'e', '\xe3\x81\x8d': 'ki', '\xe3\x81\x82': 'a', '\xe3\x81\x86': 'u', '\xe3\x81\x84': 'i', '\xe3\x82\x92': 'wo', '\xe3\x82\x93': 'n', '\xe3\x81\xa8': 'to'}
37
['me', 'u', 'yo', 'wo', 'mi', 'ra', 'hi', 'ho', 're', 'e', 'ha', 'ri', 'he', 'a', 'ni', 'ka', 'te', 'ma', 'wa', 'ke', 'no', 'i', 'na', 'mo', 'ko', 'ne', 'o', 'n', 'to', 'so', 'ya', 'chi', 'shi', 'sa', 'ro', 'ki', 'se', 'ta']
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
33
34
35
36
37
さよなら!


P
stderr
Traceback (most recent call last):
  File "prog.py", line 67, in <module>
EOFError: EOF when reading a line