213 Creating classes
Here, we will learn how to name and define a class in Python.
class <ClassName>():
def __init__(self, <optional param1>, ..., <optional paramN>):
# any initialisation code here
# Any number of functions that access the data
# Each has the form:
def <functionName1>(self, <optional param1>, ..., <optional paramN>):
# body of function
# ... more functions
def <functionNameN>(self, <optional param1>, ..., <optional paramN>):
# body of functionReview Questions
Last updated
Was this helpful?