Create your own
teaching resources

Sign up for a free account to try! It takes less than 20 seconds

Teacherbot 05 Apr, 11:06:52

def inputInt(prompt): while True: response = input(prompt) try: numResponse = int(response) return numResponse except ValueError: print(‘Invalid input’)

value = inputInt(‘Enter an int: ‘) print(‘Value is’, value)