0
Q:

what does += mean in Python

x = 0
while x < 5: 
  print(x)
  x += 1   #the x += 1 expression is a shortend version for x = x + 1
2
if a == 2: # Compares whether a is equal to 2
    print a
1
x = 0
while x < 5:
  print(x)
  x += 1
1
# in python == means that is a comparisson operator meaning it compares if one 
# variable equals the other. Instead of using one = since that will assign
# a value we use ==
0

New to Communities?

Join the community