Skip to content

Commit e79d308

Browse files
committed
added type hints to all functions
1 parent 1d5ded2 commit e79d308

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

sprint5-prep/prep2-exercise.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
def open_account(balances: dict[str,int], name : str, amount:int):
1+
def open_account(balances: dict[str,int], name : str, amount:int) -> None:
22
balances[name] = amount
33

4-
def sum_balances(accounts):
4+
def sum_balances(accounts : dict[str,int]) -> int:
55
total = 0
66
for name, pence in accounts.items():
77
print(f"{name} had balance {pence}")
88
total += pence
99
return total
1010

11-
def format_pence_as_string(total_pence):
11+
def format_pence_as_string(total_pence :int) -> str:
1212
if total_pence < 100:
1313
return f"{total_pence}p"
1414
pounds = int(total_pence / 100)

0 commit comments

Comments
 (0)