Skip to content

Commit 44efeb5

Browse files
committed
fix ex2 q6 min/max inversion
1 parent 5c8faa1 commit 44efeb5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

learntools/python/ex2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ class SlowestCallProblem(ThoughtExperiment):
9393
_hint = "You'll want to call the function you wrote in the previous question (`time_call`) in the body of `slowest_call`."
9494
_solution = """
9595
```python
96-
return min(time_call(fn, arg1), time_call(fn, arg2), time_call(fn, arg3))
96+
return max(time_call(fn, arg1), time_call(fn, arg2), time_call(fn, arg3))
9797
```
9898
9999
Or if you want to be extra-clever (and save a bit of typing):
100100
101101
```python
102-
return min(arg1, arg2, arg3, key=lambda arg: time_call(fn, arg))
102+
return max(arg1, arg2, arg3, key=lambda arg: time_call(fn, arg))
103103
```
104104
105105
You *could* copy-paste the code you wrote for `time_call` three times with some slight variable changes. But that's highly not recommended. It's more typing, and if you later noticed a bug in `time_call`, you'd have to fix it in 4 places. [Laziness is one of the three great virtues of a programmer.](http://threevirtues.com/)

0 commit comments

Comments
 (0)