solving a small programm

broebel computer.problemen at skynet.be
Sat Jan 10 20:26:52 CET 2004


If you look at this as a homework or not is of no interest to me but I like
the way you explained which way to go to find the resolution.
thanks (i solved it in a jiffy now)

"djw" <donald.welch.nospam at hp.com> schreef in bericht
news:40004743 at usenet01.boi.hp.com...
> As this is obviously a class assignment of some sorts, I don't know how
much
> help you are going to get (or should get) in directly writing the code.
> But, what I will say is that you should be able to look at the way the
code
> works now, how it keeps track of how many bills are needed for each
> denomination (200, 100, etc), and apply the same idea to the total number
> of bills required using another variable that is initialized before the
> loop begins.
>
> -d
>
>
> broebel wrote:
>
> > hey,
> >
> > 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
> >        10*1
> >        5*1
> >        2*1
> >        1*1
> > I need an additional code to get the "5" total of all the coins
together.
>





More information about the Python-list mailing list