How to call a variable created inside the method __init__


If I create a variable inside the init constructor, Can I call that variable later on?

for example

class question():
def init(self, variable):
self.variable = variable

Can I called this variable like this?
Y = question.variable

and if so, how?

Variables defined in the __init__() method are instance variables that can be polled on the class instances.

class Question():
    def __init__(q, a)
    self.q = q
    self.a = a

lightyear = Question("How many kilometers are there in a light year?", "A light year is approximately ten trillion kilometers.")

print (lightyear.q)
print (lightyear.a)