fork download
  1. from math import sqrt
  2.  
  3. def isPrime(n):
  4. if n == 1: return "NIE"
  5. if n > 5 and (n % 2 == 0 or n % 3 == 0 or n % 5 == 0):
  6. return "NIE"
  7. z = [x for x in range(2,int(sqrt(n)) + 1) if n % x == 0]
  8. if not z: return "TAK"
  9. else: return "NIE"
  10.  
  11. print isPrime(7)
  12.  
  13.  
Success #stdin #stdout 0.01s 7728KB
stdin
Standard input is empty
stdout
TAK