Results for “for”

Showing 11–20 of 136

  1. Challenge

    Paged results

    …in pages: a few results per request, and you ask again for the next page. The mission planners want one list of every launch. Merge the pages into one list, then fetch them the way a real client does…

    Write the code Medium 2 stages for loop while loop extend break
  2. Challenge

    Copy-pasted blocks

    …status display was written in a hurry: one block of code for tank A, then the same block copied for B and C. It works, but every change has to be made three times, and the next tank means a fourth…

    Fix the code Medium 2 stages refactoring for loop tuples lists
  3. Challenge

    Countdown with holds

    …, the countdown ends like this: T-5 T-4 SCRUB at T-4 Check for the scrub before the hold, break after the scrub line, and use a flag to decide about Liftoff! after the loop.

    Write the code Easy 2 stages for loop range negative step in
  4. Challenge

    Numbered checklist

    …pairs of a number and an item. Unpack them in the loop: for number, item in enumerate(checklist, start=1): . Done or not yet The crew has done the first two items. Add completed = 2 under the list…

    Write the code Easy 2 stages for loop enumerate start lists
  5. Challenge

    Manifest line

    …cartridges | 18.5 kg Three names on the left of = , one for each value, in order. A new field The manifest now also records the module each item is stowed in. The starter code stops with ValueError…

    Write the code Easy 2 stages tuples unpacking ValueError formatting
  6. Challenge

    Silent branch

    status_light() returns None for Scrub because that branch sets a variable but never returns it. Predict the last line, find which statuses give None, make every path return, then write a function…

    Fix the code Easy 3 stages functions return None branches
  7. 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