Skip to content

Instantly share code, notes, and snippets.

@ericsong
Created May 4, 2016 05:28
Show Gist options
  • Save ericsong/80ec66f0bed195da75329de999a2d527 to your computer and use it in GitHub Desktop.
Save ericsong/80ec66f0bed195da75329de999a2d527 to your computer and use it in GitHub Desktop.
import sys
hws = [0, 0, 0, 0, 0, 0]
mid1 = 0
mid2 = 0
def calcFinalNeeded(target, hws, mid1, mid2):
hw_avg = sum(hws) / 290 * .2 * 100
target_exam_avg = target - hw_avg
method1_grade = (target_exam_avg - 20*mid1/150 - 20*mid2/150)/40*100
method2_grade = (target_exam_avg - 25*mid2/150)/55*100
return min(method1_grade, method2_grade)
if len(sys.argv) >= 2:
target = int(sys.argv[1])
print(str(target) + ": " + str(calcFinalNeeded(target, hws, mid1, mid2)))
else:
for target in range(10, 100, 10):
print(str(target) + ": " + str(calcFinalNeeded(target, hws, mid1, mid2)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment