Challenge
Strings don't change
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…
Showing 1–10 of 65
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…
Quiz
Free beginner quiz on Python strings: 15 questions on joining, indexing, slicing, len(), split(), join() and string methods, with instant answers.
Example
…create text and join it in Python. Basics of working with strings.
Example
F-strings are a modern way to format text in Python. Insert variables directly into text.
Challenge
…quotes and an apostrophe exactly, then build it with an f-string that needs literal curly braces.
Challenge
Scan a radar grid stored as a list of strings with a loop inside a loop, print the row and column of every # with enumerate(), then turn the loops around to find the columns that are clear all the way…
Challenge
…. Then print it: File: eng-2_2026-03-14.csv Inside an f-string's braces you can call methods too: {sensor_id.lower()} . From a name The configuration form gives sensors names like Star Tracker A , and…
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.
Challenge
…a fuel fraction as a percentage, using format specs in f-strings.
Challenge
…it turn into a new line and a tab. Fix it with a raw string, then handle a path that ends with a backslash.