Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / PrimeNum

PrimeNum

Computer Science

PrimeNum.py 

please help me to write program that displays all of the prime numbers from 1 through 10. The program should have a loop that calls the is_prime function.

Hints:

Define main ():

Declare local variables under main() program

For each number, print whether or not it is prime.

           Write for loop, use range function to loop through the total numbers.

               Call is_prime function 

               print if the number is prime or not prime

        Define is_prime function, 'def is_prime(number):'

            The is_prime function receives a number as an argument, and returns True if number is prime, False otherwise. 

Sample Output:

number      is prime
------------------------
1      not prime
2      prime
3      prime
4      not prime
5      prime
6      not prime
7      prime
8      not prime
9      not prime
10      not prime

(Please use python)

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE