What's the difference between + and ,

Hello. I was confused between + and ,

It seems like their functions are the same. What’s the difference between + and ,

Thank you for your help.

If you are referring to print(), the difference is that + is string concatenation, giving a single object as the argument. When commas are used to separate arguments, they retain their data type.

print ("PI = ", 3.14)


print ("PI = " + str(3.14))
1 Like

To add onto mtf’s answer, in general, when you use commas between items like so:

a = "hello", "world"

You actually end up creating a tuple (which is like a list, but can’t be modified):

>> ("hello", "world")
1 Like