File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,8 @@ def answer(i):
5656
5757# # # Version 2 ###
5858
59+
60+
5961ones_dict = {
6062 "0" : " " ,
6163 "1" : "one" ,
@@ -80,6 +82,8 @@ def answer(i):
8082}
8183
8284tens_dict = {
85+ "0" : "and" ,
86+ "1" : " " ,
8387 "2" : "twenty" ,
8488 "3" : "thirty" ,
8589 "4" : "fourty" ,
@@ -117,20 +121,24 @@ def answer(i): # function to spli
117121 p = ones_dict [i ]
118122 print (p )
119123 elif i > 99 :
120- tens_digit = i // 10
121124 ones_digit = i % 10
125+ tens_digit = i // 10
126+
122127 hundreds_digit = tens_digit // 10
123128 tens_digit = tens_digit % 10
124- tens_digit = str ( tens_digit )
129+
125130 ones_digit = str (ones_digit )
131+ tens_digit = str (tens_digit )
126132 hundreds_digit = str (hundreds_digit )
127- k = hundreds_dict [hundreds_digit ]
128- h = tens_dict [tens_digit ]
133+ if tens_digit == "1" :
134+ print (hundreds_dict [hundreds_digit ] + ones_dict [tens_digit + ones_digit ])
135+
129136 j = ones_dict [ones_digit ]
130-
131-
132-
137+ h = tens_dict [tens_digit ]
138+ k = hundreds_dict [hundreds_digit ]
139+ #print(ones_dict, tens_dict, hundreds_digit )
140+ #print(tens_digit + ones_digit )
141+ #print(tens_digit)
142+ #print(hundreds_digit)
133143 print (k ,h ,j )
134-
135-
136144answer (i )
You can’t perform that action at this time.
0 commit comments