Created
February 7, 2019 23:03
-
-
Save pdbartsch/679ea6e03de00114922e4cb45cb4be1a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
invar = int(input("Please enter an integer to find out whether it's prime or not: ")) | |
def prime(n): | |
divisors = [ x for x in range(1,n+1) if n % x == 0] | |
if len(divisors) == 2: | |
print('prime') | |
else: | |
print('not prime') | |
prime(invar) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment