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...


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()


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

Extracted 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

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here