Skip to content

Instantly share code, notes, and snippets.

@Vasanth375
Created January 25, 2023 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vasanth375/747de7bc1e8ceb13dee1f704aa73a322 to your computer and use it in GitHub Desktop.
Save Vasanth375/747de7bc1e8ceb13dee1f704aa73a322 to your computer and use it in GitHub Desktop.
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def greet(self):
return "Hello, my name is " + self.name + " and I am " + str(self.age) + " years old."
p1 = Person("John", 30)
print(p1.greet()) # Output: "Hello, my name is John and I am 30 years old."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment