Skip to content

Instantly share code, notes, and snippets.

@manojd929
Created September 23, 2018 07:36
Show Gist options
  • Save manojd929/c32eacf4cf4a1ee09232470c9f9c00d4 to your computer and use it in GitHub Desktop.
Save manojd929/c32eacf4cf4a1ee09232470c9f9c00d4 to your computer and use it in GitHub Desktop.
check eligibility for marks
def getBestTwoTestScores(score1, score2, score3):
if score1 >= score2:
x = score1
if score2 >= score3:
y = score2
else:
y = score3
if score2 >= score3:
x = score2
if score3 >= score1:
y = score3
else:
y = score1
if score3 >= score1:
x = score3
if score1 >= score2:
y = score1
else:
y = score2
return x, y
def getAverage(a, b):
return (a + b) / 2
def getEligibility(a, b):
res = a + b
if res >= 20:
print a, "+", b, " = ", res, "Eligible"
else:
print a, "+", b, " = ", res, "Not Eligible"
def studentInfo(test1, test2, test3, assignment1, assignment2):
res1, res2 = getBestTwoTestScores(test1, test2, test3)
testScore = getAverage(res1, res2)
assignmentScore = getAverage(assignment1, assignment2)
getEligibility(testScore, assignmentScore)
def main():
print "1: ", studentInfo(20, 20, 20, 24, 24)
print "2: ", studentInfo(24, 20, 22, 16, 16)
print "3: ", studentInfo(5, 20, 15, 10, 10)
print "4: ", studentInfo(7, 7, 7, 10, 11)
print "5: ", studentInfo(10, 10, 10, 9, 9)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment