I tried formatting.format then got the SyntaxError: invalid syntax plz help!

formatter = “{} {} {} {}”

print(formatter.format(1, 2, 3, 4))
print(formatter.format(“one”, “two”, “three”, “four” )
print(formatter.format(True, False, False, True))
print(formatter.format(formatter, formtter, formatter, formatter))
“I have this”,
“which is you gave me.”,
“but i don’t want to use it.”,
“anyway good night.”

and the result is

File “C:/Users/Seohyeon/PycharmProjects/MyFirstProject/venv/helloworld.py”, line 5
print(formatter.format(True, False, False, True))
SyntaxError: invalid syntax

Process finished with exit code 1

i don’t know what i did wrong
please help me
thank you

also check the line above the error message line:

print(formatter.format(“one”, “two”, “three”, “four” )

see any problems?

thank you for helping me but I’m still have no idea… plz let me know the answer

I am not real knowledgeable on the .format method so i’m not sure if this is your problem, but you are missing the last ) on the line above where you are getting the error at. hope this helps!

1 Like

thank you for letting me know that ! but lind 5 is still wrong…no idea on that.

I’m not sure. If i run your code in IDLE it throws a name error on line 6 where ‘formatter is spelled formtter’ and then on the last print statement for the way the text is broken up, but that might just be the way it copied over to the forums. sorry but i think that’s all i have.

1 Like

have you checked all parentheses () are properly closed?

1 Like

thank you so much finally i found what i did wrong! i didn’t close it properly i missed “)” and line 5, i made mistake “formtter” thank you !

and that was the error where occurred, you forgot to close the one bracket