2
#! /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 don’t understand how the loop accesses the first if and Else in the sequence within while True. Else should not be accessed only when the first if of the code is false? how does this code work line by line? , could someone explain to me? , remembering that I am a beginner in programming.