generated from mwc/problemset_numberwords
I completed numberwords.py, modeled after the solution that I accidentally had access to, but I did fix a few output issues where things were printing awkwardly (thiry-zero) so now things look to work a little more like they would be said in English. I also (after MUCH planning, execution, debugging, and throwing it all away to start over) came up with a way to get the negative numbers to work. I did this by converting the original number to a string, checking if the first character is a dash, throwing away the dash if it exists, and then completing the rest of the program as if the number were positive. I added some conditionals and a boolean value to only print the "negative " string on the most parent function so it doesn't end up saying something like "negative negative fiften thousand negative four hundred and negative thirty-five", and it seems to work for all of the numbers that I tested. It doesn't work well with test_numberwords.py because the test cases have the tens index shifted. I guess I could have just modified those and ran it again. I should do that. |
||
---|---|---|
.gitignore | ||
numberwords.py | ||
nw.py | ||
planning.md | ||
poetry.lock | ||
pyproject.toml | ||
test_numberwords.py |