Answers for "+= in python"

14

++ python

# There is no ++ in Python, use instead:
number += 1
Posted by: Guest on January-26-2021
1

what does += mean in python

x = 0
while x < 5:
  print(x)
  x += 1
Posted by: Guest on June-05-2020
-2

+= python

In [1]: x = [2, 3, 4]    
In [2]: y = x    
In [3]: x += 7, 8, 9    
In [4]: x
Out[4]: [2, 3, 4, 7, 8, 9]    
In [5]: y
Out[5]: [2, 3, 4, 7, 8, 9]    
In [6]: x += [44, 55]    
In [7]: x
Out[7]: [2, 3, 4, 7, 8, 9, 44, 55]    
In [8]: y
Out[8]: [2, 3, 4, 7, 8, 9, 44, 55]    
In [9]: x = x + [33, 22]    
In [10]: x
Out[10]: [2, 3, 4, 7, 8, 9, 44, 55, 33, 22]    
In [11]: y
Out[11]: [2, 3, 4, 7, 8, 9, 44, 55]
Posted by: Guest on April-04-2021

Python Answers by Framework

Browse Popular Code Answers by Language