-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScore_Calculator.py
More file actions
30 lines (19 loc) · 959 Bytes
/
Score_Calculator.py
File metadata and controls
30 lines (19 loc) · 959 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
27
28
29
30
#Calculates final score based on weekly score updates, returns the highest score reached and the week where this occured.
def score_calc():
current_score = 1500
highest_score_value = 1500
current_week = 0
highest_score_week = 0
updates = [42,500,-654,-973,908,444,781,-700]
num_weeks = len(updates)
for i in updates:
current_score += i
current_week += 1
if current_score > highest_score_value:
highest_score_value = current_score
highest_score_week = current_week
final_score = current_score
print(f"You started with a score of '1500'. After {num_weeks} weeks, your updated score is '{final_score}'!")
print(f"The highest score you reached was '{highest_score_value}' and this was in week {highest_score_week}.\n")
return highest_score_value, final_score, highest_score_week
print(score_calc())