Skip to content

Commit 62b959e

Browse files
authored
Create PallindromeString.py
Given a string, write a python function to check if it is palindrome or not. A string is said to be palindrome if reverse of the string is same as string. For example, “radar” is palindrome, but “radix” is not palindrome
1 parent baa73e6 commit 62b959e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

PallindromeString.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
def reverse(s):
2+
return s[::-1]
3+
4+
def isPalindrome(s):
5+
6+
rev = reverse(s)
7+
8+
if (s == rev):
9+
return True
10+
return False
11+
12+
13+
s = "malayalam"
14+
ans = isPalindrome(s)
15+
16+
if ans == 1:
17+
print("Yes")
18+
else:
19+
print("No")

0 commit comments

Comments
 (0)