You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

25 lines
824 B

#!/usr/bin/env python3
#title :10-1.py
#description :10.1: Catching exceptions
#author :Marcel Haazen
#email :marcel@haazen.xyz
#date :07-11-2019 - 11:15
#edit_date :07-11-2019 - 11:45
#version :0.1
#usage :python3 10-1.py
#notes :
#python_version :3.7.4
#==============================================================================
amount = 4356
try:
devider = int(input("Door hoeveel wil je het delen? "))
assert devider > 0
print("Iedereen moet",amount/devider," euro betalen")
except ZeroDivisionError:
print("Delen door nul kan niet!")
except ValueError:
print("Gebruik cijfers voor het invoeren van het aantal!")
except AssertionError:
print("Negatieve getallen zijn niet toegestaan!")
except:
print("Onjuiste invoer!")