Ask coding questions

← Back to all posts
how am i able to concatenate strings and integers here ??
Iamvik98 (1)

it is said that u cannot cancatenate strings and integers in python but in the program below i have the same without any error using the "input function". Can anyone help me with this ? how am i able to concatenate two different data types here ??
i am referring to the last block of code !

Answered by InvisibleOne (3224) [earned 5 cycles]
View Answer
InvisibleOne (3224)

Input returns a string, which is why your code doesn't give you a bug

ruiwenge2 (1191)

to concatenate strings and integers, use the string function:

"hello" + str(10)