2

I don't like computing floats (1/100 in binary is an infinite stream of digits, and cannot be stored in a float), so I convert everything to pence/cents first, and later use only integers. You might need to round the number of pence/cents before storing it in an integer, to avoid truncating 13.9999999 to 13. That's called fixed-point arithmetics, where you ...


1

while True: print ("Enter dollar amount: ", end="") change = cs50.get_float() if change < 0: print ("Invalid!") break break Your main idea is right. Your pseudocode is correct, too. The problem is here: if change < 0: You want the code to exit when you have a positive value. This statement ...


Only top voted, non community-wiki answers of a minimum length are eligible