the-honk/python/calculators/_helpers/floatInput.py
2024-10-09 18:02:48 +01:00

8 lines
186 B
Python

# helper method to easily take in float inputs
def floatInput(text):
while True:
try:
x = float(input(text))
return x
except ValueError:
print('You must input a float!\n')