SlideShare a Scribd company logo
SEQUENCES
PRESENTED BY:
DHANUSHYA V
INDHUMATHI M
III BCA A
WHAT IS SEQUENCE?
• A sequence is a collection of objects, arranged in a particular order. A
sequence can be either a list, a tuple, or a string. Sequences are
inerrable, meaning you can loop over the elements in a sequence
one by one.
• Sequences are containers with items stored in a deterministic
ordering. Each sequence data type comes with its unique capabilities.
SEQUENCE TYPE OPERATORS
Sequence Operator Function
seq[ind] Element located at index ind of seq
seq[ind1:ind2] Elements from ind1 up to but not including ind2 of seq
seq * expr seq repeated expr times
seq1 + seq2 Concatenates sequences seq1 and seq2
obj in seq Tests if obj is a member of sequence seq
obj not in seq Tests if obj is not a member of sequence seq
TYPES OF SQUENCES
THERE ARE SIX TYPES OF SEQUENCES NAMELY;
1. STRING
2. LIST
3. TUPLES
4. BYTES SEQUENCES
5. BYTE ARRAYS
6. RANGE()OBJECTS
STRINGS
• Strings in python are surrounded by either single quotation marks, or double
quotation marks.
• 'hello' is the same as "hello". We can create string using str()function also.
• We can literally display string with print()statement;
• Example: Creating a string
print(“Hello”)
print(‘hello’)
HOW TO ACCESS VALUES
• Assigning a string to a variable is done with the variable name followed by an equal sign
and the string:
Example:
>>>a = "Hello"
>>>print(a)
Output:
Hello
>>>a[1:5]
Output:
"ello"
UPDATE A STRING
• You can “update” an existing string by (re)assigning a variable to another
string
>>> aString = aString[:6] + 'Python!’
>>> aString
'Hello Python!’
REMOVE A STRING
• strings are immutable, so you cannot remove individual characters from an existing
string.
Example:
>>> aString = ‘’
>>> aString
‘’
>>>del aString
MULTILINE STRINGS
• You can assign a multiline string to a variable by using three
quotes:
Example:
a = """welcome all ,
Good to see you all,
Good morning"""
print(a)
STRINGS ARE ARRAYS
• strings in Python are arrays of bytes representing Unicode
characters. Python does not have a character data type.
• Square brackets can be used to access elements of the
string.
Example: a = "Hello, World!"
print(a[1])
PYTHON - STRING METHODS
• Python has a set of built-in methods that you can use on
strings.
Method Description
capitalize() Converts the first character to upper case
casefold() Converts string into lower case
center() Returns a centered string
count() Returns the number of times a specified value occurs in a string
lower() Converts a string into lower case
replace() Returns a string where a specified value is replaced with a
specified value
split() Splits the string at the specified separator, and returns a list
LIST
• Lists are used to store multiple items in a single variable.
• Lists are one of 4 built-in data types in Python used to store
collections of data.
• Lists are created using square brackets.
Example: Creating a list,
LIST ITEMS
• List items are ordered, changeable, and allow duplicate values.
Ordered:
• When we say that lists are ordered, it means that the items
have a defined order, and that order will not change.
• If you add new items to a list, the new items will be placed at
the end of the list
CHANGEABLE
• The list is changeable, meaning that we can change, add, and
remove items in a list after it has been created.
ALLOW DUPLICATES
• Since lists are indexed, lists can have items with the same value:
Example:
LIST LENGTH
• To determine how many items a list has,use len()function;
Example
Print the number of items in the list:
TUPLE
• Tuples are used to store multiple items in a single variable.
• A tuple is a collection which is ordered and unchangeable.
• Tuples are written with round brackets.
Example
• Create a Tuple:
UPDATE TUPLE
• Tuple items are ordered, unchangeable, and allow duplicate
values.
Example:
TUPLE METHODS
METHOD DESCRIPTION
count() Returns the number of times a specified value occurs in a tuple
index() Searches the tuple for a specified value and returns the position of where it was found
THANK YOU

More Related Content

PPTX
Lists on the pyhton to learn the children more easily on easy codes.pptx
PPT
Intro to Lists
PPTX
Lists Data Structures and Algorithm.pptx
PPTX
MODULE-2.pptx
PPTX
tupple.pptx
PPTX
Python Collections - List, Tuple and Set.
PPTX
PYTHON LISTsjnjsnljnsjnosojnosojnsojnsjsn.pptx
PDF
List , tuples, dictionaries and regular expressions in python
Lists on the pyhton to learn the children more easily on easy codes.pptx
Intro to Lists
Lists Data Structures and Algorithm.pptx
MODULE-2.pptx
tupple.pptx
Python Collections - List, Tuple and Set.
PYTHON LISTsjnjsnljnsjnosojnosojnsojnsjsn.pptx
List , tuples, dictionaries and regular expressions in python

Similar to "Sequences in Python include list, tuple, string, and range" (20)

