Results for “return”

Showing 11–20 of 78

  1. Challenge

    Log formatter function

    …f-string into format_log(t, level, msg), a function that returns the line instead of printing it, then fix the alignment of every log line with one change inside the function.

    Fix the code Easy 2 stages functions def return refactoring
  2. Challenge

    Validate a cargo record

    Write validate_cargo(item), which returns a list of everything wrong with a cargo record: missing fields and a negative mass, then a cargo ID that doesn't match the CG- and four digits format. An…

    Write the code Medium 2 stages functions return lists validation
  3. Challenge

    sort() returns None

    …what crew.sort() gives back and store it, as text, in sort_returns . Then sort on a line of its own, print crew[0] , and store that name in first_after_sort . Remove any lines you added before you…

    Fix the code Easy 3 stages lists sort None in place
  4. Challenge

    Extract a function

    …calculation into a function distance_km(a, b) that returns the distance between two (x, y, z) points, and use it for all three waypoints. The output must stay exactly the same: To waypoint A: 193.0 km…

    Fix the code Easy 2 stages functions refactoring return tuples
  5. Article Python Fundamentals

    Python Functions for Beginners

    …to write your own Python functions, from your first def to return values, default parameters and scope, with runnable examples, common mistakes and six practice projects.