teil8.
This commit is contained in:
17
teil8/exception.py
Normal file
17
teil8/exception.py
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
def func(wert):
|
||||
|
||||
if not isinstance(wert,int):
|
||||
raise TypeError('weertr muss ein int sein.')
|
||||
|
||||
if wert >0:
|
||||
print('Wert ist in Ordnung')
|
||||
else:
|
||||
raise ValueError('wert muss größer 0 sein')
|
||||
|
||||
|
||||
|
||||
func(7)
|
||||
func(-1)
|
||||
|
Reference in New Issue
Block a user