How to solve That's odd.... problem in coach. help me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to solve That's odd.... problem in coach. help me

i = int(input()) z =0 n= int(input()) for i in range(n): if(i%2==0): z+= i print(z)

9th Jan 2020, 6:46 AM
Vikram Singh
Vikram Singh - avatar
3 Answers
+ 6
There are several issues in this code. The second input needs to be repeated, you have indentation problems, and variable names should give a hint of what it contains. Here a working version of your code: i = int(input()) z =0 for i in range(i): n= int(input()) if(n%2==0): z+= n print(z)
9th Jan 2020, 7:15 AM
Lothar
Lothar - avatar
0
you are not storing input as a list. you are storing it as a normal value
9th Jan 2020, 6:49 AM
Arsenic
Arsenic - avatar
0
Input should be one integer n and another n integers.
9th Jan 2020, 6:55 AM
Mihai Apostol
Mihai Apostol - avatar