Challenge
Paged results
…list with extend(), then fetch page after page in a while loop and stop at the first short page, the way paginated API responses are read.
Showing 11–20 of 57
Challenge
…list with extend(), then fetch page after page in a while loop and stop at the first short page, the way paginated API responses are read.
Example
While loop executes as long as condition is true. Controlling iteration with condition.
Challenge
A while loop waits for the antenna signal but never moves on to the next reading, so it never ends. Predict it, find the stuck counter, fix it, then write a wait that gives up when the readings run…
Challenge
…blocks with a list of (name, level) pairs and one loop, keeping the output exactly the same, then add a fourth tank with a single list item and list the low tanks.
Challenge
…CABIN: 101.2 kPa 09:30:10 ENG-2: 415.0 C At the top of the loop, strip the line, then continue when it's empty or starts with # . Stripping first matters: one comment is indented, and a line can hold…
Challenge
…line, and a parser has to handle every line the same way. Loop over the lines, split each one, and print what the flight controllers need. Line by line Go through the feed line by line, split each…
Article Python Fundamentals
Nested loops let you work with 2D data like grids, tables, and images. Learn how they work, avoid common pitfalls, and write cleaner Python code with real examples.
Challenge
Print each sensor name with its reading by looping over two lists together with zip(), then add a third list of units and warn when the lists don't have the same length, since zip() quietly stops at…
Article Python Fundamentals
…tells Python you're about to define a function. It's short for "define". greet_crew is the name. The rules are the same as for variable names: lowercase letters, words joined with underscores, no…
Quiz
Free Python quiz for beginners: 20 multiple-choice questions on print(), strings, lists, dictionaries, loops and functions, with instant answers.