I need help in my Class

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

what error are you getting?


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Thanks a lot for that. I’ve been wanting to know how to write a post with the code looking like, basically a code lol
For the error, I found out that my class method, init was written as int
You may not have solved my query, but you’ve helped me for my future questions so I don’t look like a dumbass :sweat_smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.