Challenge
Extra log fields
…and nobody wants a format_log() with fifty optional parameters. Let the function take whatever fields the caller has, then feed it fields from dicts. **fields Let format_log() take any extra keyword…
Showing 21–26 of 26
Challenge
…and nobody wants a format_log() with fifty optional parameters. Let the function take whatever fields the caller has, then feed it fields from dicts. **fields Let format_log() take any extra keyword…
Quiz
…dictionaries , type conversion and functions with parameters . To review whole topics, try the Python Lists Quiz or the Python Dictionaries Quiz .
Quiz
…the function: a tuple and a dictionary Mixing regular parameters, *args , default values and **kwargs in one function Reading keyword arguments with get() and looping over them with items() Unpacking…
Quiz
…and mixing text with numbers Line breaks, the sep and end parameters and flush=True f-string formatting: decimal places, thousands separators and {name=} for debugging How it works 15 questions: 11…
Challenge
…. Modify. Pass the count into the function as a second parameter, return the new count, and store it at each call, without global . It must print: Lumen-3 launched, 1 today Tern-5 launched, 2 today…
Challenge
…level, msg): , with return f"..." inside, using its own parameter names. Then print(format_log(elapsed, level, message)) . One change for every line The function is now used for a whole orbit's…