Results for “PRIMM”

Showing 11–20 of 34

  1. Challenge

    Missing field

    Reading launch["pad"] stops with a KeyError when the API hasn't assigned a pad yet. Predict it, check the keys with in, fix it with get() and a default, then print a list of launches with defaults for…

    Fix the code Easy 3 stages dictionaries KeyError get default values
  2. Challenge

    Never-ending wait

    A while loop waits for the antenna signal but never moves on to the next reading, so it never ends. Predict it, find the stuck counter, fix it, then write a wait that gives up when the readings run…

    Fix the code Easy 3 stages while loop infinite loop counter and
  3. Challenge

    One orbit short

    A loop over range(1, 10) logs nine orbits of a ten-orbit flight. Predict the last line, find out where range() stops, fix it with ORBITS + 1, then list every third orbit with a range() step.

    Fix the code Easy 3 stages for loop range off-by-one step
  4. Challenge

    Backup that isn't

    backup = crew gives one list two names, so removing someone from the backup removes them from the live roster too. Predict it, prove it with is, fix it with copy(), then plan a crew swap on a real…

    Fix the code Medium 3 stages lists copy references is
  5. Challenge

    Missing index

    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.

    Fix the code Easy 3 stages lists indexing IndexError len
  6. Challenge

    sort() returns None

    crew = crew.sort() leaves the roster as None. Predict it, find out what sort() really gives back, fix it by sorting in place, then sort readings from highest to lowest and keep the top three.

    Fix the code Easy 3 stages lists sort None in place
  7. Challenge

    Assignment in a condition

    An oxygen 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.

    Fix the code Easy 3 stages if else == SyntaxError
  8. Challenge

    Flag from config text

    A config file says dry_run is False, yet bool("False") turns it into True and the engine simulates instead of firing. Predict it, find out why, compare the text instead, then read yes/no settings…

    Fix the code Easy 3 stages bool if else config
  9. Challenge

    Unreachable branch

    A vibration check reports WARN for a reading of 63 because its elif conditions are in the wrong order, so CRITICAL can never run. Predict it, find the dead branch, fix the order, then write a…

    Fix the code Easy 3 stages if elif order of conditions debugging
  10. Challenge

    Off-by-one slice

    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.

    Fix the code Easy 3 stages strings slicing indexing off-by-one