Please is it possible to add int or float to string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please is it possible to add int or float to string

int +str

9th Jan 2018, 9:56 PM
abdulateef akinola
abdulateef akinola - avatar
2 Answers
+ 2
string = text + str(intVariable) + str(floatVariable)
9th Jan 2018, 9:57 PM
Jeremy
Jeremy - avatar
+ 1
Depending on which answer you want int(), float(), and str() will convert a value of the other two to the corresponding type. i = int("45")+5 #i=50 s = "45"+str(5) #s="455"
9th Jan 2018, 11:16 PM
John Wells
John Wells - avatar