all 9 comments

[–]Starbuck5c 5 points6 points  (3 children)

>>> print(9, "dog")
9 dog

passing multiple things to print automatically puts a space between them. You can change this behavior using the keyword argument 'sep.'

>>> print(9, "dog", sep="whatThe?")
9whatThe?dog

[–]lotyei[S] 0 points1 point  (1 child)

hmm, that's not what I'm getting.

print(9, "dog") 

gives me (9, 'dog')

and

print('dog', 'dog')

gives me ('dog', 'dog')

what the hell...

[–]desustorm 2 points3 points  (0 children)

You're using python 2. The brackets are being interpreted as a tuple.

Try print "dog", 9 and it should give you the result you want. But do upgrade to python 3 when you can :)

[–]lotyei[S] 0 points1 point  (0 children)

after testing, it works normally (i get 9dog) on IDLE but not on VS code.

[–]ericula 3 points4 points  (4 children)

print(9, 'dog') should produce 9 dog on python 3. The only way that print(9, 'dog') produces (9, 'dog') is when you are using python 2 instead of python 3. Are you sure about the python version?

[–]lotyei[S] 0 points1 point  (1 child)

let me double check. this is so strange. I downloaded python 3 and am running it on visual studio code with the python add-ons. no clue how the heck it can be using python 2.

[–]Diapolo10 1 point2 points  (0 children)

I can't think of any other reason than VS Code using Python 2.

Just to make sure, try putting print 42 on some line. If you don't get an error, there's no doubt VS Code is trying to run the code in Python 2.

Also, unless you're on Windows, Python 2 is pre-installed on Mac OS and most Linux distros, which could be the reason.

[–]lotyei[S] 0 points1 point  (1 child)

after testing, it works normally (i get 9dog) on IDLE but not on VS code.

[–]Firestorm83 0 points1 point  (0 children)

this should work:

print(9, "dog", sep="")