[Wordy] Add tuple-and-index approach#4202
Conversation
also add "None" link and a few minor fixes
BethanyG
left a comment
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
You might want to name the helper function since this explanation is long enough to have to scroll back up to see the code.
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
What about
Here we call the helper function
str_to_int()again,
Or is that just too much?
There was a problem hiding this comment.
Its fine if it just doesn't work. It was just a thought - no need to cram it in if its not working.
There was a problem hiding this comment.
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.
Co-authored-by: BethanyG <BethanyG@users.noreply.github.com>
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.