Skip to content

Instantly share code, notes, and snippets.

@tarunasolanki
Created August 9, 2019 14:56
Show Gist options
  • Save tarunasolanki/5bcb6667cfda5f5a7ce4ab67c740ddc7 to your computer and use it in GitHub Desktop.
Save tarunasolanki/5bcb6667cfda5f5a7ce4ab67c740ddc7 to your computer and use it in GitHub Desktop.
Class And Objects In Python
class Person:
def __init__(self, name, age):
self.name = name
self.age =age
def myfunct(self):
print("Printed by mufunct")
print("Hello !! My name is ",self.name)
print("I am ",self.age," years old.")
print("Printed by object")
p1 = Person("Taruna", 19)
print(p1.name)
print(p1.age)
p1.myfunct()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment