7 Answers
New Answer7 Answers
New AnswerAvi 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)
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
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...?
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🙂✌️
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message