SHARE
TWEET

Untitled

a guest Dec 10th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2. import random as rnd
  3. import pickle
  4.  
  5. Dictionary = {}
  6. if not os.path.exists('gg.pickle'):
  7.     c = 'y'
  8.     while c == 'y':
  9.         eng = input('Enter English word: ')
  10.         rus = input('Enter Russian word: ')
  11.         Dictionary[rus] = eng
  12.         c = input('One more (y or n): ')
  13.     with open('gg.pickle', 'wb') as f:
  14.         pickle.dump(Dictionary, f)
  15. with open('gg.pickle', 'rb') as f:
  16.     Dictionary = pickle.load(f)
  17. try:
  18.     while bool(Dictionary):
  19.         ru_word = rnd.choice(list(Dictionary.keys()))
  20.         inp = input('Translate this: ' + ru_word+'\n')
  21.         if inp =='/q':
  22.             raise KeyboardInterrupt
  23.         if inp == Dictionary[ru_word]:
  24.             del Dictionary[ru_word]
  25.             print('Succesful')
  26.     print('Your English is very Well!\n')
  27. except KeyboardInterrupt:
  28.     print('Okey :(')
  29. with open('gg.pickle', 'rb') as f:
  30.     Dictionary = pickle.load(f)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top