Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Invalid Output #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions word2number/w2n.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ def word_to_num(number_sentence):

if thousand_index > -1 and thousand_index != len(clean_numbers)-1:
hundreds = number_formation(clean_numbers[thousand_index+1:])
elif million_index > -1 and million_index != len(clean_numbers)-1:
elif million_index > -1 and million_index != len(clean_numbers)-1 and thousand_index != len(clean_numbers)-1:
hundreds = number_formation(clean_numbers[million_index+1:])
elif billion_index > -1 and billion_index != len(clean_numbers)-1:
elif billion_index > -1 and billion_index != len(clean_numbers)-1 and thousand_index != len(clean_numbers)-1:
hundreds = number_formation(clean_numbers[billion_index+1:])
elif thousand_index == -1 and million_index == -1 and billion_index == -1:
hundreds = number_formation(clean_numbers)
Expand All @@ -214,4 +214,4 @@ def word_to_num(number_sentence):
decimal_sum = get_decimal_sum(clean_decimal_numbers)
total_sum += decimal_sum

return total_sum
return total_sum