Challenge
Date and time from a timestamp
…then put them back together in a new order with an f-string.
Showing 31–40 of 72
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…
Article Mini projects
…numpy as np # numpy.base_repr(number, base) returns a string print(np.base_repr(12, 6)) # Output: 20 print(np.base_repr(36, 6)) # Output: 100 print(np.base_repr(101, 6)) # Output: 245…
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().