File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
4
4
5
+ from requests import request
6
+
7
+
5
8
low_numbers = {
6
9
0 : "zero" ,
7
10
1 : "one" ,
@@ -85,12 +88,13 @@ def convert_number(number):
85
88
if last_one == 0 : # its saying that its only calling the last number if it is 0
86
89
return f'{ ten [tens_digit ]} '
87
90
88
- elif number < 999 :
91
+ elif number <= 999 :
89
92
hundreds_digit = number // 100 #floor divide regular division with no remainder
90
93
hundreds_word = hundreds [hundreds_digit ]
91
94
last_two = int (str (number )[- 2 :]) #python get last two digits in number stack exchange
92
95
last_one = int (str (number )[- 1 :])
93
-
96
+ if last_two == 0 :
97
+ return f'{ hundreds_word } '
94
98
95
99
96
100
@@ -109,7 +113,7 @@ def convert_number(number):
109
113
110
114
111
115
# return hundreds_digit, tens_digit
112
- # return f"{hundreds[hundreds_digit] } - {ten[tens_digit]} - {low_numbers[ones_digit]}"
116
+ # return f"{hundreds_word } - {ten[tens_digit]} - {low_numbers[ones_digit]}"
113
117
114
118
print (convert_number (number ))
115
119
You can’t perform that action at this time.
0 commit comments