Challenge
Missing field
…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 any missing field.
Showing 1–10 of 32
Challenge
…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 any missing field.
Challenge
…each category into a dict with totals[category] = totals.get(category, 0) + mass, then list the categories from heaviest to lightest with their share of the load.
Challenge
…and the Moon to surface gravity with a dict and one get() lookup, keeping the output exactly the same, then loop over the dict for a weight table.
Challenge
…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
…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 most_common().
Challenge
Divide a distance by the speed of light to get the radio delay to a Mars orbiter, show it in whole minutes and seconds, then add the round trip without doubling a rounding error.
Challenge
…module logs. Give this code its own logger, log = logging.getLogger("fuel") , log through it, and add its name to the format with %(name)s . Switch on debug records for this logger only with…
Challenge
…3. Arm the abort system 4. Switch to internal power 5. Get a go from Mission Control enumerate(checklist, start=1) gives pairs of a number and an item. Unpack them in the loop: for number, item in…
Challenge
…timestamp with datetime.fromisoformat(), subtract them to get the mission elapsed time, then time events reported by ground stations in three different time zones.
Challenge
…then add checks that a log passed in is still the one that gets the sample, so a "fix" that breaks that can't pass either.