Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ca388ab

Browse files
Update solution6.py
1 parent f5f6901 commit ca388ab

File tree

1 file changed

+16
-0
lines changed
  • Problem Solving in Python/01_Basic Problems/Solutions

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
string = str(input("Enter the string: "))
2+
reversedString1 = ''.join(reversed(string))
3+
reversedString2 = string[::-1]
4+
print("Original String: ", string)
5+
6+
print("------------ Using join and reversed ------------")
7+
if(string == reversedString1):
8+
print("The string is PALINDROME")
9+
else:
10+
print("The string is not PALINDROME")
11+
12+
print("------------ Using slicing ------------")
13+
if(string == reversedString2):
14+
print("The string is PALINDROME")
15+
else:
16+
print("The string is not PALINDROME")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /