Welcome to the Treehouse Community
Looking to learn something new?
What does this error mean and how do I fix it?
SyntaxError: invalid syntax
You're probably missing a closing parentheses or a symbol in the previous lines of code.
Can you show all your code, since the error is probably happening in above lines of code?
Thank you. ~Alex
Torsten Lundahl2,570 Points
There is no reverse function for strings in the python library. If you want to print a string in reverse, you'll be better off slicing the string.
This will print the string in backwards.
If the code is part of a challange it would be nice if you could link the question to it. It makes it easier to elaborate on the problem.
There is still a syntax error pointing to print, Alexander Davison, Is they're anything else wrong?
//This is the output that I now get when I enter a word//
Put a phrase that you want reversed!! hello
Traceback (most recent call last):
File "reverse.py", line 3, in <module>
TypeError: 'NoneType' object is not subscriptable
//This is my newer code now //
def reverse(str): return str[::-1]
string = str(input("Put a phrase you want reversed!!"))