I'm new to Python, and of course the first program I make seems to be riddled with bugs. If anyone can tell me what I've done wrong, I would greatly appreciate it. Here is my code:
Code:
print 'Welcome to FlashCards.\n'
usrinput = '' # Defining some variables - this one is for user input
number = 1 # This one has multiple uses
terms = [] # This is a list that will contain the frontside of the "flashcards"
ansrs = [] # This list will contain the backside of the "flashcards"
while usrinput != "Go to answers.": # This loop prompts the user to input the frontside of the "flashcards" until they input 'Go to answers.'
usrinput = raw_input("Please enter term %s or type 'Go to answers.'\
to start typing in the answers.", number)
number = number + 1
terms.append(usrinput) # Put the user's input into the terms list.
s = ', '.join(terms) # Join the parts of the terms list into one string.
print 'The terms are so far: %s', s # Print how many terms the user has inputed
# using the string just created.
number = 1 # Reset the number variable when the loop ends.
while usrinput != "Test me!": # Keep prompting the user for the flipside of the "flashcards" until they say 'Test me!'.
usrinput = raw_input("Please enter answer %s or type 'Test me!' to \
start testing yourself.", number)
number = number + 1 # With every loop, this number increases.
ansrs.append(usrinput) # Put the user's input into the ansrs list.
number = 0 # Reset the number variable
while number <= len(terms) # Prompt the user for the flipsides of the "flashcards."
usrinput = raw_input(terms[number])
if usrinput == ansrs[number] # The user input what they think is the answer. Rinse and repeat until they go through all the terms.
print "Correct!"
number = number + 1
else
print "Incorrect."
print "You finished!" # Obviously tells the user they finished.
# The program is buggy and incomplete, currently only allowing the user
# to go through the cars once. After they have, they have to reenter all
# the cards and their reverse sides again. It also never checks to see
# the user entered the same amount of terms as answers. It's supposed to be a simple (based on what I've learned so far) flashcards game.