User Tools

Site Tools


user:amalgamated_marks

This is an old revision of the document!


Amalgamated Marks

Python Program

def main():
    # tally
    t = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]

    # example array of marks
    a = [9,10,12,15,17,19,23,24,25,31,37,38,38,
5,8,12,13,14,15,19,20,24,26,28,33,34,41,42,
6,-7,10,10,12,12,15,18,21,25,30,40,37,
3,5,12,15,18,25,26,39,43,
7,1,3,8,9,10,12,15,16,17,23,25,26,29,32,33,36,37,39,40,41,
1,2,3,3,5,5,5,8,9,9,10,10,12,12,13,14,15,15,16,16,16,17,18,19,20,
21,22,23,24,25,28,29,30,31,31,32,33,33,33,34,35,36,37,37,38,38,39,39,
40,41,42,43]

    for m in a:
        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]))

if __name__ == '__main__':
    main()
user/amalgamated_marks.1729127689.txt.gz · Last modified: by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki