I want to print name as tanya but since self.name = None
has been assigned in constructor it is printing None
. So how to get tanya printed when the check function gets called:
class A:
def __init__(self):
self.name = None
def price(self):
self.name = "tanya"
def check(self):
print(self.price())
a=A()
a.check()