-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlashcards.py
More file actions
31 lines (22 loc) · 740 Bytes
/
Copy pathFlashcards.py
File metadata and controls
31 lines (22 loc) · 740 Bytes
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
class Flashcard:
def __init__(self,word,definition):
self.word = word
self.definition = definition
def __str__(self):
return f"Word: {self.word}\nDefinition: {self.definition}"
def create_flashcards():
flashcards = []
while True:
word = input("Enter the word (or type 'exit' to stop):")
if word.lower() == 'exit':
break
definition = input(f"Enter the definition of '{word}'")
flashcard = Flashcard(word,definition)
flashcards.append(flashcard)
print("\n Here are all your flashcards: ")
index = 0
while index < len(flashcards):
print(flashcards[index])
print("-"* 50)
index += 1
create_flashcards()