jyostnabodapati
1,297 views
20 slides
Nov 27, 2020
Slide 1 of 20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
About This Presentation
Introduces Various Python Sequence Data types like strings, Lists and Tuples
Size: 498.04 KB
Language: en
Added: Nov 27, 2020
Slides: 20 pages
Slide Content
Sequence Data Types
by
JyostnaDevi Bodapati
Python Programming Specialization
Python Programming –Data Structures
Python Data Types
Data Types
Scalar Data
int
float
complex
boolean
Sequence Data
List
Tuple
String
Mapping Type
Dictionary
Set Type
Set
Frozen Set
Python Programming Specialization
Python Programming –Data Structures
Sequence Data Types
Sequence is the ordered collection of elements
Allows to store multiple values in an organized and efficient manner
Sequence
String List Tuple
Python Programming Specialization
Python Programming –Data Structures
Sequence Types: str
•A string is a collection of one or more characters
•Python strings can be enclosed either in single, double or triple quotes
•Python Strings belongs to strclass
Python Programming Specialization
Python Programming –Data Structures
Accessing String Elements
•Let S1 = “HELLO WORLD”
•How do we access the contents of the string?
•String elements can be accessed by passing an index with the name of the
string
•String name [ index ]
Python Programming Specialization
Python Programming –Data Structures
String Indexing
•Indexing must be an integer
•Both negative and positive indexing are valid
•Ex: S1 = “HELLO WORLD”
Python Programming Specialization
Python Programming –Data Structures
String Indexing
•Integer indexing can be used to access string elements
•Both negative and positive indexing are valid
•Ex: S1 = “HELLO WORLD”
Python Programming Specialization
Python Programming –Data Structures
String Indexing
•Integer indexing can be used to access string elements
•Both negative and positive indexing are valid
•Ex: S1 = “HELLO WORLD”