2
def Dinheiro_vivo(x):
while x > 0.00:
if x>=50.0:
print( x//50,('notas de 50 euros'))
n = x % 50
elif x<50 and x >=20:
print (y//20,('notas de 20 euros'))
x= x %20
elif x<20 and x >=10:
print (x//10,('notas de 10 euros'))
x = x % 10
elif x<10 and x >=5:
print( x//5, ('notas de 5 euros'))
x = x% 5
elif x<5 and x>=2:
print( x//2, ('moedas de 2 euros'))
x = x % 2
elif x<2.0 and x>=1.0:
print( x//1,('moedas de um euro'))
x= x%1
elif x<1.0 and x >=0.50:
print( x//0.50,('moedas de 50 centimos'))
x = x %0.50
elif x<0.50 and x>=0.20:
print( x//0.20,('moedas de 20 centimos'))
x = x%0.20
elif x<0.20 and x>= 0.10:
print( x//0.10,('moedas de 10 centimos'))
x = x%0.10
elif x<0.10 and x>=0.05:
print(x//0.05,('moedas de 5 centimos'))
x= x % 0.05
elif x<0.05 and x>=0.02:
print( x//0.02,('moedas de 2 centimos'))
x = x %0.02
else:
print ( x ,('moedas de 1centimos'))
my exercise is to program a function in Python to sort the number of banknotes and coins to which my number (x) corresponds but give me an infinite loop, I need help.
The program displays the amount of banknotes and coins corresponding to an amount of
X
Euros as efficiently as possible, that would be ?– Lacobus