Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- PRICE=123.45
- PAID=1300.0
- change=PAID-PRICE
- # Find largest denomination
- c=-3
- while True:
- if int(change/pow(10,c)) == 0:
- break
- c += 1
- while change>0:
- c-=1
- denomination = pow(10,c)
- bills = int(change/denomination)
- print "%d-%fs" % (bills,denomination)
- change -= bills*denomination
- change = round(change,2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement