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)
3 Antworten
+ 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)
0
you are not storing input as a list. you are storing it as a normal value
0
Input should be one integer n and another n integers.