Results for “for”

Showing 41–50 of 202

  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

    Parse the whole feed

    Go through a block of telemetry line by line with splitlines(), split each line at the commas and print the sensor and value, then unpack the four fields and show the clock time too.

    Write the code Easy 2 stages for loop splitlines split unpacking
  3. Challenge

    Validate a command

    …in any case with an if/elif chain, print Unknown command for anything else, then handle empty input and show what was typed.

    Write the code Easy 2 stages if elif else input
  4. Challenge

    Command parser

    …mode safe into tuples and raises ValueError with a reason for anything malformed, then run a whole batch of commands and report each one.

    Write the code Medium 2 stages project parsing strings split
  5. Challenge

    Manifest validator

    The logistics team typed the manifest for the next supply flight by hand, and the loading crew won't touch a crate until every line checks out. Last time, a typo in a mass sent a 61 kg battery pack to…

    Write the code Medium 2 stages project validation dictionaries functions
  6. Challenge

    Edge cases

    Write assert checks for mean(): an ordinary list and a list with one value first, then the edge cases, an empty list that should give None and lists with negative values, so broken copies of the…

    Write the code Medium 2 stages testing assert edge cases None
  7. 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
  8. Challenge

    Sorted copy

    Print the roster A–Z for a report with sorted() while the sign-up order stays exactly as it was, then sort names like de Vries and van Dijk correctly with key=str.lower.

    Write the code Easy 2 stages lists sorted sort key
  9. Challenge

    Alert level

    …the exact boundaries, then store the level in a variable for a status line.

    Write the code Easy 2 stages if elif else comparisons