9 TO 5 WORK OBJECT INSPECTOR IN PYTHON DAY 6

 class A:
    Job_time = "9 to 5"

def __init__(self, name, working_days):
self.name = name
self.working_days = working_days

def introducing(self):
return (f"The name of the employee is:{self.name} he/she has to work for "
f"{self.working_days} no. of days")

@classmethod
def greet(cls, time):
if time.upper() == "MORNING":
return f"Good {time}"
elif time.upper() == "AFTERNOON":
return f"Good {time}"
else:
return f"Good {time}"


tanish = A("Tanish", 100)
print(tanish.greet("Morning"))
import inspect as i

print(i.ismethod(tanish))
print(i.getcomments(tanish))
print(i.getsource(A))
for key, data in i.getmembers(tanish):
if key.startswith("__"):
print(data)

Comments

Popular posts from this blog

java chapter11 practice question on abstruct class and interfaces

DAY 12 -AZURE DP900(Microsoft Azure Data Fundamentals: Explore non-relational data in Azure)

java exercise4