Challenge
Nested response
…the rocket's name and the first mission 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.
Showing 1–10 of 14
Challenge
…the rocket's name and the first mission 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
Dictionaries can contain other dictionaries. Useful for complex data structures.
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
Refactor a docking check built from three nested ifs into one condition joined with and, keeping the output exactly the same, then rewrite it as a flat if/elif chain that reports the first check that…
Example
The nonlocal keyword gives access to variables in the enclosing function.
Quiz
…on keys and values, get(), in, pop(), update(), loops and nested dictionaries. Instant answers.
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
Build the station's weekly shift rota: three shifts a day, the crew taken in turn so nobody works two shifts in a row, with a check that proves it, then plan around days off while keeping the work…
Quiz
…global variables, the global and nonlocal keywords, and nested functions.
Quiz
…packing and unpacking, count(), index(), slicing and nested tuples. Instant answers.