Challenge
Sort by a field
…date, then sort the cargo manifest heaviest first with a key function and reverse=True.
Showing 1–10 of 62
Challenge
…date, then sort the cargo manifest heaviest first with a key function and reverse=True.
Challenge
…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.
Example
Dictionaries store data as key-value pairs. Fast access to data by key.
Example
Difference between positional and keyword arguments. Flexible function calling.
Challenge
Reading launch["pad"] stops with a KeyError when the API hasn't assigned a pad yet. Predict it, check the keys with in, fix it with get() and a default, then print a list of launches with defaults for…
Example
Operator ** allows accepting any number of keyword arguments.
Challenge
…then sort names like de Vries and van Dijk correctly with key=str.lower.
Challenge
…confirm=True is passed by name: a bare * makes confirm keyword-only and required, then an is True check refuses values that are merely truthy, such as "yes".
Challenge
…line, find which parameter got which value, fix it with keyword arguments, then make calls that can't be swapped.
Example
The global keyword allows modifying a global variable inside a function.