0
Python continue, what is going wrong?
Hello Python pros, Where is my code wrong? I am dong a challenge problem and the answer is supposed to be 6026 but mine is comimg out to 4920 or something. The problem states that it should skip the odd numbers and only sum the even ones. https://code.sololearn.com/c9hy8d1olv4L/?ref=app
6 Respuestas
+ 4
if num % 2 != 0:
+ 5
items_list = [23, 555, 666, 123, 128, 4242, 990]
sum_of_even = 0
for item in items_list:
if item % 2 == 0:
sum_of_even += item
print(sum_of_even)
i make good result with this one (=6026)
+ 2
ah of course thank you! its the easy things like that, that get missed hehe. appreciate it!
+ 2
thanks for the different method Jan P.E. Steinert
+ 1
Would be great if you could mark my answer as correct too. :-D
0
thanks Jan P.E. Steinert i will give it a try and see!