solving a small programm

broebel computer.problemen at
Sat Jan 10 19:27:35 CET 2004


for the real programmers amongst you, this may be really annoying but I've
been learning the language for only two days.

this is my problem,
in this programm,which already works I now have to make a total count of how
many coins are used.
this program gives the total per coin. It should be a small peace of code
(as explained in a tutorial i read, without the answer.)that counts the
total of all the coins.
I ve been searching for two days and for this kind of programm it really
seems kind of long.

thanks in advance

# Een bedrag gepast betalen met zo min mogelijk euromunten

bedrag = input ( 'Geef bedrag tussen 0 en 500 eurocent: ' )

for munt in 200, 100, 50, 20, 10, 5, 2, 1 :
    aantal = 0

    while bedrag >= munt :
        aantal = aantal + 1
        bedrag = bedrag - munt

    if aantal > 0 :
        print aantal, 'x', munt

what i need is:
for example
the programm gives
68= 50*1
I need an additional code to get the "5" total of all the coins together.

More information about the Python-list mailing list