Example
Nested Dictionaries
Dictionaries can contain other dictionaries. Useful for complex data structures.
Showing 41–47 of 47
Example
Dictionaries can contain other dictionaries. Useful for complex data structures.
Challenge
…if fuel_needed(-5) raises ValueError : call it in try , set a variable to True in except ValueError: , and assert it after. Then print: All checks passed Leave the function as it is. The hidden tests…
Challenge
…for the next manoeuvre. One morning the keyboard was set to a Polish layout, 12,5 went in instead of 12.5 , and the whole console program stopped with a ValueError . Make it ask again instead, for as…
Challenge
…CRITICAL 399.9 °C: OK Readings: 6, WARN: 2, CRITICAL: 2 Set warn_count = 0 and critical_count = 0 before the loop, add 1 to the right one inside the WARN and CRITICAL branches, and print the summary…
Example
Combining regular parameters, *args and **kwargs in one function.
Example
For loop iterates through sequence elements. Basic iteration over lists.
Challenge
…As the Earth turns, the spacecraft rises over one and sets behind another, so the scheduler picks the station by the longitude on Earth right under the spacecraft. Pick the station from the longitude…