0
What is the answer if x=a x+=3
2 Antwoorden
+ 1
x+=3 means x=x+3 so:
x=a
x=a+3
0
you ll get an error
i ll explain:
x = a #without ' ' it s considered a variable
so x += 3 will give an error saying 'a' variable not defined
in the case you meant x = 'a'
you ll get an error again!
i ll explain:
x *= 3 means x = x * 3
so with x = 'a' we have x = 'a' * 3 which is >> aaa
x += 3 means x = x + 3
with x = 'a' >> x = 'a' + 3 >> Error.. not the same type 'str' + 'int' impossible..
see Concatenation for help