Skip to content

Commit 221d639

Browse files
committed
commit2
1 parent c0920b3 commit 221d639

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

Code/chadL/Python/lab3.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def answer(i):
5656

5757
# # # Version 2 ###
5858

59+
60+
5961
ones_dict = {
6062
"0": " ",
6163
"1": "one",
@@ -80,6 +82,8 @@ def answer(i):
8082
}
8183

8284
tens_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-
136144
answer(i)

0 commit comments

Comments
 (0)