Results for “and”

Showing 141–150 of 233

  1. Challenge

    Safe number input

    The burn length is typed in by hand, and a typo stops the program with a ValueError. Catch it with try and except, keep asking until the input is a number, then also turn away zero and negative…

    Write the code Easy 2 stages errors try except ValueError
  2. Challenge

    Survive bad lines

    Extend the feed parser from "Skip blanks and comments": a faulty sensor sends ERR and float() stops the program. Skip lines that fail to convert and count them, then let one try cover short lines too…

    Write the code Medium 2 stages errors try except ValueError
  3. Challenge

    Prove the fix

    …fixed? Six months from now someone will tidy the function, and log=[] looks so much simpler than the None check. Write the test that proves the fix: it has to pass now and fail on the old code. The…

    Write the code Medium 2 stages testing assert regression tests default values
  4. Challenge

    Copy-pasted blocks

    …tank-status 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
  5. Challenge

    Names with values

    …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 the shortest.

    Write the code Easy 2 stages for loop zip lists unpacking