Professional Documents
Culture Documents
Unit 7
Unit 7
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).