From 15b26e2e2b54bce33240822359e98ebd1bbb4fb0 Mon Sep 17 00:00:00 2001 From: baphim <269010393+baphim@users.noreply.github.com> Date: Thu, 3 Sep 2026 22:56:17 -0400 Subject: [PATCH] fix(r-1.3_scratch.py): attempt 3, I'm close, but the try-except is off --- lab-01/r-1.3_scratch.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lab-01/r-1.3_scratch.py b/lab-01/r-1.3_scratch.py index 36d2be4..034fc93 100644 --- a/lab-01/r-1.3_scratch.py +++ b/lab-01/r-1.3_scratch.py @@ -5,7 +5,9 @@ Created on Wed Sep 2 22:49:38 2026 @author: joseph - I figured out the function after some rest. Now I want to sort out an input -method that allows for any number of floats. +method that allows for any number of floats. I'm trying to remember without +looking at git history, the input verification loop I had yesterday, but I'd +have to append converted strings to a var.' """ def minmax(*data): @@ -16,4 +18,13 @@ def minmax(*data): user_data = input('Enter any amount of numbers, separated by spaces: ') list_data = user_data.split() -minmax(float(list_data)) \ No newline at end of file +float_data = [] + +for x in list_data: + try: + float_data.append(float(x)) + except:ValueError + print(f'{x} is an invalid number') + +print(float_data) + \ No newline at end of file