- 1
x=[2,4] x+=[6,8] print(x[2]//x[0])
How the output is 3 please explain
6 Answers
+ 12
Karan Chawla
x = [2, 4]
x += [6, 8]
x = x + [6, 8]
x = [2, 4] + [6, 8]
x = [2, 4, 6, 8]
x[2] = 6
x[0] = 2
So
x[2] // x[0] = 6 // 2 = 3
+ 2
x is a list with 2 and 4
then 6 and 8 are added to the list.
index 0 is 2 and index 2 is 6
6 // 2 = 3
+ 1
3
0
x = [2, 4]
x += [6, 8]
print(x[2]//x[0])
x[2, 4, 6, 8]
0 1 2 3 # index
x[2]=6
x[0]=2
6 // 2 = 3
0
Ans Is
3
- 2
3



