the-honk/languages/python/calculators/_helpers/intInput.py

9 lines
190 B
Python
Raw Normal View History

2024-10-09 17:02:32 +00:00
# helper method to easily take in int inputs
def intInput(text):
while True:
try:
x = int(input(text + '\n'))
return x
except ValueError:
print('You must input an integer!\n')