+ 1
Thats odd.. code coach
Why does this code not work numbers = int(input()) all = [numbers] for i in range (numbers): numb = int(input()) all.append(numb) #print(all) even = [] for j in range(numbers): if all[j] % 2 == 0: even.append(all[j]) #print(even) total = 0 for k in range(len(even)): total = even[k] + total print(total)
2 Réponses
+ 1
you must initialize your 'all' list with an empty list (as you do for 'even' list):
all = [ ]
+ 1
Thanks, i didnt read the questions properly😅