-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path9.py
36 lines (32 loc) · 808 Bytes
/
9.py
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
31
32
33
34
35
36
#!/usr/bin/python3
import math
import os
import random
import re
import sys
# n = 4
# scores = [12, 24, 10, 24]
# n = 9
# scores = [10, 5, 20, 20, 4, 5, 2, 25, 1]
n = 10
scores = [3, 4, 21, 36, 10, 28, 35, 5, 24, 42]
# Complete the breakingRecords function below.
def breakingRecords(scores):
scoreMin = 0
scoreMax = 0
scoreMinCount = 0
scoreMaxCount = 0
for i in range(0, n):
if i == 0:
scoreMin = scores[i]
scoreMax = scores[i]
else:
if scores[i] < scoreMin:
scoreMin = scores[i]
scoreMinCount += 1
elif scores[i] > scoreMax:
scoreMax = scores[i]
scoreMaxCount += 1
return(scoreMaxCount, scoreMinCount)
result = breakingRecords(scores)
print(result)