Quiz
Python Lists Quiz
Free beginner quiz on Python lists: 15 questions on indexing, slicing, append, insert, pop, remove, sorting and copying, with instant answers.
Showing 1–10 of 92
Quiz
Free beginner quiz on Python lists: 15 questions on indexing, slicing, append, insert, pop, remove, sorting and copying, with instant answers.
Example
Lists store multiple elements in a specific order. Basics of working with lists.
Example
When to use tuples instead of lists? Comparison of properties and applications.
Example
Methods sort() and reverse() for ordering list elements.
Challenge
…remembers samples from earlier calls, because the default list is created once and shared. Predict it, prove the calls share one list, fix it with None as the default, then write a function that hands…
Challenge
add_reading() appends to the list it receives, so the caller's stored readings change too. Predict the first line, prove both names share one list, fix it by returning a new list, then write a filter…
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…
Challenge
…add_sample() that would have caught the shared default list, then add checks that a log passed in is still the one that gets the sample, so a "fix" that breaks that can't pass either.
Challenge
…the rocket is a dict of its own, and the mission holds a list of patch images. The public launch page shows the rocket and the mission patch. Dig the two values out of the nested response, then make…
Example
Accessing list elements by index. Changing and removing elements.