Question: Problem 3: Filtering out non-primes from the list Use filter() function and your function is_prime() from Problem 1, to construct a list that will filter

Problem 3: Filtering out non-primes from the list

Use filter() function and your function is_prime() from Problem 1, to construct a list that will filter out all non-primes out of the rand_list built in Problem 2.

Your code goes here:

In [0]:

#Your code goes here: # primes_only_list= ... 

In [0]:

#Checking (answers will vary, depending on your rand_list ): primes_only_list 

Out[0]:

[193, 331, 2791, 191, 3541, 2539, 317]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!