0

I have my instructions in the top of my code. But for some reason when I input a decimal and then return my error message like it is supposed to then I input a valid amount it prints everything twice, once for the valid input then once for the valid input here is what i am getting(below bottom).

```
01
"""
02
withdraw_money()
03
a. prompt user for a money amount in US Dollars (no cents, i.e. no
04
fractional part allowed)
05
b. print a preamble which says that user will see the breakdown of the
06
money in banknotes
07
c. print maximum number of $100 bills that can be given for the amount
08
given by user
09
d. print maximum number of $50 bills that can be given for the amount left
10
over from previous step
11
e. print maximum number of $20 bills that can be given for the amount left
12
over from previous step
13
f. print maximum number of $10 bills that can be given for the amount left
14
over from previous step
15
g. print maximum number of $5 bills that can be given for the amount left
16
over from previous step
17
h. print maximum number of $2 bills that can be given for the amount
18
left over from previous step
19
i. print maximum number of $1 bills that can be given for the amount left
20
over from previous step
21
"""
22
import math
23
import string
24
25
def withdraw_money():
26
withdraw = 0
27
hundreds = 0
28
fifty = 0
29
twenty = 0
30
ten = 0
31
five = 0
32
two = 0
33
one = 0
34
withdraw = input("Input the amount you would like to withdraw\n--> ")
35
while withdraw >= 100:
36
hundreds += 1
37
withdraw -= 100
38
while withdraw >= 50:
39
fifty += 1
40
withdraw -= 50
41
while withdraw >= 20:
42
twenty += 1
43
withdraw -= 20
44
while withdraw >= 10:
45
ten += 1
46
withdraw -= 10
47
while withdraw >= 5:
48
five += 1
49
withdraw -= 5
50
while withdraw >= 2:
51
two += 1
52
withdraw -= 2
53
while withdraw >= 1:
54
one += 1
55
withdraw -= 1
56
if withdraw < 1 and withdraw > 0:
57
print "invalid input"
58
print "do not insert a decimal"
59
withdraw_money()
60
print "Here is the bill breakdown for the amount input"
61
print hundreds, "number of 100s"
62
print fifty, "number of 50s"
63
print twenty, "number of 20s"
64
print ten, "number of 10s"
65
print five, "number of 5s"
66
print two, "number of 2s"
67
print one, "number of 1s"
```

and what it is giving me

```
01
>>>
02
Input the amount you would like to withdraw
03
--> 200.30
04
invalid input
05
do not insert a decimal
06
Input the amount you would like to withdraw
07
--> 253
08
Here is the bill breakdown for the amount input
09
2 number of 100s
10
1 number of 50s
11
0 number of 20s
12
0 number of 10s
13
0 number of 5s
14
1 number of 2s
15
1 number of 1s
16
Here is the bill breakdown for the amount input
17
2 number of 100s
18
0 number of 50s
19
0 number of 20s
20
0 number of 10s
21
0 number of 5s
22
0 number of 2s
23
0 number of 1s
```

*Edited 2 Years Ago by pritaeas*: Moved to Python.