Skip to content

Instantly share code, notes, and snippets.

@acb122
Created June 29, 2017 08:36
Show Gist options
  • Save acb122/ebfd7bb43fa749211f2f72de962f8acb to your computer and use it in GitHub Desktop.
Save acb122/ebfd7bb43fa749211f2f72de962f8acb to your computer and use it in GitHub Desktop.
y4 = [66,56,72,70,80,80,65,65,69,69,69,69]
y2 = [73,75,60,73,60,55,68,68,78,78,69,69]
y3 = [61]
# 8 modules per band
BAND_SIZE = 8
BAND_DELTA = len(y4) - BAND_SIZE
# Extract BAND_SIZE best year 3 modules
y4_sorted = sorted(y4)
band_3 = y4_sorted[-BAND_SIZE:]
# Init band_2 with remaining year 3 modules
band_2 = y4_sorted[:-BAND_SIZE]
# Populate remaining slots (BAND_DELTA) of band_2
y2_sorted = sorted(y2)
band_2.extend(y2_sorted[-BAND_DELTA:])
# band_1 contains whatever is left
band_1 = y2_sorted[:-BAND_DELTA]
band_0 = y3
# Calculate the average and weighted average for each band
bands = [band_0, band_1, band_2, band_3]
def avg(band):
avg = float(sum(band)) / len(band)
return avg
result = (avg(band_3)*80*3 + avg(band_2)*80*2 + avg(band_1)*80*1 + avg(band_0)*120*0.25)/ (80*3 + 80*2 + 80*1 + 120*0.25)
print("Degree Result: %.2f" % result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment