Print("2"+"3") gives 23 and int("2"+"3") gives 23 what is the difference in this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Print("2"+"3") gives 23 and int("2"+"3") gives 23 what is the difference in this

4th Aug 2018, 12:33 PM
shobbithaa shre
shobbithaa shre - avatar
8 Answers
4th Aug 2018, 5:19 PM
🌛DT🌜
🌛DT🌜 - avatar
+ 2
concatenation
4th Aug 2018, 2:05 PM
Ganota Pamno Theodore
Ganota Pamno Theodore - avatar
0
Change the numbers to letters and then run it and see what happens...
4th Aug 2018, 12:42 PM
Qwertiony
Qwertiony - avatar
0
Yea when I change numbers to letters as print("a"+"b") gives ab and when I give int("a"+"b") it gives invalid becoz it is variable and it can't convert into integer.
4th Aug 2018, 12:51 PM
shobbithaa shre
shobbithaa shre - avatar
0
shobbithaa shre , based on that knowledge, can you answer your question?
4th Aug 2018, 12:54 PM
Qwertiony
Qwertiony - avatar
0
And when we code print("2"+"3") as 23. In explanation they have given print("2"+"3") as '23' (single quote) why do they given answer in single quotation and when we code why we don't get output in single quotation as '23'
4th Aug 2018, 12:54 PM
shobbithaa shre
shobbithaa shre - avatar
0
Yea I understood that when we give print it directly gives output what we have given as input And when we give int it convert it as integer
4th Aug 2018, 12:57 PM
shobbithaa shre
shobbithaa shre - avatar
0
Thank you
4th Aug 2018, 5:25 PM
shobbithaa shre
shobbithaa shre - avatar