Skip to content

Fix variable name: weapon -> fruit in list comprehension example (#105)#113

Open
xy769 wants to merge 1 commit intotrekhleb:masterfrom
xy769:fix/weapon-to-fruit
Open

Fix variable name: weapon -> fruit in list comprehension example (#105)#113
xy769 wants to merge 1 commit intotrekhleb:masterfrom
xy769:fix/weapon-to-fruit

Conversation

@xy769
Copy link
Copy Markdown

@xy769 xy769 commented May 7, 2026

Description

Fix for issue #105.

In the list comprehension example that cleans whitespace from fruit names, the iteration variable was incorrectly named weapon instead of fruit. Since the list is called fresh_fruit and contains fruit names, using weapon is confusing for learners.

Changes

  • Line 266: Changed weapon.strip() to fruit.strip()
  • Changed for weapon in to for fruit in

Verification

The assertion still passes:
assert clean_fresh_fruit == [banana, loganberry, passion fruit]

…khleb#105)

The context is a fruit list ('fresh_fruit'), so using 'weapon' as the iteration variable is confusing. Changed to 'fruit' for clarity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant