Challenge
Swapped arguments
A call to schedule_launch() passes the pad where the rocket belongs, and the board says a launch pad is flying. Predict the line, find which parameter got which value, fix it with keyword arguments…
Showing 41–50 of 56
Challenge
A call to schedule_launch() passes the pad where the rocket belongs, and the board says a launch pad is flying. Predict the line, find which parameter got which value, fix it with keyword arguments…
Quiz
Free beginner quiz on Python while loops: 15 questions on conditions, counters, infinite loops, break and continue, with instant answers.
Example
Namespaces isolate variables. Modules and functions create their own namespaces.
Example
Adding and removing elements from list. Methods append, insert, pop and remove.
Challenge
…832 N Uranus: 805 N Neptune: 1018 N Loop over GRAVITY_M_S2.items() ; the weight is the mass times the gravity.
Challenge
The manifest changes every day as items are packed and unpacked. The loading supervisor doesn't want to read both lists side by side: she wants to know what changed. Work out what was added and what…
Quiz
…keyword arguments with get() and looping over them with items() Unpacking a tuple, a string or a dictionary into a call with * and ** Passing *args and **kwargs on to another function How it works 15…
Quiz
…, pop() and del Looping with keys() , values() and items() Counting with a dictionary, lists inside dictionaries and nested dictionaries How it works 15 questions: 11 with one correct answer, 4 where…
Quiz
…code runs? What does this code print? Which type keeps its items in order and lets you add, remove and change them? Which of these create a dict ? What does this code print? What does this code print?…
Article Python Fundamentals
…= False Complex Data Types Lists Ordered collections of items, great for storing sequences of data: planet_names = ["Mercury", "Venus", "Earth", "Mars"] temperatures = [167, 464, 15, -63] # Average…