0
The numbers in quotes is supposed to be strings?
6 Respostas
+ 3
Yes they are for instance:
a = "4"
b = "3"
a + b = "43" # concatenation
but if you want to add rather though being strings:
c = int(a + b) # result of concatenation converted to an integer and save
in the variable c
c = int(a) + int(b) # this converts strings before adding to produce integer
c = 7 # for the two methods above
+ 1
yes
+ 1
sorry how does c=int (a+b) result in c=7? isn't it still 43? sorry I've just started python
0
yep int(a+b) =43
0
ooh thanks Nishant
0
yes sure you are right, c=int(a+b) result in c= 43 but the other results in c=7 thanks