Skip to content
flashcard
class Flashcard:
def __init__(self, word, meaning):
self.word = word
self.meaning = meaning
def __str__(self):
# we will return a string
return self.word + ' ( ' + self.meaning + ' )'
flash = []
print("Welcome to flashcard application")
# the following loop will be repeated until
# user stops to add the flashcards
while True:
word = input("Enter the name you want to add to flashcard: ")
meaning = input("Enter the meaning of the word: ")
flash.append(Flashcard(word, meaning))
option = input("Enter 0 if you want to add another flashcard, or any other key to stop: ")
if option != '0':
break
# printing all the flashcards
print("\nYour flashcards")
for i in flash:
print(">", i)