Python 3.4 - Exceptions
Sometimes users can input data that might throw our program off and break it. We don't want our programs to stop running every time a user does something wrong. Instead we need to do something with these errors, and make sure there is a fail-safe for our programs to continue running.
https://www.youtube.com/watch?v=1cCU0owdiR4
while True: try: kitties = int(input('How many cats is too many?\n')) print(18/kitties) break except ValueError: print("Try again.") except ZeroDivisionError: print("Good answer, try again") except: break finally: print('Thank you for trying')
https://www.youtube.com/watch?v=1cCU0owdiR4
Comments