Skip to content

Instantly share code, notes, and snippets.

@pwener
Created January 24, 2022 23:39
Show Gist options
  • Select an option

  • Save pwener/18c5f886290811fd028cc4dac375319d to your computer and use it in GitHub Desktop.

Select an option

Save pwener/18c5f886290811fd028cc4dac375319d to your computer and use it in GitHub Desktop.
#!/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