The script runs up until the 'takenotes' function is called and then just stops when it should run the function. There isn't any errors it just stops. Why is this?
# Please note that this only works in integer values, since there is no change in pence
notes = (1,5,10,20,50) #Value of notes
quantities = [10,8,5,5,1] #Quantities of notes
# Defining variables
notesout = []
total = 0
x = -1
payment = []
# This loop works out the total amount of cash in the cash register
while (x < 4):
x += 1
calc = notes[x]*quantities[x]
total += calc
mon_nd = 70 # Money needed
def takenotes():
print("Please input each notes value, when finished type \"stop\"")
# If input is an int then add to payment list, if not then work out the change
payment = [20,20,20,20]
main()
def main():
# Finds the value of the cash given
paymentV = sum(payment)
changeT = paymentV - mon_nd
# Change the quantities of the 'quantities' variable
for i in payment:
quantities[notes.index(i)] = quantities[notes.index(i)] + 1
while(changeT < 0):
# Works out what amount of change should be given
for i in reversed(notes):
if (changeT - i >= 0):
notesout.append(i)
quantities[notes.index(i)] = quantities[notes.index(i)]-1
changeT -= i
else:
return True
print(notesout)
takenotes()