File tree Expand file tree Collapse file tree 1 file changed +20
-13
lines changed
code/daniel/03_NumberToPhrase Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Original file line number Diff line number Diff line change 21
21
import numbers
22
22
23
23
24
- # tens_digit = x//10
25
- # ones_digit = x%10
26
24
onesNumberList = {
27
25
0 : "zero" ,
28
26
1 : "one" ,
57
55
}
58
56
59
57
pickANumber = input ("Pick a number between 0 and 99: " )
60
- tens_digit = int (pickANumber )// 10
61
- ones_digit = int (pickANumber )% 10
58
+ intNum = int (pickANumber )
59
+ wordNum = ""
60
+ tens_digit = intNum // 10
61
+ ones_digit = intNum % 10
62
62
actual_digit = (f"{ tens_digit } { ones_digit } " )
63
+
63
64
# print(f"{tens_digit}{ones_digit}")
64
65
# print(actual_digit)
65
66
66
- # if int(pickANumber) > 99:
67
- # print(f"Number is too high")
68
- # elif int(pickANumber) < 0:
69
- # print(f"Number is too low")
70
- for num in pickANumber :
71
- if actual_digit [0 ] == 0 :
72
- print (f"{ onesNumberList [1 ]} " )
67
+ while intNum > 99 or intNum < 0 :
68
+ print (f"Number is out of range" )
69
+ break
70
+
71
+ while intNum != "" :
72
+ if tens_digit == 0 :
73
+ wordNum = ones_digit [intNum ()]
74
+
75
+
76
+
77
+
78
+ # for int in intNum:
79
+ # if actual_digit[0] == 0:
80
+ # print(f"{onesNumberList[1]}")
73
81
74
- # else:
75
- # print(f"")
82
+
76
83
77
84
78
85
You can’t perform that action at this time.
0 commit comments