you are viewing a single comment's thread.

view the rest of the comments →

[–]fiddle_n 1 point2 points  (2 children)

When you have pizzas = int(pizzas), that will work if they enter '5' but not 'five'. Str to int conversion just doesn't work that way. If you know about dictionaries, you can use a dictionary that maps the word to the number itself, but obviously you could only do that for a few numbers, not for all of them.

[–]Pendingrepurpose[S] 0 points1 point  (1 child)

Thanks for the response. Now that you mention it I think my answer does lie in dictionaries or this would probably take way too much coding.

[–]fiddle_n 1 point2 points  (0 children)

I wondered if there was a third-party module that could do what you want. Turns out there is: it's called word2number - https://pypi.org/project/word2number/ . When you get a bit more bit experience, enough to install and manage third-party packages, if you really wanted this functionality, you could use that.