Functions and Classes#

Like any other programming language, some codes are used more than once and need not be rewritten over and over. These repeatable codes are called Functions.

Python is known to be an object-oriented language. This is because almost everything in Python is objects which are associated with functions (methods) and properties (attributes) and variables. Once a class is defined, we can create instances from a class, this class serves as a blueprint for subsequent instances.

  • Python Naming Convention

  • For function names, object names, and module names use lower case separated by underscore, for example:

def my_router():
    pass
  • For class names, capitalize the first letter of each word. Do not use any underscores. For example:

class UserProfile:
    pass