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:14] – old revision restored (2024/06/19 00:35) appledoguser:amalgamated_marks [2025/01/13 06:32] (current) appledog
Line 3: Line 3:
 == Python Program == Python Program
 <Code:Python> <Code:Python>
-def main(): +t = [0 for _ in range(50)]
-    # 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 +# array of marks goes here 
-    a = [9,10,12,15,17,19,23,24,25,31,37,38,38, +a = [ "1:6""2:2", 5, 5, 5, -5, -15, 10 ]
-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:+for m in a
 +    if ':' in str(m): 
 +        m, p = m.split(':', 1) 
 +        t[int(m)] += int(p) 
 +    else:
         if m > 0:         if m > 0:
-            t[m] = t[m] + 1+            t[m] = +1
         else:         else:
-            t[abs(m)] = t[abs(m)] - 1+            t[abs(m)] -1
  
-    for x in range(50): +for x in range(50): 
-        print (str(x) + ", " + str(t[x])+    print (str(x) + ", " + str(t[x]))
- +
-if __name__ == '__main__': +
-    main()+
 </Code> </Code>
user/amalgamated_marks.1729127689.txt.gz · Last modified: by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki