Created
February 21, 2018 14:13
-
-
Save Hwatwasthat/88df9dd7b758678f3d36bbf9112cfb5f to your computer and use it in GitHub Desktop.
Palindrome check created by Hwatwasthat - https://repl.it/@Hwatwasthat/Palindrome-check
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
# Input from console for word to check | |
word = input("What would you like to check if its a Palindrome?") | |
#initialise variables | |
x = 0 | |
reverse_word = '' | |
# loop over word until all letters are done | |
for i in word: | |
# increment counter | |
x += 1 | |
# extend reverse_word with next letter from word (reversed) | |
reverse_word += word[len(word)-x] | |
# check for Palindrome | |
if reverse_word == word: | |
print ("its a Palindrome!") | |
else: | |
print ("its not a Palindrome") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment