This pull request introduces a new program prime_numbers.py that checks if a given number is prime or not. It also includes a unit test file test_prime_numbers.py to validate the functionality of the prime number checker.
Summary
Added a new file prime_numbers.py which contains a function is_prime(n) that checks if a number n is prime or not.
The is_prime(n) function uses the mathematical property that a number is prime if it has no divisors other than 1 and itself. It checks for divisibility from 2 to the square root of n.
The main() function in prime_numbers.py prompts the user to enter a number and then uses the is_prime(n) function to check if the entered number is prime or not.
Added a new file test_prime_numbers.py which contains unit tests for the is_prime(n) function.
The unit tests in test_prime_numbers.py check the functionality of is_prime(n) with both prime and non-prime numbers.
Fixes #11.
π Latest improvements to Mi6:
#
π‘ To get Mi6 to edit this pull request, you can:
Comment below, and MI6 can edit the entire PR
Comment on a file, Mi6 will only modify the commented file
Edit the original issue to get Mi6 to recreate the PR from scratch
Description
This pull request introduces a new program
prime_numbers.py
that checks if a given number is prime or not. It also includes a unit test filetest_prime_numbers.py
to validate the functionality of the prime number checker.Summary
prime_numbers.py
which contains a functionis_prime(n)
that checks if a numbern
is prime or not.is_prime(n)
function uses the mathematical property that a number is prime if it has no divisors other than 1 and itself. It checks for divisibility from 2 to the square root ofn
.main()
function inprime_numbers.py
prompts the user to enter a number and then uses theis_prime(n)
function to check if the entered number is prime or not.test_prime_numbers.py
which contains unit tests for theis_prime(n)
function.test_prime_numbers.py
check the functionality ofis_prime(n)
with both prime and non-prime numbers.Fixes #11.
π Latest improvements to Mi6:
#π‘ To get Mi6 to edit this pull request, you can: