Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def isPrime(n):
- if n<2:
- return False
- for i in range(2, n):
- if n%i==0:
- return False
- return True
- def isReverse(word):
- return word[::-1]
- def isPalindrome(word):
- return word == isReverse(word)
- lower = int(input("Enter lower limit: "))
- upper = int(input("Enter upper limit: "))
- for n in range(lower, upper):
- if isPrime(n) and isPalindrome(str(n)):
- print n, "is a palindromic prime"
Advertisement
Add Comment
Please, Sign In to add comment