Skip to content

Commit

Permalink
fixed typo in itertools compress approach. (#3808)
Browse files Browse the repository at this point in the history
  • Loading branch information
BethanyG authored Oct 31, 2024
1 parent 5ad6668 commit bfc578e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If the 'sounds' string is empty, a string version of the number is returned inst
This is very succinct code that avoids string concatenation.
However, it does require the overhead of importing `compress()` from the [itertools][itertools] module.
The code is also harder to maintain should there be additional factors/sounds needed.
Because the factors and sounds are seperated, there is a chance mistakes could be made like forgetting a number or swapping which factor is paired with which sound.
Because the factors and sounds are separated, there is a chance mistakes could be made like forgetting a number or swapping which factor is paired with which sound.

A better approach for maintenance might be to turn the 'sounds' `tuple` into a dictionary where the factors and sounds can be stored separate from the logic that does the calculations and string creation:

Expand Down

0 comments on commit bfc578e

Please sign in to comment.