Skip to content

Instantly share code, notes, and snippets.

@pknowledge
Last active February 14, 2022 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pknowledge/ba3095325dc7a4b93b5fa2f2887dfa35 to your computer and use it in GitHub Desktop.
Save pknowledge/ba3095325dc7a4b93b5fa2f2887dfa35 to your computer and use it in GitHub Desktop.
__init__and_self_in_python_rectangle.py
class Rectangle:
def __init__(self, height, width):
self.height = height
self.width = width
rect1 = Rectangle(20, 60)
rect2 = Rectangle(50, 40)
print(rect1.height * rect1.width)
print(rect2.height * rect2.width)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment