File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change 3
3
"""
4
4
from dataclasses import dataclass
5
5
6
+ @dataclass (frozen = True )
7
+ class Coin :
8
+ value : int
9
+ label : str
10
+
11
+ def __str__ (self ):
12
+ return self .label
13
+
6
14
7
15
@dataclass (frozen = True )
8
- class Nickel :
16
+ class Nickel ( Coin ) :
9
17
value : int = 5
18
+ label : str = '5¢'
10
19
11
20
12
21
@dataclass (frozen = True )
13
- class Dime :
22
+ class Dime ( Coin ) :
14
23
value : int = 10
24
+ label : str = '10¢'
15
25
16
26
17
27
@dataclass (frozen = True )
18
- class Quarter :
28
+ class Quarter ( Coin ) :
19
29
value : int = 25
30
+ label : str = '25¢'
20
31
21
32
22
33
@dataclass (frozen = True )
23
- class Loonie :
34
+ class Loonie ( Coin ) :
24
35
value : int = 100
36
+ label : str = '$1'
25
37
26
38
27
39
@dataclass (frozen = True )
28
- class Toonie :
40
+ class Toonie ( Coin ) :
29
41
value : int = 200
42
+ label : str = '$2'
You can’t perform that action at this time.
0 commit comments