Skip to content
Snippets Groups Projects
Commit a337e325 authored by BiocheH's avatar BiocheH
Browse files

q2 : exception dans __init__

parent d5205206
Branches
No related tags found
No related merge requests found
...@@ -5,7 +5,10 @@ ...@@ -5,7 +5,10 @@
class TabletteChocolat: class TabletteChocolat:
def __init__(self, m: int, n: int): def __init__(self, m: int, n: int):
if not (isinstance(m, int) and isinstance(n, int)):
raise TypeError('given values must be integers')
self.m = m self.m = m
self.n = n self.n = n
A = TabletteChocolat(1, 2)
B = TabletteChocolat(1, 'ouioui')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment