First post, feedback appreciated!
I am new to python and currently working my way through 'Automate the Boring Stuff' when I stumpled upon an exercise about error-handling. In the exercise I have to account for people not typing a int value in the response to the input(), which is where the try: --> except: comes in handy. BUT, what if I wanted to print a message when a negativ int value is inserted?
My code below prints the except line.
print('How many cats do you have')
numCats = input()
try:
if int(numCats) >= 4:
print('That is a lot of cats')
elif numCats < 0:
print('Did you give cats away you did not own?')
else:
print('That is not taht many cats')
except:
print('You did not enter a number.')