0

How to concat string and numbers in Python (eg.In c++ >> cout>>"There are" + 3 + "Apples")

https://code.sololearn.com/ce7xd0002aPk/?ref=app

13th Oct 2017, 3:05 PM
Stephen
Stephen - avatar
2 Answers
0
3 is a int type.. rest are string... put 3 in quotes... ' 3 '
13th Oct 2017, 3:20 PM
sayan chandra
sayan chandra - avatar
0
Sayan is correct, you could also cast the integer to a string. print("I have " + str(3) + " apples")
13th Oct 2017, 3:56 PM
Nic