Skip to content

Commit

Permalink
Fix Invalid Output
Browse files Browse the repository at this point in the history
  • Loading branch information
kylosnote authored May 2, 2018
1 parent 33aac8a commit 068665a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions word2number/w2n.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ 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:
hundreds = number_formation(clean_numbers[billion_index+1:])
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

0 comments on commit 068665a

Please sign in to comment.