Created
May 28, 2013 12:27
-
-
Save alenbasic/5662401 to your computer and use it in GitHub Desktop.
This is a simple script to figure out what your grade is, or where you're currently sitting at if you haven't got all your assessments back.
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
fin_tot = 0 | |
fin_worth = 0 | |
def style_text(one,two): | |
print() | |
print('#'*50) | |
print(one) | |
print(two) | |
print('#'*50) | |
print() | |
while True: | |
marks = input("What is your mark: ") | |
if marks == 'q': exit(0) | |
marks = marks.split("/") | |
percentage = float(marks[0]) / float(marks[1]) * 100 | |
worth = float(input("What is the assessment worth: ")) | |
total = worth / 100 * percentage | |
fin_tot += total | |
fin_worth += worth | |
fin_percent = fin_tot/fin_worth * 100 | |
if fin_percent < 50: | |
print("Sorry, you failed the assessment") | |
elif fin_percent >= 50 and fin_percent < 65: | |
style_text(("Your mark thus far is %.2f/%d" % (fin_tot,fin_worth)),"You're sitting on a Pass with %d%%" % (fin_percent)) | |
elif fin_percent >= 65 and fin_percent < 75: | |
style_text(("Your mark thus far is %.2f/%d" % (fin_tot,fin_worth)),"You're sitting on a Credit with %d%%" % (fin_percent)) | |
elif fin_percent >= 75 and fin_percent < 85: | |
style_text(("Your mark thus far is %.2f/%d" % (fin_tot,fin_worth)),"You're sitting on a Distinction with %d%%" % (fin_percent)) | |
elif fin_percent >= 85: | |
style_text(("Your mark thus far is %.2f/%d" % (fin_tot,fin_worth)),"You're sitting on a High Distinction with %d%%" % (fin_percent)) | |
if fin_worth == 100: exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment