Example
Methods find, count, replace and split
Searching, replacing and splitting text. Advanced string manipulation methods.
Showing 1–10 of 34
Example
Searching, replacing and splitting text. Advanced string manipulation methods.
Challenge
Go through a block of telemetry line by line with splitlines(), split each line at the commas and print the sensor and value, then unpack the four fields and show the clock time too.
Challenge
Split a sensor ID like ENG-2 into its subsystem and its unit number as an int, work out the next ID, then handle subsystems with a dash in their name using rsplit().
Challenge
Split a telemetry reading like 2026-03-14T09:30:05Z,ENG-2,412.5,C into its four fields with split(), print each with a label, then turn the value into a number and convert it to kelvin.
Quiz
…15 questions on joining, indexing, slicing, len(), split(), join() and string methods, with instant answers.
Challenge
…C 09:30:06 CAB-1 101.3 kPa 09:30:07 BAT-3 87.2 % feed.split("\n") splits the feed into its lines, and each line splits at the commas as before. The time of day is [11:19] of the timestamp. print()…
Challenge
…Tomasz Nowak <tomasz nowak@example.org> name.split() splits on any run of spaces and drops the ends, so " ".join(...) rebuilds it neatly; title() capitalises each word. Reject and deduplicate Build…
Challenge
…dance REJECTED "": empty command text.strip().lower().split() gives the words. Converting the length can raise its own ValueError : catch it and raise yours, with a clearer message. set mode and abort…
Challenge
The telemetry pipeline is now split into parse_row() and check_limits(). Write assert tests for both, good rows, rejected rows and readings right at a limit, so that each of three planted bugs makes…
Challenge
Split 100,000 seconds of mission time into hours, minutes and seconds with // and %, pad it to a 27:46:40 clock, then add days in the DDD/HH:MM:SS format.