Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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(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.
- while count > 0:
- questions = question_list[count]
- ans = input(questions + "\n> ")
- answers = answer_list[count]
- if ans == answers:
- print("Well done!")
- else:
- print("HA! You suck.")
- count -= 1
- quiz1(flashcards)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement