+ 4

How do we concat an int to a string here?

13th Feb 2019, 7:06 PM
Sahil Bisht
Sahil Bisht - avatar
3 Réponses
+ 7
To string: number=50 you can use str(number) To int: word="50" You can use int(word)
13th Feb 2019, 7:25 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 3
You can convert the integer into a string (with the str() function) and then concat the 2 strings. For example: string = "Python" integer = 3 print(string + str(integer)) # "Python3"
13th Feb 2019, 7:25 PM
giannismach
giannismach - avatar
+ 2
You can type cast..... For example.... Str("2")+str("2") O/p.....22
14th Feb 2019, 4:02 AM
Thanigai Velan
Thanigai Velan - avatar