Skip to content

Commit c134283

Browse files
author
avais umar
committed
Using slicing technique checking for palindrome
1 parent cb01de4 commit c134283

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Palindrome_Checker.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
2-
3-
41
"""
52
63
A simple method is , to reverse the string and and compare with original string.
74
If both are same that's means string is palindrome otherwise else.
85
"""
9-
phrase=input()
10-
if phrase==phrase[::-1]:#slicing technique
6+
phrase = input()
7+
if phrase == phrase[::-1]: # slicing technique
118
"""phrase[::-1] this code is for reverse a string very smartly """
12-
9+
1310
print("\n Wow!, The phrase is a Palindrome!")
1411
else:
1512
print("\n Sorry, The given phrase is not a Palindrome.")

0 commit comments

Comments
 (0)