Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What is the result of adding the lists [1, 2] and [3, 4] using the method taught?
Add corresponding elements.
What is a list comprehension in Python?
Think about how you can create a new list using existing lists.
What does the zip function do?
What happens when you have two lists?
True or False: List comprehension can only be used with numbers.
Think about what types you can iterate over.
Create a program that takes two lists and sums them, returning a new list. The program should handle lists of unequal lengths by appending None for missing elements.
Consider using `itertools.zip_longest` for padding shorter lists.
Discuss how you would adjust your list addition program to work with non-numeric data. What changes would you need to make?
Think about what data types you are adding.
5 more questions in this section. Enroll free to practise them all.
Enroll free