Professional Documents
Culture Documents
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