Skip to content

Instantly share code, notes, and snippets.

@DorukUlucay
Last active May 28, 2018 06:36
Show Gist options
  • Save DorukUlucay/3656c1c2e493f7ebe27b4d9cc1e181dd to your computer and use it in GitHub Desktop.
Save DorukUlucay/3656c1c2e493f7ebe27b4d9cc1e181dd to your computer and use it in GitHub Desktop.
Python For-Else
# https://pyfiddle.io/fiddle/f479b511-7645-4a66-a434-be7a829f015d/?i=true
def isPrime(n):
for i in range(2,n):
if(n % i == 0):
print("asal degil")
break
else:
print("asal")
isPrime(9) # asal degil
isPrime(11) # asal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment