-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolution2.py
More file actions
26 lines (20 loc) · 658 Bytes
/
solution2.py
File metadata and controls
26 lines (20 loc) · 658 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""
# ex.2
It's the end of the semester and you got your grades from three classes: Geometry, Algebra, and Physics.
Create a program that:
1) Reads the grades of these 3 classes (Grades range from 0 - 10)
2) Calculate the average of your grades
* Example: Geometry = 6, Algebra = 7, Physics = 8
* Output: average_score = 7
"""
def subjects_dict(dict1):
sum1 = sum(dict1.values())
average = sum1/3
return average
geo = 6
alg = 7
phy = 8
dict2 = {"Geometry" : geo, "Algebra" : alg, "Physics" : phy}
result = subjects_dict(dict2)
print(f"Your scores are Geometry: {geo}, Algebra: {alg}, Physics: {phy}")
print("Your average score is", result)