20 lines
397 B
Python
Executable file
20 lines
397 B
Python
Executable file
#!/usr/bin/env python
|
|
|
|
"""Vérifie si un mot est palidrome"""
|
|
|
|
|
|
def main() -> None:
|
|
print(EstPalindrome("aziza"))
|
|
print(EstPalindrome("alga"))
|
|
|
|
def EstPalindrome(Mot : str) -> bool:
|
|
if Mot[0] != Mot[-1]:
|
|
return False
|
|
elif len(Mot) < 2: # vrai pour 0 ou 1 lettre
|
|
return True
|
|
else:
|
|
return EstPalindrome(Mot[1:-1])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|