+ 1
How to fix it? List(out of range)
8 Réponses
+ 3
What are you trying to achieve? Deep copying a to b?
import copy
a=[1,2,3,4]
b=copy.deepcopy(a)
print(b)
+ 1
Cant be like this
a=[1,2,3,4]
x=0
while True:
b=a[x]
if len(a)<5:
print(b)
x+=1
0
Instead of writing,
b = a[5]
Write,
b = a[1]
Output will be 2.
0
I think you want to print the elements in the array. Do it like so :
a=[1,2,3,4]
for i in range(len(a)):
print(a[i])
0
i want to make it like
1
2
3
4
1
2
3
4
1
2
a[10]
0
51207 Check this code out :))
https://code.sololearn.com/cAhnU09dGFx2/?ref=app
0
Yes, but return a[10] is 3
cause it looping 2x
1=0
2=1
3=2
4=3
1=4
2=5
3=6
4=7
1=8
2=9
3=10
a[10] = 3
maybe?
0
a = [1,2,3,4]
b = a[1]
if len(a) < 5:
print(b)