What is Python?
• Python is an interpreted, object-oriented, high-level
programming language with dynamic semantics.
• Its high-level built in data structures, combined with
dynamic typing and dynamic binding, make it very
attractive for Rapid Application Development, as well as
for use as a scripting or glue language to connect existing
• Python's simple, easy to learn syntax emphasizes
readability and therefore reduces the cost of program
• Python supports modules and packages, which
encourages program modularity and code reuse.
• Inheritance and composition are two major concepts in object
oriented programming that model the relationship between two
• Inheritance models what is called an is a relationship. This
means that when you have a Derived class that inherits from
a Base class, you created a relationship where Derived is
a specialized version of Base.
• Composition is a concept that models a has a relationship. It
enables creating complex types by combining objects of other
types. This means that a class Composite can contain an object
of another class Component.
In the figure, classes are represented as boxes. The
inheritance relationship is represented by an arrow
pointing from Derived Class(Child Class) to Base
Class(Parent Class). The extends keyword denotes
that the Child Class is inherited or derived
from Parent Class.
Inheritance is used where a class wants to derive the
nature of parent class and then modify or extend the
functionality of it.
# Parent class class Parent :
# Variables of Parent class
# Methods ... ...
# Child class inheriting Parent class
class Child(Parent) :
# constructor of child class
# variables of child class
# methods of child class ... ...
class A :
# variables of class A
# methods of class A ... ...
class B :
# by using "obj" we can access member's of class A. obj =
# variables of class B
# methods of class B
Built in fuctions
abs() Returns the absolute value of a number
all() Returns True if all items in an iterable
object are true
any() Returns True if any item in an iterable
object is true
ascii() Returns a readable version of an object.
Replaces none-ascii characters with
bin() Returns the binary version of a number
bool() Returns the boolean value of the
bytearray() Returns an array of bytes
bytes() Returns a bytes object
callable() Returns True if the specified object is
callable, otherwise False
chr() Returns a character from the specified
classmethod() Converts a method into a class method
compile() Returns the specified source as an
object, ready to be executed
complex() Returns a complex number
delattr() Deletes the specified attribute (property
or method) from the specified object
dict() Returns a dictionary (Array)
dir() Returns a list of the specified object's
properties and methods
divmod() Returns the quotient and the
remainder when argument1 is divided
enumerate() Takes a collection (e.g. a tuple) and
returns it as an enumerate object
eval() Evaluates and executes an expression
exec() Executes the specified code (or
filter() Use a filter function to exclude items in
an iterable object
float() Returns a floating point number
format() Formats a specified value
frozenset() Returns a frozenset object
getattr() Returns the value of the specified
attribute (property or method)
globals() Returns the current global symbol
table as a dictionary
hasattr() Returns True if the specified object
has the specified attribute
hash() Returns the hash value of a specified
help() Executes the built-in help system
hex() Converts a number into a hexadecimal
id() Returns the id of an object
input() Allowing user input
int() Returns an integer number
isinstance() Returns True if a specified object is an
instance of a specified object
issubclass() Returns True if a specified class is a
subclass of a specified object
iter() Returns an iterator object
And there are various other built in functions.