Comma at the end is supposed to keep letters together on the same line???

I am going through a tutorial that states

Include a comma after the character to be printed in order to ensure it's not printed on its own line, like so:

if c == "A" or c == "a":
    print "X",


This doesn't seem to work in the pycharm console, or am I doing something in error?

1 comment
Comment actions Permalink

I do not believe that example will work in console (pycharm or python).  This is because the act of hitting enter automatically creates a newline in console.  If you were to put that snippet into a function, it should be come apparent.

def foo():
    print "x",
    print "something"


Please sign in to leave a comment.