Can anyone explain why its printing failed
? word
is a string but it keeps jumping to the else
.
word = input("Enter a word.. ")
word_length = len(word)
first_letter = word[0]
last_letter = word[word_length-1]
if word == str:
print(last_letter + word[1 : word_length-1] + first_letter)
else:
print("failed")