A prime number is an integer value that is only divisible by 1 and itself. 2, 3, 5, 7, and 11 are examples of prime numbers. You have been provided with two function definitions: The is_prime () function takes an integer parameter number, and returns True if number is prime and False otherwise. The get_next_prime () function also takes a single integer parameter number, and returns the first prime number larger than it. You must not change the implementation of these 2 functions. Complete the get_primes_list() function that takes a single list of integers called numbers as parameter. You can assume that the integer items in this list will be non-negative. The function must update this list so that items that are not prime numbers are updated to the first prime number larger than them. To implement this function you must call both the is_prime () and get_next_prime () functions. Some examples of the function being called are shown below. Note: the get_primes_list() function does not create a new list or return a value. It simply updates the parameter list. For example: Test numbers = [1, 2, 3, 4, 5, 6, 7] get_primes_list(numbers) Result Primes list: [2, 2, 3, 5, 5, 7, 7] print("Primes list:", numbers) numbers [20, 19, 16, 17, 16, 15, 14, 13, 12, 11, 10] Primes list: [23, 19, 19, 17, 17, 17, 17, 13, 13, 11, 11] get_primes list (numbers) print("Primes list:", numbers)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
A prime number is an integer value that is only divisible by 1 and itself. 2, 3, 5, 7, and 11 are examples of prime numbers. You have been provided with
two function definitions:
The is_prime () function takes an integer parameter number, and returns True if number is prime and False otherwise. The
get_next_prime () function also takes a single integer parameter number, and returns the first prime number larger than it. You must not
change the implementation of these 2 functions.
Complete the get_primes_list() function that takes a single list of integers called numbers as parameter. You can assume that the integer
items in this list will be non-negative. The function must update this list so that items that are not prime numbers are updated to the first prime number
larger than them. To implement this function you must call both the is_prime () and get_next_prime () functions. Some examples of the
function being called are shown below.
Note: the get_primes_list() function does not create a new list or return a value. It simply updates the parameter list.
For example:
Test
numbers [1, 2, 3, 4, 5, 6, 7]
get_primes_list(numbers)
Result
Primes list: [2, 2, 3, 5, 5, 7, 7]
print("Primes list:", numbers)
numbers [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10] Primes list: [23, 19, 19, 17, 17, 17, 17, 13, 13, 11, 11]
get_primes list (numbers)
print("Prises list:", numbers)
Transcribed Image Text:A prime number is an integer value that is only divisible by 1 and itself. 2, 3, 5, 7, and 11 are examples of prime numbers. You have been provided with two function definitions: The is_prime () function takes an integer parameter number, and returns True if number is prime and False otherwise. The get_next_prime () function also takes a single integer parameter number, and returns the first prime number larger than it. You must not change the implementation of these 2 functions. Complete the get_primes_list() function that takes a single list of integers called numbers as parameter. You can assume that the integer items in this list will be non-negative. The function must update this list so that items that are not prime numbers are updated to the first prime number larger than them. To implement this function you must call both the is_prime () and get_next_prime () functions. Some examples of the function being called are shown below. Note: the get_primes_list() function does not create a new list or return a value. It simply updates the parameter list. For example: Test numbers [1, 2, 3, 4, 5, 6, 7] get_primes_list(numbers) Result Primes list: [2, 2, 3, 5, 5, 7, 7] print("Primes list:", numbers) numbers [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10] Primes list: [23, 19, 19, 17, 17, 17, 17, 13, 13, 11, 11] get_primes list (numbers) print("Prises list:", numbers)
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY