Results for “for loop”

Showing 11–20 of 57

  1. Challenge

    Paged results

    …list with extend(), then fetch page after page in a while loop and stop at the first short page, the way paginated API responses are read.

    Write the code Medium 2 stages for loop while loop extend break
  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

    Copy-pasted blocks

    …blocks with a list of (name, level) pairs and one loop, keeping the output exactly the same, then add a fourth tank with a single list item and list the low tanks.

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

    Skip blanks and comments

    …CABIN: 101.2 kPa 09:30:10 ENG-2: 415.0 C At the top of the loop, strip the line, then continue when it's empty or starts with # . Stripping first matters: one comment is indented, and a line can hold…

    Write the code Medium 2 stages for loop continue strip startswith
  5. Challenge

    Parse the whole feed

    …line, and a parser has to handle every line the same way. Loop over the lines, split each one, and print what the flight controllers need. Line by line Go through the feed line by line, split each…

    Write the code Easy 2 stages for loop splitlines split unpacking
  6. Article Python Fundamentals

    Nested Loops in Python

    Nested loops let you work with 2D data like grids, tables, and images. Learn how they work, avoid common pitfalls, and write cleaner Python code with real examples.

  7. 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
  8. Article Python Fundamentals

    Python Functions for Beginners

    …tells Python you're about to define a function. It's short for "define". greet_crew is the name. The rules are the same as for variable names: lowercase letters, words joined with underscores, no…