Python Basics Day 2
Python Basics Day 2
03 Slicing in Python
Sequence
Types
Numeric
Boolean
Data
Data
Types
2. Types
1. 3.
Integer
Float
Complex
1. Example, c = 2 + 4j.
Sequence Data
Types Sequence Data Types
01 String 02
01 List
03 Tuple 04
03 Set
05 Dictionary
String
String Methods
Sequence Data
Types
Result
Sequence Data
Types
List
Sequence Data 1. Lists are just like the arrays, declared in other
languages which is a ordered collection of data.
Types
1. Python lists support multiple data types. Hence
they are more flexible.
List Methods
Sequence Data
Types
Result
Sequence Data
Types
Implementing List
Methods
Sequence Data
Types
Result
Sequence Data
Types
List Comprehension:
Sequence Data
Types
Sequence Data
Types Let’s try to understand what index is with the help of an example.
Sequence Data
Types Consider the example of List Indexing given below.
Sequence Data
Types Consider the example of Negative List Indexing given below.
Tuple
Tuple Methods
Tuple Demo
Sequence Data
Types
Set Methods
Set Data Types 1. clear(): Removes all elements from the set
Result
Set Operations
Result
Dictionary Data
Types
Dictionary Methods
Dictionary Data
Types
Result
Dictionary Data
Types
Dictionary Comprehension:
Types
Dictionary Data
Types
Boolean Data
Types
From these two points we can say that the object whose value can be changed is
called mutable and the object whose value cannot be changed is called Immutable.
Slicing is a Python feature that allows you to access specific parts of a sequence.
1. String Slicing:
String[start : end]
String[start : end : step]
1. String Slicing:
2. List Slicing: