mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Add Flake8 comprehensions to pre-commit (#7235)
* ci(pre-commit): Add ``flake8-comprehensions`` to ``pre-commit`` (#7233) * refactor: Fix ``flake8-comprehensions`` errors * fix: Replace `map` with generator (#7233) * fix: Cast `range` objects to `list`
This commit is contained in:
@@ -8,7 +8,7 @@ def frac_knapsack(vl, wt, w, n):
|
||||
240.0
|
||||
"""
|
||||
|
||||
r = list(sorted(zip(vl, wt), key=lambda x: x[0] / x[1], reverse=True))
|
||||
r = sorted(zip(vl, wt), key=lambda x: x[0] / x[1], reverse=True)
|
||||
vl, wt = [i[0] for i in r], [i[1] for i in r]
|
||||
acc = list(accumulate(wt))
|
||||
k = bisect(acc, w)
|
||||
|
||||
Reference in New Issue
Block a user