Created
January 24, 2022 23:39
-
-
Save pwener/18c5f886290811fd028cc4dac375319d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/python3 | |
| import math | |
| import os | |
| import random | |
| import re | |
| import sys | |
| def findNextDivByFive(number): | |
| count = 0 | |
| while True: | |
| current = number + count | |
| if current % 5 == 0: | |
| return current | |
| else: | |
| count += 1 | |
| def diffCheck(number): | |
| nextDiv = findNextDivByFive(number) | |
| return (nextDiv - number) < 3 | |
| def gradingStudents(grades): | |
| res = [] | |
| for grade in grades: | |
| if grade < 38: | |
| res.append(grade) | |
| continue | |
| if diffCheck(grade): | |
| res.append(findNextDivByFive(grade)) | |
| else: | |
| res.append(grade) | |
| return res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment