QuesAns Print Page – CSKC
Sign In

Search

siteicon
Q&A CBSE12A-2018-B03B #6128

Question:

Write definition of a method ZeroEnding(SCORES) to add all those values in the list of SCORES, which are ending with zero (0) and display the sum.
For example,
If the SCORES contain [200,456,300,100,234,678]
The sum should be displayed as 600

Answer:

def ZeroEnding(SCORES):
    s=0
    for i in SCORES:
        if i%10==0:
            s=s+i
    print s