Challenge
Counter
…counts.get() with collections.Counter, which starts every key at 0, then list the levels from most to least common with most_common().
Showing 31–40 of 62
Challenge
…counts.get() with collections.Counter, which starts every key at 0, then list the levels from most to least common with most_common().
Challenge
Print only the launches whose status is Go from a list of launch dicts, then collect the others with their status into one "not go yet" line, or none.
Challenge
…for every record in a list of dicts, reading each field by key, then add up the masses in the same loop for a total line.
Challenge
…the parsed datetime, works for the comparison and as the key for sorted() . strftime("%Y-%m-%d %H:%M") formats a datetime. Time left, and holds Add the time left to each launch, as days, hours and…
Article Mini projects
…we launch into the unknown, we need to understand two key components: The Python random module - our cosmic dice Our solar system data - our possible destinations Let's start by importing our space…
Example
Adding, changing and removing dictionary elements in Python.
Challenge
…patch URL from a nested launch response by chaining keys and indexes, then add the operator and orbit and cope with a launch that has no patches yet.
Example
The nonlocal keyword gives access to variables in the enclosing function.
Example
Functions group code for reuse. Defining functions with def keyword.
Example
Combining regular parameters, *args and **kwargs in one function.