From 79d565a1d9266135b967370e48c3cae0ffe686b9 Mon Sep 17 00:00:00 2001 From: baphim <269010393+baphim@users.noreply.github.com> Date: Thu, 3 Sep 2026 23:17:51 -0400 Subject: [PATCH] feat(r-1.3.py): constructed complete deliverable --- lab-01/r-1.3.py | 17 +++++++++++++++++ lab-01/r-1.3_scratch.py | 5 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) 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)