the-honk/python/calculators/_helpers/listInput.py
2021-08-26 02:42:17 +01:00

10 lines
316 B
Python

# helper method to easily take in float list inputs
def listInput(text, delimeter = ','):
while True:
try:
x = input('%s - the delimeter is %s (:\n' % (text, delimeter))
x = x.split(delimeter)
nums = [float(a) for a in x]
return nums
except ValueError:
print('All of the values must be floats!')