0
How do i print string and Number
print number along with string Example : >>>x = 2 y = 3 print("Total Sum : " x + y )
2 Réponses
+ 5
Just separate the string and the number with a comma (,)
E.g.: print("Total Sum : ", x + y )
+ 2
you can cast your result to string, and concatenate it:
print("Total Sum : "+str(x+y))
Not especially more usefull for print() function, but can handle assignements:
mystr="Total Sum :"+str(x+y)