I have rewritten this code same way it was done on the code along I watched on Youtube but I am getting an error
Using an external file I created for the class
class Quiz:
def __int__(self, q, a):
self.question = q
self.answer = a
Then the main program
from question import Quiz
questionPrompts = [
"The functionality of C transcends into memory manipulation\n(a). True\n(b). False\n\n",
"Why is Tunde learning programming?\n(a) Code games\n(b) Make web apps\n(c) Crypto\n\n",
"What is he's ultimate language?\n(a) JavaScript\n(b) Solidity\n(c) ReactJS\n\n",
"What is the language for artificial intelligence\n(a) Django\n(b) Python\n(c) Flask"
]
question = [
Quiz(questionPrompts[0], "a"),
Quiz(questionPrompts[1], "c"),
Quiz(questionPrompts[2], "b"),
Quiz(questionPrompts[3], "b")
]
def runtest(questions):
score = 0
for question in questions:
answer = input(question.q)
if answer == question.a:
score += 1
return print("You got " + str(score) + "/" + str(len(questions)) + " questions correct")
runtest(question)
Please assist