User Tools

Site Tools


user:amalgamated_marks

This is an old revision of the document!


Amalgamated Marks

Python Program

t = [0 for _ in range(50)]
    
# array of marks goes here
a = [
    "1:6", "2:2", 5, 5, 5, -5, -15, 10
]

for m in a:
    if ':' in str(m):
        m, p = m.split(':', 1)
        m = int(m)
        p = int(p)
        t[m] = t[m] + p
    else:
        if m > 0:
            t[m] = t[m] + 1
        else:
            t[abs(m)] = t[abs(m)] - 1

for x in range(50):
    print (str(x) + ", " + str(t[x]))
user/amalgamated_marks.1736749882.txt.gz · Last modified: by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki