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)
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)
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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)](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fe65db211-a834-48fa-9a9d-c4296262ab17%2Fbcdc75ed-e7fe-4130-84c7-400ac5e313e5%2Fpc8kjck_processed.jpeg&w=3840&q=75)
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education