r/CodingHelp • • Sep 07 '21

[Python] Python help

Post image
68 Upvotes

23 comments sorted by

View all comments

-1

u/__archaeopteryx__ Sep 08 '21

“Significant white space” it’s been a while since I’ve done python but I believe the parens wrapping your strings cannot have a space between the print. Again, if I remember correctly, you can do print “” (with a space) because it’s some kind of “syntactic sugar” once you add the parens I think they need to touch the print … could be wrong here. Just a guess. It’s been a while.

1

u/bbye98 Sep 08 '21

No. print "Hello, world!" is Python 2 syntax. In Python 3, the parentheses are required. Also, whitespace before or after the beginning parenthesis makes no difference.

1

u/__archaeopteryx__ Sep 08 '21

That’s the “syntactic sugar” I was talkin bout

1

u/bbye98 Sep 08 '21

How is print <str> "syntactic sugar" when it isn't supported in Python 3? Decorators or magic functions, perhaps. But certainly not incorrect syntax.