Write a program that tests if a number is prime or not. Input a number from the user. The output should be ‘True’ if the number is a prime, ‘False’ otherwise.
def isPrime(x):
x = int(x)
for i in range(2, x):
if x % i == 0:
return False
return x >= 2
print(isPrime(input("Enter a prime number: ")))
Comments
Leave a comment