Professional Documents
Culture Documents
Agenda
2 Python Basics
4 Python Functions
How do Humans Communicate?
How do
humans
communicate?
hello Olá
Bonjour
नमस्कार
Grammar in Language
I am Sam Am Sam I
Language for Computers
How do we
speak with
computers?
Java Python
C++
Syntax for Computer Language
import pandas as pd
pandas import pd as
Why do we need Programming?
What is 2*2?
Why do we need Programming?
What is 20*20?
Why do we need Programming?
What is
12345*6789?
Applications of Programming Languages
13.4
My Name is Sam
287
(a+b)2 0 1
How to Store Data?
How do I
store data?
“John”
123
TRUE
Need of Variables
Student
“John”
0x1098ab
Example of Variable
a+b
10 a
a-b
a/b
Decision Making Statements
If
else
It’s raining:
Go out and Play Football
Sit inside
Decision Making Statements
If
else
Marks > 70:
Give Practice Test
Get Ice-cream
if…else Pseudo Code
If(condition){
Statements to be executed….
}
else{
Statements to be executed….
}
Looping Statements
Keep repeating
the song until
you close the
app!
Looping Statements
while(TRUE){
Keep executing statements….
}
Functions in Real Life
You are
surrounded
with Objects!!
Classes
Properties Behavior
How do you
make lemon
juice?
Step by Step Approach
Start
Take Number
If number
Even Number Odd Number
% 2 == 0
End
Introduction to Python
Cross-Platform
Compatible
Object Oriented
Installing Python
How do I
store data?
“John”
“Sam”
“Matt”
Variables in Python
Student
“John”
0x1098ab
Variables in Python
Arithmetic Operators
Keywords
Identifiers
Literals
Operators
Python Keywords
as elif If Or Yield
Python Identifiers
Rules
I’m a constant.
I don’t change
Python Strings
Strings are sequence of characters enclosed within single quotes(‘ ’), double
quotes(“ “) or triple quotes(‘’’ ‘’’)
‘’’ I am going to
‘Hello World’ “This is Sparta”
France tomorrow’’’
Extracting Individual Characters
String Functions
Finding length of string Converting String to lower case Converting String to upper case
String Functions
Replacing a substring
Splitting a String
Data-Structures in Python
Tuple List
Dictionary Set
Tuple in Python
Tuples are
immutable
tup1=(1,’a’,True)
Extracting Individual Elements
Modifying a Tuple
Concatenating Tuples
Tuple Basic Operations
Minimum Value
Maximum Value
List in Python
Lists are
mutable
l1=[1,’a’,True]
Extracting Individual Elements
Modifying a List
Sorting a list
Reversing elements of a list
Concatenating Lists
Repeating elements
Dictionary in Python
Dictionary is
mutable
Fruit={"Apple":10,"Orange":20}
Extracting Keys and Values
Extracting Keys
Extracting Values
Modifying a Dictionary
Popping an element
Set in Python
Duplicates
are not
allowed in
Set
s1={1,"a",True}
Set Operations
If
else
It’s raining:
Go out and Play Football
Sit inside
If Statement
If
else
Marks > 70:
Give Practice Test
Get Ice-cream
if…else Pseudo Code
If(condition){
Statements to be executed….
}
else{
Statements to be executed….
}
Looping Statements
Keep repeating
the song until
you close the
app!
Looping Statements
Syntax:
Enter While loop
while condition:
Test Execute Statements
Expression
Body of While
For Loop
This is the
syntax of for
loop
You are
surrounded
with Objects!!
Classes
Properties Behavior
I am a
user-define
d data type
int float
bool str
Mobile
Attributes and Methods
color
Attributes
cost
Play Game
Methods
Make Call
Objects
a = 10 b = 20 c = 30
Invoking the
‘employee_details’
method
Inheritance in Python
With inheritance one class can derive the properties of another class
Man inheriting
features from his
father
Inheritance Example
Invoking show_details()
method from parent class Invoking show_car_details()
method from child class
Types of Inheritance
Single Inheritance
Multi-level Inheritance
Hybrid Inheritance
Multiple Inheritance
In multiple inheritance, the child inherits from more than 1 parent class
Parent 1 Parent 2
Child
Multiple Inheritance in Python
Invoking methods
Parent
Child
Grand-Child
Multi-Level Inheritance in Python
Grand-Child Class
Parent Class
Child Class
Multi-Level Inheritance in Python