1
+ #VERSION 1
2
+
3
+ # ones = {
4
+ # "1":"One",
5
+ # "2":"Two",
6
+ # "3":"Three",
7
+ # "4":"Four",
8
+ # "5":"Five",
9
+ # "6":"Six",
10
+ # "7":"Seven",
11
+ # "8":"Eight",
12
+ # "9":"Nine",
13
+ # "0":"Zero"
14
+ # }
15
+ # teens = {
16
+ # "10":"Ten",
17
+ # "11":"Eleven",
18
+ # "12":"Twelve",
19
+ # "13":"Thirteen",
20
+ # "14":"Fourteen",
21
+ # "15":"Fifteen",
22
+ # "16":"Sixteen",
23
+ # "17":"Seventeen",
24
+ # "18":"Eighteen",
25
+ # "19":"Nineteen"
26
+ # }
27
+ # tens = {
28
+ # "2":"Twenty",
29
+ # "3":"Thirty",
30
+ # "4":"Fourty",
31
+ # "5":"Fifty",
32
+ # "6":"Sixty",
33
+ # "7":"Seventy",
34
+ # "8":"Eighty",
35
+ # "9":"Ninety"
36
+ # }
37
+
38
+ # x = input("\nInput a number from 0-99: ")
39
+ # tens_digit = int(x) // 10
40
+ # teens_digit = int(x)
41
+ # ones_digit = int(x) % 10
42
+ # y = int(x)
43
+
44
+ # if y>= 20:
45
+ # converted_tens_digit = str(tens_digit)
46
+ # converted_tens_digit_2 = tens[converted_tens_digit]
47
+ # converted_ones_digit = str(ones_digit)
48
+ # converted_ones_digit_2 = ones[converted_ones_digit]
49
+ # print(f"\n{converted_tens_digit_2}-{converted_ones_digit_2}")
50
+
51
+ # elif y<10:
52
+ # converted_ones_digit = str(ones_digit)
53
+ # converted_ones_digit_2 = ones[converted_ones_digit]
54
+ # print(f"\n{converted_ones_digit_2}")
55
+
56
+ # elif y in range (11, 19):
57
+ # converted_teens_digit = str(teens_digit)
58
+ # converted_teens_digit_2 = teens[converted_teens_digit]
59
+ # print(f"\n{converted_teens_digit_2}")
60
+
61
+ #VERSION 2
62
+
63
+ ones = {
64
+ "1" :"One" ,
65
+ "2" :"Two" ,
66
+ "3" :"Three" ,
67
+ "4" :"Four" ,
68
+ "5" :"Five" ,
69
+ "6" :"Six" ,
70
+ "7" :"Seven" ,
71
+ "8" :"Eight" ,
72
+ "9" :"Nine" ,
73
+ "0" :"Zero"
74
+ }
75
+ teens = {
76
+ "10" :"Ten" ,
77
+ "11" :"Eleven" ,
78
+ "12" :"Twelve" ,
79
+ "13" :"Thirteen" ,
80
+ "14" :"Fourteen" ,
81
+ "15" :"Fifteen" ,
82
+ "16" :"Sixteen" ,
83
+ "17" :"Seventeen" ,
84
+ "18" :"Eighteen" ,
85
+ "19" :"Nineteen"
86
+ }
87
+ tens = {
88
+ "2" :"Twenty" ,
89
+ "3" :"Thirty" ,
90
+ "4" :"Fourty" ,
91
+ "5" :"Fifty" ,
92
+ "6" :"Sixty" ,
93
+ "7" :"Seventy" ,
94
+ "8" :"Eighty" ,
95
+ "9" :"Ninety"
96
+ }
97
+ hundreds = {
98
+ "1" :"One" ,
99
+ "2" :"Two" ,
100
+ "3" :"Three" ,
101
+ "4" :"Four" ,
102
+ "5" :"Five" ,
103
+ "6" :"Six" ,
104
+ "7" :"Seven" ,
105
+ "8" :"Eight" ,
106
+ "9" :"Nine"
107
+ }
108
+
109
+ x = input ("\n Input a number from 0-999: " )
110
+ y = int (x )
111
+ z = str (y )
112
+ last2_digit = int (x ) % 100
113
+ hundreds_digit = int (x ) // 100
114
+ str_last2_digit = str (last2_digit )
115
+ # tens_digit = str_last2_digit[0]
116
+ # ones_digit = str_last2_digit[1]
117
+ # converted_tens_digit = tens[tens_digit]
118
+ # converted_ones_digit = ones[ones_digit]
119
+ # converted_hundreds_digit = str(hundreds_digit)
120
+ # converted_hundreds_digit_2 = hundreds[converted_hundreds_digit]
121
+
122
+ if y < 10 :
123
+ ones_digit = int (x ) % 10
124
+ converted_ones_digit = ones [str (ones_digit )]
125
+ print (f"\n { converted_ones_digit } " )
126
+
127
+ elif y in range (10 ,19 ):
128
+ teens_digit = int (x )
129
+ converted_teens_digit = str (teens_digit )
130
+ converted_teens_digit_2 = teens [converted_teens_digit ]
131
+ print (f"\n { converted_teens_digit_2 } " )
132
+
133
+
134
+ elif 100 > y >= 21 :
135
+ tens_digit = int (x ) // 10
136
+ ones_digit = int (x ) % 10
137
+ converted_tens_digit = str (tens_digit )
138
+ converted_tens_digit_2 = tens [converted_tens_digit ]
139
+ converted_ones_digit = str (ones_digit )
140
+ converted_ones_digit_2 = ones [converted_ones_digit ]
141
+ print (f"\n { converted_tens_digit_2 } -{ converted_ones_digit_2 } " )
142
+
143
+ elif z [1 ] == "1" :
144
+ last2_digit = int (x ) % 100
145
+ converted_teens_digit = str (last2_digit )
146
+ converted_teens_digit_2 = teens [converted_teens_digit ]
147
+ converted_hundreds_digit = str (hundreds_digit )
148
+ converted_hundreds_digit_2 = hundreds [converted_hundreds_digit ]
149
+ print (f"\n { converted_hundreds_digit_2 } Hundred { converted_teens_digit_2 } " )
150
+
151
+ elif y > 100 :
152
+ last2_digit = int (x ) % 100
153
+ hundreds_digit = int (x ) // 100
154
+ str_last2_digit = str (last2_digit )
155
+ tens_digit = str_last2_digit [0 ]
156
+ ones_digit = str_last2_digit [1 ]
157
+ converted_tens_digit = tens [tens_digit ]
158
+ converted_ones_digit = ones [ones_digit ]
159
+ converted_hundreds_digit = str (hundreds_digit )
160
+ converted_hundreds_digit_2 = hundreds [converted_hundreds_digit ]
161
+ print (f"\n { converted_hundreds_digit_2 } Hundred { converted_tens_digit } -{ converted_ones_digit } " )
0 commit comments