
Learning outcomes
By the end of this chapter, you should be able to:- create and print strings
- use indexing and slicing
- apply basic string operators
- explain string immutability
Creating strings
Indexing
Slicing
String operators
Immutability
Strings cannot be changed in place.Useful basics
Exam-focused points
- indexing starts at
0 - negative index starts from end
- slice end index is excluded
- strings are immutable
Practice questions
- Take a word and print first and last character.
- Reverse a string using slicing.
- Print every alternate character from a string.
