import math
# A function to test if a number is prime, takes an integer and returns a
# boolean.
def isPrime(n):
if n < 2:
return False
# Try dividing by all numbers from 2 to sqrt(n).
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
return False
# If we get here, we didn't find a factor, so n is prime.
return True
# Main program starts here.
name = input("What is your name? ")
print("Hello, {}!".format(name))
number = int(input("What is your favorite number? "))
print("Your favorite number is {}".format(number), end='')
if isPrime(number):
print(", and that's a prime number!")
else:
print(". It's not a prime number, but that's okay!")