0

What is the answer if x=a x+=3

12th Nov 2016, 10:28 PM
ADuffield
ADuffield - avatar
2 Antwoorden
+ 1
x+=3 means x=x+3 so: x=a x=a+3
12th Nov 2016, 10:30 PM
Sagheb
Sagheb - avatar
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
14th Nov 2016, 1:13 AM
Jelloul
Jelloul - avatar