Skip to content

Commit c401102

Browse files
committed
Lab03Update
1 parent f83b02c commit c401102

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

code/daniel/03_NumberToPhrase/NumberToPhrase.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import numbers
2222

2323

24-
# tens_digit = x//10
25-
# ones_digit = x%10
2624
onesNumberList = {
2725
0: "zero",
2826
1: "one",
@@ -57,22 +55,31 @@
5755
}
5856

5957
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
6262
actual_digit = (f"{tens_digit}{ones_digit}")
63+
6364
# print(f"{tens_digit}{ones_digit}")
6465
# print(actual_digit)
6566

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]}")
7381

74-
# else:
75-
# print(f"")
82+
7683

7784

7885

0 commit comments

Comments
 (0)