Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Unit 7 Quiz

1. I can append more than one element to a list at a time using


append() function.
A. True
B. False
2. Lists are mutable (can be changed).
A. True
B. False
3. Printing range(0,10,2) will get me..
A. 2, 4, 6, 8, 10
B. 0, 2, 4, 6, 8, 10
C. 0, 2, 4, 6, 8
4. I can join two lists using + sign. So [1,2,3] + [4,5,6] will give
me [1,2,3,4,5,6].
A. True
B. False
5. A list cannot another list within itself. So [[1,2], [3,4]] for
example.
A. True
B. False

Unit 7 Exercises
Create a list containing at least three numbers. Then write a function
that will multiply each element in the list by two and print the changed
list. So entering [1,2,3] as input will print [1,4,9].
Create a list containing at least five numbers. Then write a function
that prints only even numbers in the list. (Hint: use % operator to
check for even numbers)
Create a function that accepts two lists containing integers as
parameters. If the two lists have any numbers in common, return True.
Otherwise, return False. (Hint: This one is tricky. Try using a for loop
within another for loop. AKA loop through one of the lists and for each
element, loop through the other list and compare to see if this element
equals any of the integers in the other list).

You might also like