class Person:
class level variables
company_name = "ABC Services"
def __init__(self, first_name, last_name):
self.first_name = first_name
self.last_name = last_name
def __str__(self):
return f"Person details are: {self.first_name} {self.last_name} {self.company_name}"
def print_person_details(self):
print(f"Person {self.first_name} {self.last_name} works for {self.company_name}")
person1 = Person("John", "Williams")
person1.print_person_details()
person2 = Person("Ana", "Micheal")
person2.print_person_details()
On this page of the site you can watch the video online Python Tutorial - 23 : Python functions | How to create & call a function in Python? with a duration of hours minute second in good quality, which was uploaded by the user Swatech Talks 11 April 2024, share the link with friends and acquaintances, this video has already been watched 34 times on youtube and it was liked by 3 viewers. Enjoy your viewing!