Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def saisie():
- ch=input("enter ch:")
- return ch
- def palindrome(ch):
- test=True
- i=0
- j=len(ch)-1
- while test==True and j!=0 and i!=len(ch):
- if not (ch[i].upper()==ch[j].upper()):
- test=False
- return test==True
- def tpal(ch):
- x=""
- for i in range(len(ch)):
- for j in range(len(ch)-1,0,-1):
- if palindrome(ch[i:j])==True:
- x=ch[i:j]+","+x
- return ch[:-1]
- ch=saisie()
- print("les chaines suivantes:",tpal(ch))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement