Sensor ID parts
Every sensor on Python One has an ID made of its subsystem and a unit number: ENG-2 is the second engine sensor. The maintenance tool needs both parts separately, and the number as a real number, so it can find the unit next to it.
Take the ID apart, then make it work for subsystems whose names contain a dash themselves.
Finish stage 1 to unlock this stage.
Split the ID at the dash. Print the subsystem, the unit number as an int, and the ID of the next unit:
Subsystem: ENG Unit number: 2 Next unit: ENG-3
The pieces from split() are text, and "2" + 1 would crash, so turn the number into an int before you add 1.
Finish stage 1 to unlock this stage.
Some subsystems have a dash in their name: LIFE-SUPPORT-4. The starter code stops with a ValueError, because split("-") cuts at every dash and int("SUPPORT") makes no sense. Split only at the last dash, so it prints:
Subsystem: LIFE-SUPPORT Unit number: 4 Next unit: LIFE-SUPPORT-5
rsplit("-", 1) splits from the right, and the 1 means "at most once". IDs like ENG-2 must still work.
Hints
Methods find, count, replace and split
# Searching, counting, and splitting strings
# A snippet of mission log text
report = "Mars rover Curiosity landed. Curiosity is still active."
# .find() returns the index of the first match, or -1 if not found
position = report.find("Curiosity")
print("Curiosity first appears at index:", position)
missing = report.find("Voyager")
print("Voyager index:", missing) # -1 means not found
# .count() returns how many times a substring appears
mentions = report.count("Curiosity")
print("Curiosity mentioned:", mentions, "times")
# .replace() can clean up or swap text - here we redact a name
public_report = report.replace("Curiosity", "[REDACTED]")
print(public_report)
# .split() breaks a string into a list, using a separator
crew_data = "Mark Watney,Botanist,Ares III,Sol 18"
fields = crew_data.split(",")
print("Fields:", fields)
# We can grab individual pieces by index
print("Name:", fields[0])
print("Role:", fields[1])
# Splitting on whitespace - no argument needed
sentence = "Houston we have a problem"
words = sentence.split()
print("Words:", words)
Separate arguments with commas. They're passed on every Run as sys.argv[1:].