Challenge
Countdown with holds
…, the countdown ends like this: T-5 T-4 SCRUB at T-4 Check for the scrub before the hold, break after the scrub line, and use a flag to decide about Liftoff! after the loop.
Showing 21–30 of 57
Challenge
…, the countdown ends like this: T-5 T-4 SCRUB at T-4 Check for the scrub before the hold, break after the scrub line, and use a flag to decide about Liftoff! after the loop.
Challenge
…gives pairs of a number and an item. Unpack them in the loop: for number, item in enumerate(checklist, start=1): . Done or not yet The crew has done the first two items. Add completed = 2 under the…
Challenge
…a dead link doesn't block everything else. Write the retry loop against a simulator that plays back the radio's replies, then space the attempts out. Up to three tries Try up to MAX_ATTEMPTS times…
Article Python Fundamentals
…and these two books consistently deliver results - though for very different reasons. Let's see which learning style matches yours.
Example
Looping through keys, values or key-value pairs of a dictionary.
Challenge
Scan a radar grid stored as a list of strings with a loop inside a loop, print the row and column of every # with enumerate(), then turn the loops around to find the columns that are clear all the way…
Challenge
…which returns the record dict, then let it return None for blank, comment and damaged lines so the loop only keeps real records.
Quiz
…questions on keys and values, get(), in, pop(), update(), loops and nested dictionaries. Instant answers.
Challenge
…In turn Build rota , a list of (day, shift, name) tuples for every shift of the week, in order, taking the crew in turn. Print one line per day, then count how many times one person works two shifts…
Challenge
…get() lookup, keeping the output exactly the same, then loop over the dict for a weight table.