How? >>> int("2") + int("3") 5 and int("2"+"3")23 in ques | SoloLearn: Learn to code for FREE!

0

How? >>> int("2") + int("3") 5 and int("2"+"3")23 in ques

Help me pls

10/15/2019 8:46:15 PM

MODI GAM

13 Answers

New Answer

+7

Parenthesis first ("2"+"3") = "23" int("23") = 23

+4

>>> int("2") + int("3") = 5 Here we are first converting string to int so it will add. Because you can add integer values. >>> int("2" + "3") = 23 In this case first we concating string so here first will be "23" Then by int("23") will be 23.

+1

MODI GAM Don't spam. You already asked in question and giving same thing in answer. What is it?

+1

Jenny 🖤 Maybe on your reply because this is discussion thread not for such type of things. You should tell the solution not unusual comments.

+1

AJ || ANANT || AC || ANANY || AY oh sorry, i only started consistently using sololearn like two days ago. didnt see anywhere that you can only reply with solutions

+1

>>> int(" 2 + 3") = 23 plus be happy

0

someone really downvoted me for that i?? okay

0

It's string addition not the integer addition. For eg="2"+"3"="23". And if you want answer 5 you can do eval("2+3")="23".

-2

-2

>>> int("2") + int("3") 5

-2

>>> int("2" + "3") 23

-2

Ooo sorry i see O.o

-2

Thanks