diff --git a/lab-01/r-1.3.py b/lab-01/r-1.3.py index 006511c..0c1e39b 100644 --- a/lab-01/r-1.3.py +++ b/lab-01/r-1.3.py @@ -1,2 +1,19 @@ def minmax(data): + ordered = sorted(data) + data = (ordered[0], ordered[-1]) + print(data) + + +user_data = input('Enter any amount of numbers, separated by spaces: ') +list_data = user_data.split() +float_data = [] + +for x in list_data: + try: + float_data.append(float(x)) + except ValueError: + print(f'{x} is an invalid number') + + +minmax(float_data) \ No newline at end of file diff --git a/lab-01/r-1.3_scratch.py b/lab-01/r-1.3_scratch.py index 9427c69..0386979 100644 --- a/lab-01/r-1.3_scratch.py +++ b/lab-01/r-1.3_scratch.py @@ -11,7 +11,7 @@ error: having the colon directly after except on line 27 instead of after the entire line. """ -def minmax(*data): +def minmax(data): ordered = sorted(data) data = (ordered[0], ordered[-1]) print(data) @@ -27,4 +27,5 @@ for x in list_data: except ValueError: print(f'{x} is an invalid number') -print(float_data) + +minmax(float_data)