+ 2
Why is the answer '22'
>>> "2" + "2" '22'
9 Answers
+ 4
You're more than welcome Stephen! Don't give up and be patient with programming. Trust me, ALL of us went through this process also, and it's certainly confusing/difficult in the beginning. However, just like most things that are worth it in life, if you stick with it and practice, you'll become great at it, but just remember that it does take time. It's similar to learning how to play an instrument. At first you're clunky and the notes/theory/etc... doesn't make sense. The more you practice though, the more effortless it becomes and the more you understand. Eventually, you're able to play music easily and are able to hear music & break it down easily.
+ 6
Because they're strings, not integers. You're just concat'ing two strings together.
2 and "2" are two different things. One is an actual integer number, and the other is just a string of text that happens to have a number in it, but is not treated as a number.
+ 6
The quotes is what is making that a string instead of an integer.
>>>> 2 + 2
4
>>>> "2" + "2"
22
+ 5
(I dont know python but I'm guesz )
you write the number as string :)
+ 3
so how are you gonna differentiate between integers and strings
+ 3
thank you very much netkos ent
am a beginner and am finding things very hard
+ 3
It's my pleasure Stephen. I really do wish you the best of luck and hope it goes as smooth as possible! :)
As an added note, bookmark this site: www.stackoverflow.com
During my learning process, and even during my career, that site has been priceless when I've ran into issues and couldn't figure it out myself. If you've attempted to try something to no avail, it never hurts to consult the programmers of the world. We're all a team.
+ 1
thank you my hero
0
thank you very much netkos
I really appreciate your aid and hospitality