Results for “for loop”

Showing 11–20 of 36

  1. Challenge

    Names with values

    Print each sensor name with its reading by looping over two lists together with zip(), then add a third list of units and warn when the lists don't have the same length, since zip() quietly stops at…

    Write the code Easy 2 stages for loop zip lists unpacking
  2. 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
  3. Challenge

    Numbered checklist

    …gives 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…

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

    Retry the uplink

    …a dead link doesn't block everything else. Write the retry loop against a simulator that plays back the radio's replies, then space the attempts out. Up to three tries Try up to MAX_ATTEMPTS times…

    Write the code Medium 2 stages for loop range break retry
  5. Challenge

    Debris grid

    Scan a radar grid stored as a list of strings with a loop inside a loop, print the row and column of every # with enumerate(), then turn the loops around to find the columns that are clear all the way…

    Write the code Medium 2 stages nested loops enumerate range strings
  6. Challenge

    Parser function

    …which returns the record dict, then let it return None for blank, comment and damaged lines so the loop only keeps real records.

    Fix the code Medium 2 stages functions return dictionaries None
  7. Challenge

    Shift rota

    …In turn Build rota , a list of (day, shift, name) tuples for every shift of the week, in order, taking the crew in turn. Print one line per day, then count how many times one person works two shifts…

    Write the code Hard 2 stages project scheduling lists tuples
  8. Challenge

    Safe number input

    The flight engineer types the burn length for the next manoeuvre. One morning the keyboard was set to a Polish layout, 12,5 went in instead of 12.5 , and the whole console program stopped with a…

    Write the code Easy 2 stages errors try except ValueError