Answers for "easy way to find prime with python"

6

primes in python

from math import sqrt
for i in range(2, int(sqrt(num)) + 1):
    if num % i == 0:
        print("Not Prime")
        break
    print("Prime")

# Note: Use this if your num is big (ex. 10000 or bigger) for efficiency
# The result is still the same if the num is smaller
Posted by: Guest on August-13-2021
4

get prime number python

from num_tool import is_prime
print(is_prime(3))

#returns True because 3 is a prime
Posted by: Guest on September-13-2021

Code answers related to "easy way to find prime with python"

Python Answers by Framework

Browse Popular Code Answers by Language