jeudi 17 juin 2021

Defining a function in an if..else statement: Can anybody tell me why function won't run? Every other aspect of the code works fine, no errors either

Can anybody tell me why function (repeat) won't run? Every other aspect of the code works fine, no errors either

else:
    payment > total
    change = payment - float(total)
    print("You will recieve £" + str(change) + " change as follows: ")
    x = int(item)
   
    def repeat(): 
        for item in balance:
            if change < balance[item]:
                item = item + 1
                
            main_change = change // balance[item]
            remainder = change % balance[item]
            if remainder != balance[item]:
                item = item + 1
                change == remainder
                repeat()
     
        print(main_change, "Denomination: ", balance[item])

Aucun commentaire:

Enregistrer un commentaire