Skip to content

[Wordy] Add tuple-and-index approach#4202

Open
Yrahcaz7 wants to merge 4 commits into
exercism:mainfrom
Yrahcaz7:wordy-new-approach
Open

[Wordy] Add tuple-and-index approach#4202
Yrahcaz7 wants to merge 4 commits into
exercism:mainfrom
Yrahcaz7:wordy-new-approach

Conversation

@Yrahcaz7
Copy link
Copy Markdown
Contributor

Adds another Wordy approach as discussed in this PR.

Also fixes a few errors in the Wordy approach docs that were missed in that PR.

Copy link
Copy Markdown
Member

@BethanyG BethanyG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving this - good work!!

The three things I found are more suggestion than "OMG change this". So you can decide if you agree or disagree. 😄

LMK if you'd like to let this sit, or have it merged. Thanks for doing this!!

If there *is* an extra operator word, then we need to check if it is present as the next word in `words`.
If it is not present, we raise a `ValueError`, else we increment `operand_index` by `1` to get the correct index.

Here we call the helper function again, setting `operand` to the number at index `operand_index`, and raising a `ValueError` if it is not a number.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to name the helper function since this explanation is long enough to have to scroll back up to see the code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, but I'm not sure how to change the sentence to include that. Any change I try seems to make it read awkwardly...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

Here we call the helper function str_to_int() again,

Or is that just too much?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its fine if it just doesn't work. It was just a thought - no need to cram it in if its not working.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to: "Here we use the helper function str_to_int() again, setting operand to the number at index operand_index (and raising a ValueError if it is not a number)."

I think it works if that last part is in parentheses.

Comment thread exercises/practice/wordy/.approaches/tuple-and-index/content.md Outdated
Comment thread exercises/practice/wordy/.approaches/tuple-and-index/content.md Outdated
Yrahcaz7 and others added 2 commits May 23, 2026 22:15
Co-authored-by: BethanyG <BethanyG@users.noreply.github.com>
@Yrahcaz7 Yrahcaz7 requested a review from BethanyG May 24, 2026 12:50
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.

2 participants