I am not quite done with my code yet, but I need help with my true/false question maker so that it can set user inputted questions as either true or false. Then when the program is executed with def take_quiz(self): method, the user will have to put in 't' or 'f' as true or false respectively.
I plan to have to have a database named questlist to store the questions and an answerbase to store 't' or 'f' respectively to the question base.
This is the code I got down so far, and I would appreciate any help with adding on to it.
class Quiz:
#start of quiz
def __init__(self):
#self.short_quiz
print("Welcome to 5 true or false questions quiz maker.")
questlist = []
#asks the user to input 5 questions with either true or false.
def set_question(self):
count = 1
print("Please input 5 true or false questions, type 't' for true and 'f' for false.")
while count <= 5:
quest = str(input("Please enter question " + str(count )+ ": " ))
trufal = str(input("Is question " + str(count) + " true or false? "))
while trufal is not ("t") or ("f"):
#repeats if user did not input either 't' or 'f'
count += 1
#When executed, the program will ask the true/false questions the user inputed in set_questions
# def take_quiz(self):
#gives back the user their score once completed
#percentage = ((score/5)* 100)
#score = str(score)
#percentage = str(percentage)
#print ("Your score is " + score + " out of 5 and " + percentage + "%". )
user = Quiz()
user.set_question()