0

Calculate with list

For example, i have list[2,4,8,7] and i want to add the value 3 in each element of list. So how can i do? Thanks you advance

14th Dec 2016, 6:15 PM
Su Pig
Su Pig - avatar
3 Respostas
+ 2
a = [2, 4, 8, 7] for i in range(len(a)): a[i] += 3 print(a)
14th Dec 2016, 6:56 PM
Antek
Antek - avatar
0
i can help you in c if this array u can use for loops and add 3 to each one
14th Dec 2016, 6:32 PM
DeleteMe
0
Maybe my question is not right, sorry. I pass a test that show to test element odd and even of list: if ... (list)%2 == 0. I must complete this blank
14th Dec 2016, 6:51 PM
Su Pig
Su Pig - avatar