0
import cs50
def main():
    count = 0
    while True:
        print(" O hai ! How much change is owed ?")
        input = cs50.get_float()
        if input >= 0:
            break

    input  = input * 100
    change = int(round(input))

    while change >= 25:
        v = int(change/25)
        count = count + v
        change = change % 25


    while change >= 10:
        v = int(change/25)
        count = count + v
        change = change % 10


    while change >= 5:
        v = int(change/25)
        count = count + v
        change = change % 5


    count = count + change

    print("{}".format(count))
if __name__ == "__main__":
    main()

my code is working properly in c but in python it is buggy

for input 0.55 it returns 2 instead of 3

1

You have change/25 three times, shouldn't dime and nickel be 10 and 5 instead of 25?

1
  • thank you i must have skipped this while copying my code from c Jun 13 '17 at 3:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .