-
Notifications
You must be signed in to change notification settings - Fork 0
/
fiszki.py
36 lines (30 loc) · 908 Bytes
/
fiszki.py
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
34
35
36
import random
import csv
def create_dict(csv_file):
words = csv.reader(open(csv_file, 'r'))
words_dict = {}
for row in words:
k, v = row
words_dict[k] = v
return words_dict
def give_key():
choose_dict = input("Które słowa chcesz przećwiczyć?\nliczebniki / ogólne\n")
words = {}
if choose_dict == "ogólne":
words = create_dict('slowka.csv')
elif choose_dict == "liczebniki":
words = create_dict('liczebniki.csv')
while words:
key = random.choice(list(words))
print("\n" + key)
value = input()
while value != words[key]:
print("jeszcze raz? t/n")
response = input()
if response == "t":
value = input()
elif response == "n":
print(key + " = " + words[key])
break
else:
break