Example
String Methods - upper, lower, strip
Useful methods for working with text: changing case, removing whitespace.
Showing 1–10 of 72
Example
Useful methods for working with text: changing case, removing whitespace.
Challenge
Turn " Launch " into launch with strip() and lower(), check it against the command list, then accept underscores and dashes too, so commands match however operators type them.
Quiz
Free beginner quiz on Python strings: 15 questions on joining, indexing, slicing, len(), split(), join() and string methods, with instant answers.
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.
Challenge
…101.2 kPa 09:30:10 ENG-2: 415.0 C At the top of the loop, strip the line, then continue when it's empty or starts with # . Stripping first matters: one comment is indented, and a line can hold nothing…
Example
F-strings are a modern way to format text in Python. Insert variables directly into text.
Challenge
Clean the crew sign-ups for the analogue mission: trim and capitalise names, lower-case emails, then reject sign-ups with no name or a broken email and drop duplicates by email, saying why for each…
Example
Accessing individual characters and text fragments. Zero-based indexing in Python.
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…