Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Classes

Basic object-oriented programming in Python. See Class (computer programming) — Wikipedia.

Key methods

Method Purpose
__init__ Constructor — initialises the object's attributes
__str__ Controls what print(obj) displays
__eq__ Controls how == compares two objects

Example: Line class

Represents a line segment between two 2D points. Computes the Euclidean distance between them.

Run

python classes.py