Last active
November 30, 2017 06:16
-
-
Save azdafirmansyah/d10a903762c19bec367c1f6ad764a44b to your computer and use it in GitHub Desktop.
String List Reverse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Exercise URL : http://www.practicepython.org/exercise/2014/03/12/06-string-lists.html | |
''' | |
Ask the user for a string and print out whether this string is a palindrome or not. | |
(A palindrome is a string that reads the same forwards and backwards.) | |
''' | |
data = str(input("Input your word : \n > ")) | |
temp = "" | |
for i in range(len(data)): | |
temp += data[(len(data)-1)-i] | |
print("Original Word : ",data) | |
print("Reverse Word : ",temp) | |
if data == temp: | |
print("Same Word") | |
else: | |
print("Different Word") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment