Python please prime_test.py: def is_prime(num): #ADD CODE to return True if num is prime; False if not def main(): #ADD CODE to call is_prime() for integers 1-100 # and print the ones that are prime main()
Python please prime_test.py: def is_prime(num): #ADD CODE to return True if num is prime; False if not def main(): #ADD CODE to call is_prime() for integers 1-100 # and print the ones that are prime main()
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
Python please
prime_test.py:
def is_prime(num):
#ADD CODE to return True if num is prime; False if not
def main():
#ADD CODE to call is_prime() for integers 1-100
# and print the ones that are prime
main()

Transcribed Image Text:Prime numbers: A prime number is a number that is evenly divisible only by itself and
one. For example, 3 is a prime becuase it can only be evenly divided by 1 and 3. The
number 4 is not prime because it can be divided evenly by 2. Twenty-one (21) is not prime
because it can be divided evenly by 3 and 7. The first five prime numbers are: 2,3,5,7,11
Starting with the provided starter-file prime_test.py, write a function is_prime() that
takes an interget argument and returns True if the interger is prime, False otherwise.
It does not print anything(Note: You can have is prime() print things while you are
developing it and debugging it. But deleteing or comment_out print statements in this
function before submitting your code.)
Write a main() function that displays a list of prime numbers between 1 and 100
inclusive, as shown below. It calls is_prime(n) to determine if an interget is prime. It
should also write then same output to an output file primes.txt.Everytime it runs, the
program should replace whatever was in the output file.
Example:
The prime numbers from 1 to 100 are:
2
3'
7
11
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 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