Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Thu Nov 19 20:43:52 2020
- @author: Sergey
- """
- def is_palindrom(a):
- if len(a)%2==0:
- b=int(len(a)/2)
- else:
- b=int((len(a)/2)+1)
- c=0
- for i in range(b):
- if a[i]==a[-i-1]:
- c+=1
- if c != b:
- return False
- else:
- return True
- a = int(input())
- a=str(a)
- if is_palindrom(a):
- print('Является палиндромом')
- else:
- while not is_palindrom(a):
- a=int(a)
- a+=1
- a=str(a)
- print(a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement