Open
Description
In the function test_list_comprehensions(), under the list comprehension that cleans up whitespace from a list of fruit names, the variable weapon is used instead of a more context-appropriate name such as fruit. This can be confusing for readers and may lead to misunderstandings, as the list is called fresh_fruit and contains fruit names.
Current code:
fresh_fruit = [' banana', ' loganberry ', 'passion fruit ']
clean_fresh_fruit = [weapon.strip() for weapon in fresh_fruit]
assert clean_fresh_fruit == ['banana', 'loganberry', 'passion fruit']
Suggested change:
Change weapon to fruit for clarity and consistency:
clean_fresh_fruit = [fruit.strip() for fruit in fresh_fruit]
This will improve code readability and maintain consistency with the context of the example.
Metadata
Metadata
Assignees
Labels
No labels