+ 1
list=[1,2,3,4,5,6,7,8,9]For every third number of my list, how to add 3 to it and print
10 odpowiedzi
+ 3
yeah I put dange and then get out successfully
Thanks again!!! 💜💜
+ 6
myList = [1,2,3,4,5,6,7,8,9]
for i in range(2,9,3):
myList[i] += 3
print(myList)
+ 3
In a loop over each third item index
+ 1
Yor r absolutely right but i don't want to insert 3 Iist, increment 3rd index by 3 i.e if I have 4 on index 3 so i want ans as 4+3
+ 1
thank u ❤
0
l=[1,2,3,4,5,6,7,8,9]
for i in l[::3]:
l[i]=l[i]+3
print(l)
0
Thanks🙂
- 2
Hi