Hello,
I am a beginner. I have written this code and it works for some part while it doesn't work the other time. Kindly help.
</code>
I am a beginner. I have written this code and it works for some part while it doesn't work the other time. Kindly help.
class Employee:
def __init__(self, full_name, age ):
self.full_name = full_name
self.age = age
def shout(self):
print(f"the details of employee is , {self.full_name} and the age is {self.age}")
def run(self):
return self
empl_1 = Employee("Suman Palisetty", 37)
# empl_2 = Employee("Suman Palisetty", 38)
# empl_1.shout()
# empl_2.shout()
print(empl_1.run()) #It gives me <__main__.Employee object at 0x000002952C978400>
# print(Employee.run()) '''if we uncomment this line and run it, it gives me this error.Error:Traceback (most recent call last):
File "C:/Users/spali/PycharmProjects/First/decorator1.py", line 18, in <module>
print(Employee.run())
TypeError: run() missing 1 required positional argument: 'self'
'''What am I doing wrong, why it doesn't work for me?</code>
