Answers for "+= meaning in python"

1

what does += mean in python

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

i += 1 meaning in python

n = int(raw_input())
    
    
    for i in range(0, 5):
        print i
    
    i = 0
    while i < 5:
        i += 1
        print (i*i);
Posted by: Guest on March-31-2021
-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