May-19-2021, 08:55 PM
(This post was last modified: May-19-2021, 08:58 PM by Yoriz.
Edit Reason: Added code tags
)
I am doing a homework question where it's asking me to print a word backwards. So far I have the following code:
However, I'm getting an error on this line:
It's giving me a syntax error. I'm not very familiar with for loops, so I would be glad if you can help.
#My name word=str(input("Please input a word.")) def backwards_word(word): print(word) count=0 backwardsword="" for letter in range(len(word), 0, -1) backwardsword=backwardsword+word[letter] backwards_word(word)I'm trying to make it print the word backwards.
However, I'm getting an error on this line:
for letter in range(len(word), 0, -1)
It's giving me a syntax error. I'm not very familiar with for loops, so I would be glad if you can help.