[ create a new paste ] login | about

Link: http://codepad.org/swtN8mV3    [ raw code | fork ]

Python, pasted on Nov 16:
flashcards = ["not False:True", "not True:False", "True or False:True",
	"True or True:True", "False or True:True", "False or False:False",
	"True and False:False", "True and True:True", "False and True:False",
	"False and False:False", "not (True or False):False", "not (True or True):False",
	"not (False or True):False", "not (False or False):True",
	"1 != 0:True", "1 != 1:False", "0 != 1:True", "0 != 0:False",
	"1 == 0:False", "1 == 1:True", "0 == 1:False", "0 == 0:True"]
	
from random import shuffle
	
def splitcards(flashcards):
	shuffle(flashcards)
	question_list = []
	answer_list = []
	for x in flashcards:
		statement, answer = x.split(':')
		question_list.append(statement)
		answer_list.append(answer)
	return question_list, answer_list
				
def quiz1(flashcards):
	count = int(raw_input("How many questions would you like? \n>"))
	print "Please answer 'True' or 'False'"
	question_list, answer_list = splitcards(flashcards)
	randq = 1
#since I'm already shuffling the list, I decided to just use the count for the list position.
	questions = question_list[count]
	answers = answer_list[count]
	while count > 0:
		ans = raw_input(questions + "\n> ")
		if ans == answers:
			print "Well done!"
		else:
			print "HA! You suck."
		count -= 1

	
quiz1(flashcards)


Create a new paste based on this one


Comments: