Created
May 28, 2021 11:39
-
-
Save ceaksan/ec2453efe80b818dc5f9079093bfe2c4 to your computer and use it in GitHub Desktop.
This file contains 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
st = {} | |
for u in range(0, 5): | |
usr = str(input(str(u+1) + '. user name: ')) | |
st[usr] = {} | |
def grade(): | |
try: | |
for k in st.keys(): | |
midterm = float(input(f'midterm grade for {k}: ')) | |
project = float(input(f'project grade for {k}: ')) | |
final = float(input(f'final grade for {k}: ')) | |
st[k] = { | |
'midterm': midterm, | |
'project': project, | |
'final': final, | |
'passingGrade': int(midterm * 0.3 + project * 0.3 + final * 0.4) | |
} | |
except TypeError as err: | |
print('Values must be an float or integer!') | |
print(err) | |
except ValueError as err: | |
print('Values must be equal or greater then zero!') | |
print(err) | |
return st | |
students = grade() | |
grades = sorted([q['passingGrade'] for q in students.values()]) | |
print(grades) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment