Can anyone tell why am not able to paas the test "That's odd'? | Sololearn: Learn to code for FREE!

+1

Can anyone tell why am not able to paas the test "That's odd'?

https://code.sololearn.com/cu1Txh7iMMB4/?ref=app

5/28/2022 3:54:46 PM

Avi

7 Answers

New Answer

+3

Avi Also continue is use to skip current iteration on the basis of True or False So using continue in else part not making any sense because when if condition will satisfy then only if block will execute otherwise nothing will happen, so only doing this: if True or False: #statement is enough if you want to actually use continue then do this: #this will skip to add odd items if items % 2 == 1: continue b = b + items -------------- a = int(input()) b = 0 for i in range(a): n = int(input()) if n % 2 == 1: continue b = b + n print (b)

+4

Hello Avi You don't get a string. So l = input().split() will not work. #at first you get the length length = int(input()) #then you get some numbers for i in range(length): n = int(input()) #now you can check if n is even or not and sum it

+2

What is the task? Please mention course name and task number.

+1

Thanks Denise Roßberg ✌️

+1

Avi Just copy the code and put in that task, then tell me it is giving right answer or not.

0

Lisa it's the question from code coach (That's Odd') I think it's not able to paas test case bcz the all inputs are in new lines maybe.....so what do I do to take ∞ inputs in new lines...?

0

A͢J thanks bro but using continue in if loop and then updating value of b after that will not gonna give right anwer.....you can remove continue and thanks for help🙂✌️