Python Programming
Python Programming
Topic Week
Inheritance 3
• https://www.python.org/downloads/
• What is IDEs ?
Integrated Development Environment
https://www.jetbrains.com/pycharm/
https://www.anaconda.com/
My First Python Program
How do I Store Data ?
“MANISH”
“NITIN”
“RAHUL”
Variable in python
Students
“NITIN”
0x1098ab
Data types in python
“NITIN” 5+8j
7,25,49 9.3, 14.657 True , False
“MANISH” 9+25j
• Keywords
• Identifiers
• Literals
• Operators
Python Keywords
Logical Keywords Control Flow Key Words Definition Key Words Module Keywords
RULES:
1.No. special character expect _ (Underscore)
2.Identifier are case Sensitive
3.First letter cannot be digit
Python Literals
STRING LITERAL
NUMERIC LITERAL
TYPES OF LITERALS
BOOLEAN LITERAL
LIST LITERAL
Python String
• ‘Hello World’
• “Hello Python”
• ‘”Say Hello To Programming’”
Extracting individual character
String Function in Python
• Tuple
• List
• Dictionary
• Set
Tuple in python
If else
Marks>33%
If… else Pseudo Code
If(condition){
Statements to be executed…
}
else{
Statements to be executed…
}
If… elif…else
If… elif…else Example
Looping Statement
Syntax:
While Condition:
Execute statements
While loop Example
While loop Example
For Loop
Syntax:
Q1. Create a function that can accept two arguments name and age and print its
value ?
Q2. Write a function func1() such that it can accept a variable length of
argument and print all arguments value ?
Q3. Create a function show Employee() in such a way that it should accept
employee name, and it’s salary and display both, and if the salary is missing in
function call it should show it as 9000 ?
Q4. Create an inner function to calculate the addition in the following way ?
Q5. Write a recursive function to calculate the sum of numbers from 0 to 10 ?
Q6. Generate a Python list of all the even numbers between 4 to 30 ?
Python Object Oriented Programming
Class
Class is a
template/blue print
for real world
entities(Object) Class is a user
defined Data
Type
Properties Behavior
Object
Object
are
specific
instances
of a class
Creating a first class
Invoking the
‘employee_details’
method
Inheritance in python
Invoking show_car_details()
method from child class
Types of Inheritance
Single Inheritance
Multiple Inheritance
Multi-level Inheritance
Hybrid Inheritance
Multiple Inheritance
Parent 1 Parent 2
Child
Multiple Inheritance in python
Parent-1 Class
Child Class
Parent-2 Class
Multiple Inheritance in python
Child
Grand Child
Multi-level Inheritance in python
Parent Class
Child Class
Multi-level Inheritance in python
A variable
created inside a
function is
available inside
that function
A variable created
outside of a
function is global
and can be used by
anyone
Naming Variables
A module is a file containing python definitions and statements, all the files
in module have .py suffix
When you have imported the math module, you can start
using methods and constants of the module.
It consist of Multidimensional
array objects and a collection of
routines for processing those
array
Creating Numpy array
Median
Numpy Save & Load
Changing Aesthetics
Assignment -01
Q.2 Write a Python program to get the largest number from a list.
Q.3 Write a Python program to create a tuple with different data types.
Q.4 Write a Python program to get the 4th element and 4th element from last of a tuple.
Q.6 Write a Python program to find those numbers which are divisible by 7 and multiple of 5,
between 1500 and 2700 (both included).
Assignment -02
Q.5 Write a Python program to get the class name of an instance in Python ?