#! /usr/bin/python3
valor = int(input("Digite o valor a pagar: "))
cedulas = 0
atual = 50
apagar = valor
while True:
if atual <= apagar:
apagar = apagar - atual
cedulas += 1
else:
print("%d cedula(s) de R$%d" %(cedulas, atual))
if apagar == 0:
break
elif atual == 50:
atual = 20
elif atual == 20:
atual = 10
elif atual == 10:
atual = 5
elif atual == 5:
atual = 1
cedulas = 0
I do not understand how the loop accesses the first if and the else in the sequence within the while True. Should not the else be accessed only when the first if of the code is false? how does this code work line by line ?, could someone explain?, remembering that I'm a beginner in programming.