Example
String Methods - upper, lower, strip
Useful methods for working with text: changing case, removing whitespace.
Showing 1–10 of 65
Example
Useful methods for working with text: changing case, removing whitespace.
Example
Accessing individual characters and text fragments. Zero-based indexing in Python.
Challenge
code[0] = "X" stops with a TypeError, because Python strings can't be changed. Predict the crash, find out what methods and slices really give, build a new string instead, then swap a letter in the…
Example
…create text and join it in Python. Basics of working with strings.
Quiz
Free beginner quiz on Python strings: 15 questions on joining, indexing, slicing, len(), split(), join() and string methods, with instant answers.
Example
F-strings are a modern way to format text in Python. Insert variables directly into text.
Challenge
…an alert between two 30-character borders from a single f-string with \n, then add more lines and centre the title in the border.
Example
Searching, replacing and splitting text. Advanced string manipulation methods.
Quiz
…on quotes, escape characters, sep, end, flush and f-string formatting, with instant answers.
Challenge
…quotes and an apostrophe exactly, then build it with an f-string that needs literal curly braces.