blob: e4d4da4dc0c537febcb0d1ec7bad1511c2d6b91b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def next_palindrome(n):
while True:
n += 1
if str(n) == str(n)[::-1]:
return n
# Test
print(next_palindrome(1234)) # Output: 1331
|