Can anyone tell why am not able to paas the test "That's odd'? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

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

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

28th May 2022, 3:54 PM
Avi
Avi - avatar
7 Answers
+ 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)
28th May 2022, 4:45 PM
A͢J
A͢J - avatar
+ 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
28th May 2022, 4:20 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
What is the task? Please mention course name and task number.
28th May 2022, 4:05 PM
Lisa
Lisa - avatar
+ 1
Thanks Denise Roßberg ✌️
28th May 2022, 5:06 PM
Avi
Avi - avatar
+ 1
Avi Just copy the code and put in that task, then tell me it is giving right answer or not.
28th May 2022, 5:17 PM
A͢J
A͢J - avatar
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...?
28th May 2022, 4:08 PM
Avi
Avi - avatar
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🙂✌️
28th May 2022, 5:06 PM
Avi
Avi - avatar