Challenge
Index by ID
…six items, but the real manifest has thousands. Build an index from ID to record once, then answer the questions from it. Build the index Build a dict called by_id that maps each cargo ID to its…
Showing 1–10 of 24
Challenge
…six items, but the real manifest has thousands. Build an index from ID to record once, then answer the questions from it. Build the index Build a dict called by_id that maps each cargo ID to its…
Challenge
readings[5] on a list of five readings stops with an IndexError. Predict it, work out the valid indexes with len(), fix it with [-1], then print the first, middle and last readings for any length.
Challenge
…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
…Commander: Okafor Newest member: Kowalska Crew size: 4 Indexes start at 0, as in strings. crew[-1] is the last item whatever the list's length, and len(crew) counts the items. The whole roster Add the…
Challenge
…five bugs: a syntax error, a type error, a wrong key, an index out of range and a reversed decision. Read each error to fix the four that crash, then find the one that runs but gives the wrong answer.
Challenge
…is the second word of each entry: line.split()[1] . LEVELS.index(level) gives its rank, 0 for INFO up to 2 for ERROR, so compare the ranks.
Challenge
…mission summary dict into JSON text with json.dumps() and indent=2, see what True, False and None become, then keep the station's Polish letters readable and sort the keys so the files compare easily.
Challenge
…the first 10 characters. The time starts after the T , at index 11, and is 8 characters long. In text[start:end] , the character at end isn't included. The way we write it In Poland and much of…
Challenge
…check uses = instead of == and has a line that isn't indented, so Python refuses to run it. Predict what happens, fix both errors one after the other, then write an if/else check yourself.
Challenge
…Build a new code with B in place of the shift letter, at index 4, and print both: Old code: ENG-A-07 New code: ENG-B-07 Take everything before index 4, then "B" , then everything after index 4. Don't…