Rework of module 03

This commit is contained in:
2026-02-12 11:35:37 +01:00
parent 05a3ddc8b6
commit 161ab4339c
6 changed files with 130 additions and 67 deletions

View File

@@ -1,14 +1,14 @@
import sys
if __name__ == "__main__":
args = sys.argv
if len(args) <= 1:
print("No scores provided. Usage: python3\
try:
args = sys.argv
if len(args) <= 1:
raise Exception("No scores provided. Usage: python3\
ft_score_analytics.py <score1> <score2> ...")
else:
scores = [0] * (len(args) - 1)
i = 0
try:
else:
scores = [0] * (len(args) - 1)
i = 0
while i < len(args) - 1:
scores[i] = int(args[i + 1])
i = i + 1
@@ -19,5 +19,7 @@ if __name__ == "__main__":
print("High score:", max(scores))
print("Low score:", min(scores))
print("Score range", max(scores) - min(scores))
except ValueError:
print("Invalid input, only numbers are accepted")
except ValueError:
print("Invalid input, only numbers are accepted")
except Exception as err:
print(err)