+ 1

What is the the difference between "+=" and "=+"....I got different results using them

17th Jun 2019, 3:30 PM
Tanmay Maheshwari
Tanmay Maheshwari - avatar
2 Answers
+ 3
+= gives a number to a variable: x = 4 x += 5 # x is now 9 But when you use =+, it just sets the number to positive ( doesn't really do anything): x = 4 x =+ 5 # x is 5 (it is the same as x = +5 -> x = 5) When using negative numbets, it will still be negative, because - and + will still be - x =+ -5 # x = -5
17th Jun 2019, 3:55 PM
Airree
Airree - avatar
+ 1
Thank you soo much...really explained that well
17th Jun 2019, 4:10 PM
Tanmay Maheshwari
Tanmay Maheshwari - avatar