Challenge
Count warnings
…counts how many times the text appears. A multi-line string has a new line character, "\n" , between its lines, so there is one line more than there are new lines. Don't be fooled A new entry has come…
Showing 21–30 of 44
Challenge
…counts how many times the text appears. A multi-line string has a new line character, "\n" , between its lines, so there is one line more than there are new lines. Don't be fooled A new entry has come…
Challenge
…then put them back together in a new order with an f-string.
Challenge
…a piece by its index, the same way as a character in a string: fields[0] is the first. Lists get a stage of their own later. The value as a number split() gives text, so "412.5" + 273.15 would stop…
Challenge
…record["sensor"] , record["time"] and so on. Inside an f-string, use the other kind of quotes: {record['time']} .
Challenge
Turn the day's subsystem status into a fixed-width report for the shift handover, with aligned columns and a totals line, then save the same data as a CSV file with csv.DictWriter for the spreadsheet…
Challenge
Check whether a path starts with telemetry/ and ends with .csv using startswith() and endswith(), see why in isn't enough, then clean up paths with Windows backslashes, capitals and spaces first.
Challenge
A slice meant to take the number from the container tag CG-0042 gives -004. Predict it, work out where indexes start and where a slice ends, fix it, then slice a sample label yourself.
Challenge
Extend the parser from "Parse a telemetry line" to read three readings from a multi-line feed, print each as one row, then turn them into a report with a header and aligned columns.
Challenge
An operator types 42,5 and float() crashes with a ValueError. Predict it, find out why, accept both commas and dots with replace(), then read pressures written like 1 013,25.
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().