KEMBAR78
Python Programming | JNTUA | UNIT 3 | Strings | | PPTX
Python Programming
Unit – III (Part II)
(Lecture 19)
Strings
Python Programming
Unit – III (Part II)
(Lecture 19)
Strings
String Sequence String Length String Traversal
Strings
Lecture 19 Lecture 20
String Sequence
String Length Immutable
Searching
String slicing
String Traversal
String methods
in operator
Looping &
Counting
String Comparison
Lecture 21
Strings
Lecture 19
String Sequence
String Length
String Traversal
String Sequence
• A string is a sequence
of characters.
• You can access the
characters one at a
time with the [ ]
operator
The expression in brackets is
called an index.
Strings
Lecture 19
String Sequence
String Length
String Traversal
String Length
len is a built-in function
that returns the number
of characters in a string
How to find last character in string?
Strings
Lecture 19
String Sequence
String Length
String Traversal
String Traversal
Start at the beginning, select
each character in turn and
continue until the end is
called a traversal.
Strings
Lecture 19
String Sequence
String Length
String Traversal
Python Programming
Unit – III (Part II)
(Lecture 20)
Strings
Python Programming
Unit – III (Part II)
(Lecture 20)
Strings
Immutable Searching
String slicing
Strings
Lecture 19 Lecture 20
String Sequence
String Length Immutable
Searching
String slicing
String Traversal
String methods
in operator
Looping &
Counting
String Comparison
Lecture 21
Strings
Lecture 20
Immutable
Searching
String slicing
String slicing
• A segment of a string is
called a slice.
• The operator [n : m]
returns from the nth
char to the (m-1)th char
Strings
Lecture 20
Immutable
Searching
String slicing
Immutable
Strings are immutable,
which means you can’t
change an existing string.
Strings
Lecture 20
Immutable
Searching
String slicing
Searching
• It takes a character and finds
the index where that character
appears.
• If the character is not found,
the function returns -1
Strings
Lecture 20
Immutable
Searching
String slicing
Python Programming
Unit – III (Part II)
(Lecture 21)
Strings
Python Programming
Unit – III (Part II)
(Lecture 21)
Strings
Looping &
Counting
String methods in operator String Comparison
Strings
Lecture 19 Lecture 20
String Sequence
String Length Immutable
Searching
String slicing
String Traversal
String methods
in operator
Looping &
Counting
String Comparison
Lecture 21
Strings
String methods
in operator
Looping &
Counting
String Comparison
Lecture 21
Looping & Counting
Strings
String methods
in operator
Looping &
Counting
String Comparison
Lecture 21
String methods
• A method is similar to a
function.
• It takes arguments and
returns a value
Strings
String methods
in operator
Looping &
Counting
String Comparison
Lecture 21
in operator
• The word in is a Boolean
operator that takes two
strings.
• if the first string appears
as a substring in the
second: returns True
Strings
String methods
in operator
Looping &
Counting
String Comparison
Lecture 21
String Comparison
Strings
String methods
in operator
Looping &
Counting
String Comparison
Lecture 21
Python Programming
Unit – III (Part III)
(Lecture 22)
Case Study
Lecture 22
Reading word lists
Search
Looping with
indices
Case Study
Reading word lists
Lecture 22
Reading word lists
Search
Looping with
indices
Case Study
Search
Search
Lecture 22
Reading word lists
Search
Looping with
indices
Case Study
Looping with indices
L E V E L
Lecture 22
Reading word lists
Search
Looping with
indices
Case Study

Python Programming | JNTUA | UNIT 3 | Strings |