Challenge
Counter
Refactor the level counter from "Entries per level": replace the dict and counts.get() with collections.Counter, which starts every key at 0, then list the levels from most to least common with…
Showing 1–10 of 19
Challenge
Refactor the level counter from "Entries per level": replace the dict and counts.get() with collections.Counter, which starts every key at 0, then list the levels from most to least common with…
Challenge
Count the mission log's entries per level, INFO, WARN and ERROR, in a dict of counters, then count any level at all with get() when DEBUG lines turn up, and print the levels in alphabetical order.
Challenge
…then find the longest stretch with no station in contact, counting overlapping passes only once.
Example
Tuples have only two methods: count() for counting and index() for searching.
Challenge
…in rocket_got , and the position of the pad in the call, counting from 1, in pad_position . Modify. Pass every argument by name, keeping the pad before the rocket in the call, so you can see the order…
Example
Functions enumerate() and range() extend for loop capabilities in Python.
Example
Searching, replacing and splitting text. Advanced string manipulation methods.
Example
Accessing individual characters and text fragments. Zero-based indexing in Python.
Article Mini projects
…Two hands times three fingers gives six digits for counting. It's the same reason we use base 10 - we have ten fingers. Evolution just dealt the Eridians a different hand. Literally. It's also worth…
Challenge
…wants the mission elapsed time: how long since launch. Counting days and hours by hand across month ends goes wrong eventually, and the ground stations don't even agree on a time zone. Let the…