User Tools

Site Tools


user:amalgamated_marks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
user:amalgamated_marks [2024/10/17 01:13] – removed appledoguser:amalgamated_marks [2025/01/13 06:32] (current) appledog
Line 1: Line 1:
 += Amalgamated Marks
  
 +== Python Program
 +<Code:Python>
 +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)
 +        t[int(m)] += int(p)
 +    else:
 +        if m > 0:
 +            t[m] = += 1
 +        else:
 +            t[abs(m)] -= 1
 +
 +for x in range(50):
 +    print (str(x) + ", " + str(t[x]))
 +</Code>
user/amalgamated_marks.1729127598.txt.gz · Last modified: by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki