Created
April 24, 2020 07:32
-
-
Save computer-tutor/840053f2dbfb8dede02ca03379ec1621 to your computer and use it in GitHub Desktop.
Chapter 6] Q1
This file contains 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
def prime(n, i=2): | |
if(n<=2): | |
return True if(n==2) else False | |
if(n%i==0): | |
return False | |
if(i*i>n): | |
return True | |
return prime(n,i+1) | |
print(prime(15)) | |
print(prime(25)) | |
print(prime(23)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment