Module 3: Python Strings
Beginner 10 chapters
30. Introduction to Strings
Get started with Python strings: how to create them, use quotes and escape characters, join and repeat them, read single characters, and understand that strings cannot be changed.
31. String Indexing
Learn how every character in a string has a position number, how to read characters with positive and negative indexes, and how to avoid IndexError.
32. String Slicing
Learn how to cut parts out of a string with start:stop:step slices, use negative numbers, and reverse text with [::-1].
33. String Concatenation
Learn to join strings with +, repeat them with *, build them with +=, and combine many strings with join().
34. String Formatting
Learn how to build text from templates with str.format() and the percent operator, and how to control width, alignment and decimal places.
35. f-Strings
Learn f-strings, the modern way to build text in Python by placing values and expressions inside curly braces, and format numbers, widths and alignment with simple format specs.
36. String Methods
Explore the most useful string methods in Python: changing case, trimming, searching, replacing, splitting, joining and testing the content of text.
37. Escape Characters
Learn escape characters such as newline, tab, backslash and quotes, plus raw strings and Unicode escapes, so you can put special characters inside Python strings.
38. Multiline Strings
Learn how to write strings that span several lines with triple quotes, how indentation and line breaks behave, and how to tidy multiline text with dedent, strip and splitlines.
39. String Immutability
Learn why Python strings cannot be changed in place, what error you get when you try, and how to build new strings with slicing, replace() and join() instead.