Skip to content

Commit 2ae8ca5

Browse files
authored
Clarify overdue fine function
The `else` statement used a redundant calculation that is the same as multiplying the days by `0.75`.
1 parent 829265e commit 2ae8ca5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

episodes/writing-functions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ In the date example above, we printed the results of the function code to output
8686
```python
8787
def calc_fine(days_overdue):
8888
if days_overdue <= 10:
89-
fine = days_overdue * 0.25
89+
fine = days_overdue * 0.25
9090
else:
91-
fine = (days_overdue * 0.25) + (days_overdue * .50)
91+
fine = days_overdue * 0.75
9292
return fine
9393

9494
fine = calc_fine(12)

0 commit comments

Comments
 (0)