There are two modes when a cell is highlighted.
lst = [20, 1, -34, 40, -8, 60, 1, 3]evaluate the following expressions. Write your answers in markdown first then use code to verify your answer.¶
1) Then use a for loop to append to the list the multiples of 3 from 12 to 2340. Print out the length of this list.
2) Redo part 1) of this problem but use list comprehensions instead of a for loop.
3) Use list comprehension as in part 2) but add in the additional condition that the numbers need to be a multiple of 7.
range()function to create a list of even numbers from 2 to 50.¶
n. Use list comprehension to create a list
factorswhich is a list of factors of
n? (Pretty cool!)¶
[x for x in range(2, n) if n % x == 0] == 
One sample output:
Mike 2.3 John 3.5 Michele 3.7 Carol 3.2