+ 3
which method is best?
which 'str+int' printing method is best? print ("sum is: "+str(10)) print ("sum is:",10) print ("sum is: {0}".format (10))
2 Answers
+ 10
I think it's the second one because it's the shortest. Doesn't really matter that much.
+ 6
All the methods show same thing so it's your choice.
If I would write this, then i will use first option as my habit to write this, it seems easy, and here 10 is converted to string and then displayed.