- 3

Why is it that when I do ('2' + '2') it gives me 22

4th Oct 2021, 8:32 PM
David
6 ответов
+ 4
Because using quotation marks means you're dealing with strings, not numbers.
4th Oct 2021, 8:44 PM
Simon Sauter
Simon Sauter - avatar
+ 3
Concatenation Python for Beginners Tutorial 11.1
4th Oct 2021, 11:01 PM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
At least this isn't happening in C or C++
5th Oct 2021, 1:22 AM
‎وائل عبد الحق‎
‎وائل عبد الحق‎ - avatar
0
Just add
4th Oct 2021, 8:36 PM
David
0
Share your code
4th Oct 2021, 8:37 PM
Msawenkosi Zuma
0
David, It's because of the quotation marks, they imply that you're working with strings and not numbers. To get the correct answer, get rid of the quotations
6th Oct 2021, 7:02 AM
Oluwaseyi Ayomide