Appending a Integer to a string using '+' | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Appending a Integer to a string using '+'

Hi, I understand a String cannot be appended to a integer and form another integer using '+'. One of the examples says it is not possible to append an integer to a string as well by using '+'. Is this correct.? I think this should be possible. Please correct me if I'm wrong.

13th Jul 2016, 4:02 AM
Sachin S Rao
Sachin S Rao - avatar
3 Answers
+ 2
you are right we can't concatinate string with integer for example print("Hi"+5) will throw error but you can achieve this by the following syntax print("Hi",5) this will concatinate both. please check this and let me know if you understand the concept
13th Jul 2016, 5:57 AM
sundar
sundar - avatar
0
Hi Sundar.! Yes.! Your answer clears my doubts.! Many Thanks.!
13th Jul 2016, 6:08 PM
Sachin S Rao
Sachin S Rao - avatar
0
Welcome buddy :-)
13th Jul 2016, 6:10 PM
sundar
sundar - avatar