Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
class Employee:
    company = "Google"

    def getSalary(self, signature):
        print(f"Salary for this employee working in {self.company} is {self.salary}\n{signature}")

 

harry = Employee()
harry.salary = 100000
harry.getSalary("Thanks!") # Employee.getSalary(harry)


What I have tried:

I just saw this on a youtube tutorial of in python in OOPS section . I am not getting the logic how it is acceptino thanks as a signauture . Please assist me in as layman term as you can
Posted
Updated 21-Jan-23 10:24am
Comments
Member 15627495 21-Jan-23 14:51pm    
the var 'signature' is just print out. its not 'filtered'.

1 solution

It's a parameter or argument to the function: you tell the function what the variable signature should contain when you call the function.

See here: Python Functions[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900