effectivepython icon indicating copy to clipboard operation
effectivepython copied to clipboard

Item 37: unused variable in for loop

Open hong-dev opened this issue 4 years ago • 1 comments

Item 37, in class WeightedGradebook, there's an unused variable(subject) in for loop as below. :slightly_smiling_face:
Maybe for subject, scores in by_subject.items() can be changed to for scores in by_subject.values()? :hushed:

Screenshot from 2021-04-08 01-19-22

Reference: link to related example_code Thank you! :bow: :pray:

hong-dev avatar Apr 07 '21 16:04 hong-dev

Thank you for the report! Yes, you're right -- this would be simpler code and get rid of the unused variable.

bslatkin avatar May 31 '24 23:05 bslatkin