mirror of
https://github.com/DavidGailleton/42-Piscine_Python.git
synced 2026-03-13 20:56:54 +01:00
Rework of module 03
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user