Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5
So this is a bit of a weird concept at first but it does become handy short form. So remember x += y is the same as x = x + y (from a pure math point of view this does still tweak my brain a bit because I want to think of isolation for variables and such, but throw that out here...) So we are basically accomplishing two operations in one line. So for your question we want to declare a variable x, and then add 5 to it so; x = x + 5, or x += 5 and then just print(x)
20th Sep 2016, 4:14 PM
Matthew