Jul-29-2021, 04:58 AM
I am new bie. I have written small code here. how can I print first name from function directly from instance
class Test:
def __init__(self,first,last):
self.first=first
self.last=last
def display_first(self):
return '{}'.format(self.first)
def display_Last(self):
print("Last name:",self.last)
Emp1=Test
Emp1.first="Ajit"
Emp1.last="Nayak"
print(Test.display_first(Emp1))
print(Emp1.display_first())
#Emp1.display_first()
