A Python string is also a sequence, more specifically a text sequence (of characters).
So you can access individual characters, perform slicing and iterate over strings just as you would do with lists/tuples.
You can also use the +
, *
, in
and not in
operators as in a list/tuple.
Like tuples, a str
is immutable. So you cannot change a character in a string directly or append()
directly to an existing string.
Since everything is the same as tuples, let’s just jump straight into a quiz!
1
2
3
4
5
6
7
8
9
10
11
12
13
❮
❯