I am a beginner in python and need help to solve the error in my code. I have to write the code from the given flowchart such the user gets the minimum amount of coins in return, but I didn't get the accurate answer, so can you please help me to figure out my mistake and guide me.
[1]: https://i.stack.imgur.com/AUq44.png
Here is my code:
print("amount: ",amount)
payment = input("amount of Payment: ")
payment = float(payment)
change = payment - amount
change = round(change,2)
if change>0:
d = change // 1
change = change - d
if change>0:
q = change // 0.25
i = change // 0.10
n = change // 0.05
change = change - q * 0.25 + i * 0.10 + n * 0.05
n = n+round(change*2,1)*10
print("you got",d,"dollars",q,"quaters,",i,"dimes, and",n,"nickels back in change")
else: print("you got",d,"dollars",q,"quaters,",i,"dimes, and",n,"nickels back in change")
else: print('No change owed')