Challenge
Sign-up cleanup
Clean the crew sign-ups for the analogue mission: trim and capitalise names, lower-case emails, then reject sign-ups with no name or a broken email and drop duplicates by email, saying why for each…
Showing 61–70 of 78
Challenge
Clean the crew sign-ups for the analogue mission: trim and capitalise names, lower-case emails, then reject sign-ups with no name or a broken email and drop duplicates by email, saying why for each…
Challenge
Extend format_log() from "Log formatter function" with **fields, so any extra keyword arguments are added to the line as key=value pairs, then pass whole dicts of fields into it with ** at the call.
Challenge
Give send_command(cmd, retries=3, timeout=5.0) default values so callers only pass what differs, call it three different ways, then add a new priority parameter without breaking any existing call.
Example
Functions group code for reuse. Defining functions with def keyword.
Challenge
Print the name, provider and status of a launch from a dict shaped like a launch-API response, then list every field the response has with items(), the way you'd inspect an API you haven't used…
Example
Docstrings describe what a function does. Good programming practice.
Example
Parameters can have default values. Used when argument is not provided.
Example
Parameters allow passing data to functions. Functions become more flexible.
Challenge
…frequency: INFO: 4 WARN: 3 DEBUG: 2 ERROR: 1 most_common() returns a list of (level, count) pairs, so the loop can unpack each one.
Example
The nonlocal keyword gives access to variables in the enclosing function.