Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print 'Right, that\'ll be $3.47'
- total = float(raw_input('Enter how much you give me $'))
- if total < 3.47:
- print 'Trying to scam me ey?'
- elif total == 3.47:
- print 'Thank you'
- change_to_give = (total - 3.47)
- while change_to_give > 0:
- if change_to_give >= 20:
- print '$20'
- change_to_give -= 20
- elif change_to_give >= 10:
- print '$10'
- change_to_give -= 10
- elif change_to_give >= 5:
- print '$5'
- change_to_give -= 5
- elif change_to_give >= 2:
- print '$2'
- change_to_give -= 2
- elif change_to_give >= 1:
- print '$1'
- change_to_give -= 1
- elif change_to_give >= 0.5:
- print '50p'
- change_to_give -= 0.5
- elif change_to_give >= 0.2:
- print '20p'
- change_to_give -= 0.2
- elif change_to_give >= 0.1:
- print '10p'
- change_to_give -= 0.1
- elif change_to_give >= 0.05:
- print '5p'
- change_to_give -= 0.05
- elif change_to_give >= 0.02:
- print '2p'
- change_to_give -= 0.02
- elif change_to_give > 0.01:
- print '1p'
- change_to_give -= 0.01
- else:
- print '1p'
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement