0

How do i print string and Number

print number along with string Example : >>>x = 2 y = 3 print("Total Sum : " x + y )

30th Jan 2017, 9:19 AM
ramana
2 ответов
+ 5
Just separate the string and the number with a comma (,) E.g.: print("Total Sum : ", x + y )
30th Jan 2017, 9:30 AM
Álvaro
+ 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)
31st Jan 2017, 8:51 AM
visph
visph - avatar