PPTX
Unit 2 linear data structures
PPTX
Datastrucure
PDF
Processing data with Python, using standard library modules you (probably) ne...
PPTX
Arrays in Reading.pptx
PDF
ProgPrinc_Lecture_3_Data_Structures_and_Iteration-2.pdf
PPTX
Python Tutorial Part 1
PPTX
Python Collections
PDF
ProgFund_Lecture_3_Data_Structures_and_Iteration-1.pdf
PPTX
Data Structures in Python
PPT
Python first day
PPT
Python first day
PPTX
Computer Sience, This is my presentation for beginners coding in python
PPTX
Stacks.pptx in software engineering in simple understanding
PPTX
Tuples.pptx
PDF
The List Data Model
PDF
"Automata Basics and Python Applications"
PPTX
02 Python Data Structure.pptx
PPTX
Lists, Stacks, and Queues: Abstract Data Types
PPTX
11 Introduction to lists.pptx
PPTX
Unit 2 linear data structures
Datastrucure
Processing data with Python, using standard library modules you (probably) ne...
Arrays in Reading.pptx
ProgPrinc_Lecture_3_Data_Structures_and_Iteration-2.pdf
Python Tutorial Part 1
Python Collections
ProgFund_Lecture_3_Data_Structures_and_Iteration-1.pdf
Data Structures in Python
Python first day
Python first day
Computer Sience, This is my presentation for beginners coding in python
Stacks.pptx in software engineering in simple understanding
Tuples.pptx
The List Data Model
"Automata Basics and Python Applications"
02 Python Data Structure.pptx
Lists, Stacks, and Queues: Abstract Data Types
11 Introduction to lists.pptx
Ad

Recently uploaded (20)

PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Empathic Computing: Creating Shared Understanding
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
KodekX | Application Modernization Development
PPTX
Big Data Technologies - Introduction.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Cloud computing and distributed systems.
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Mobile App Security Testing_ A Comprehensive Guide.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Encapsulation_ Review paper, used for researhc scholars
Empathic Computing: Creating Shared Understanding
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Spectral efficient network and resource selection model in 5G networks
Understanding_Digital_Forensics_Presentation.pptx
KodekX | Application Modernization Development
Big Data Technologies - Introduction.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Cloud computing and distributed systems.
NewMind AI Monthly Chronicles - July 2025
NewMind AI Weekly Chronicles - August'25 Week I
Advanced methodologies resolving dimensionality complications for autism neur...
Ad

"Sequences in Python include list, tuple, string, and range"

  • 2. WHAT IS SEQUENCE? • A sequence is a collection of objects, arranged in a particular order. A sequence can be either a list, a tuple, or a string. Sequences are inerrable, meaning you can loop over the elements in a sequence one by one. • Sequences are containers with items stored in a deterministic ordering. Each sequence data type comes with its unique capabilities.
  • 3. SEQUENCE TYPE OPERATORS Sequence Operator Function seq[ind] Element located at index ind of seq seq[ind1:ind2] Elements from ind1 up to but not including ind2 of seq seq * expr seq repeated expr times seq1 + seq2 Concatenates sequences seq1 and seq2 obj in seq Tests if obj is a member of sequence seq obj not in seq Tests if obj is not a member of sequence seq
  • 4. TYPES OF SQUENCES THERE ARE SIX TYPES OF SEQUENCES NAMELY; 1. STRING 2. LIST 3. TUPLES 4. BYTES SEQUENCES 5. BYTE ARRAYS 6. RANGE()OBJECTS
  • 5. STRINGS • Strings in python are surrounded by either single quotation marks, or double quotation marks. • 'hello' is the same as "hello". We can create string using str()function also. • We can literally display string with print()statement; • Example: Creating a string print(“Hello”) print(‘hello’)
  • 6. HOW TO ACCESS VALUES • Assigning a string to a variable is done with the variable name followed by an equal sign and the string: Example: >>>a = "Hello" >>>print(a) Output: Hello >>>a[1:5] Output: "ello"
  • 7. UPDATE A STRING • You can “update” an existing string by (re)assigning a variable to another string >>> aString = aString[:6] + 'Python!’ >>> aString 'Hello Python!’
  • 8. REMOVE A STRING • strings are immutable, so you cannot remove individual characters from an existing string. Example: >>> aString = ‘’ >>> aString ‘’ >>>del aString
  • 9. MULTILINE STRINGS • You can assign a multiline string to a variable by using three quotes: Example: a = """welcome all , Good to see you all, Good morning""" print(a)
  • 10. STRINGS ARE ARRAYS • strings in Python are arrays of bytes representing Unicode characters. Python does not have a character data type. • Square brackets can be used to access elements of the string. Example: a = "Hello, World!" print(a[1])
  • 11. PYTHON - STRING METHODS • Python has a set of built-in methods that you can use on strings. Method Description capitalize() Converts the first character to upper case casefold() Converts string into lower case center() Returns a centered string count() Returns the number of times a specified value occurs in a string lower() Converts a string into lower case replace() Returns a string where a specified value is replaced with a specified value split() Splits the string at the specified separator, and returns a list
  • 12. LIST • Lists are used to store multiple items in a single variable. • Lists are one of 4 built-in data types in Python used to store collections of data. • Lists are created using square brackets. Example: Creating a list,
  • 13. LIST ITEMS • List items are ordered, changeable, and allow duplicate values. Ordered: • When we say that lists are ordered, it means that the items have a defined order, and that order will not change. • If you add new items to a list, the new items will be placed at the end of the list
  • 14. CHANGEABLE • The list is changeable, meaning that we can change, add, and remove items in a list after it has been created. ALLOW DUPLICATES • Since lists are indexed, lists can have items with the same value: Example:
  • 15. LIST LENGTH • To determine how many items a list has,use len()function; Example Print the number of items in the list:
  • 16. TUPLE • Tuples are used to store multiple items in a single variable. • A tuple is a collection which is ordered and unchangeable. • Tuples are written with round brackets. Example • Create a Tuple:
  • 17. UPDATE TUPLE • Tuple items are ordered, unchangeable, and allow duplicate values. Example:
  • 18. TUPLE METHODS METHOD DESCRIPTION count() Returns the number of times a specified value occurs in a tuple index() Searches the tuple for a specified value and returns the position of where it was found