Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # encoding: utf8
- from random import choice
- class DictList(object):
- dictionary = [
- 'Nóż',
- 'Kaczka',
- 'Mepel',
- 'Krzesło',
- 'Pudło',
- 'Książka',
- 'Wieża',
- 'Laptop',
- 'Łóżko',
- 'Stół',
- 'Szafa',
- 'Dywan',
- 'Ryza papieru',
- 'Dom',
- 'Herbata',
- 'Jabłko',
- 'Mikrofon',
- 'Lampa',
- 'Głośniki',
- 'Butelka',
- 'Klawiatura',
- 'Plecak',
- 'Niebo',
- 'Łyżka',
- 'Kaloryfer',
- 'Telewizor',
- 'Steropian',
- 'Szczur',
- 'Zdjęcie',
- 'Mapa',
- 'Żelazko',
- 'Karimata',
- 'Budzik',
- 'Długopis',
- 'Zegarek',
- 'biurko',
- 'okno',
- 'anioł',
- 'wiadro',
- 'obraz',
- ]
- def __init__(self):
- self.deck = list(range(len(self.dictionary)))
- def all(self):
- while len(self.deck):
- number = choice(self.deck)
- self.deck.remove(number)
- yield (number + 1, self.dictionary[number])
- def run():
- print('Przeprowadzamy test')
- dictionary = DictList()
- for number, name in dictionary.all():
- print('\nPodaj słowo dla %d (pozostało %d)' % (number, len(dictionary.deck)))
- inputed = input('--> ').strip().lower()
- name = name.lower()
- if inputed == name:
- print('Dobrze!')
- else:
- print('Źle, powinno być "%s"!' % (name,))
- if __name__ == '__main__':
- run()
Advertisement
Add Comment
Please, Sign In to add comment