user:amalgamated_marks
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| user:amalgamated_marks [2024/10/17 01:14] – old revision restored (2024/06/19 00:35) appledog | user:amalgamated_marks [2025/01/13 06:32] (current) – appledog | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| == Python Program | == Python Program | ||
| < | < | ||
| - | def main(): | + | t = [0 for _ in range(50)] |
| - | # tally | + | |
| - | | + | |
| - | 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 ] | + | |
| - | | + | # array of marks goes here |
| - | a = [9, | + | a = [ "1:6", " |
| - | 5, | + | |
| - | 6,-7, | + | |
| - | 3,5, | + | |
| - | 7, | + | |
| - | 1,2,3,3,5,5,5,8,9,9,10, | + | |
| - | 21, | + | |
| - | 40,41,42,43] | + | |
| - | | + | for m in a: |
| + | if ':' | ||
| + | m, p = m.split(':', | ||
| + | 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)] -= 1 |
| - | | + | for x in range(50): |
| - | print (str(x) + ", " + str(t[x])) | + | print (str(x) + ", " + str(t[x])) |
| - | + | ||
| - | if __name__ == ' | + | |
| - | main() | + | |
| </ | </ | ||
user/amalgamated_marks.1729127689.txt.gz · Last modified: by appledog
