Here is my line of code for a school project (the quadratic formula for those of you interested):
print(“x =”, answer1 " or x =", answer2)
Python explains to me that speech mark number four is considered an invalid syntax, yet I am unsure of how to solve this problem.
I would appreciate it if somebody could help me understand where I went wrong so I know for future programing.
Actually the first two are, because they’re not the
"-character, they’re some strange unicode versions supposed to look prettier in text (mark code as pre-formatted text or forum formatting will get applied to them and change the meaning. Code needs to be copied in a byte-by-byte manner (exact))
Aside from that, placing two values next to each other is almost always invalid syntax in python, perhaps that’s what the error message is about (I can’t run the code since that isn’t an exact copy)
5 7 # invalid syntax, this isn't python code
And more generally, you can remove things and and them back again one part at a time until you get the error message again (or you notice where you go wrong simply by typing it and therefore reading it)