Skip to content

Commit de485f1

Browse files
bites 203 - add dataclass decorator
1 parent 4d4dbf5 commit de485f1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

203/type_hinting.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import typing
1+
from dataclasses import dataclass
2+
3+
@dataclass
24
class Employee:
35
"""Simple Employee class
46
@@ -9,6 +11,11 @@ class Employee:
911
:param wage: Float of hourly pay
1012
:param weekly_pay: Property which returns a string for weekly pay
1113
"""
14+
first_name: str
15+
last_name: str
16+
days_per_week: str
17+
hours_per_day: float
18+
wage : float
1219

1320
def __init__(self, first_name:str, last_name:str, days_per_week:int,
1421
hours_per_day:float, wage:float):
@@ -18,6 +25,9 @@ def __init__(self, first_name:str, last_name:str, days_per_week:int,
1825
self.hours_per_day = hours_per_day
1926
self.wage = wage
2027

28+
number: float
29+
places: int
30+
2131
def _rounder(self, number:float, places:int) -> str:
2232
"""Rounds a number the specified number of places
2333

0 commit comments

Comments
 (0)