> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Ed Leafe > Sent: Sunday, August 12, 2007 8:35 AM > To: Dabo Users list > Subject: Re: [dabo-users] IIF() > > Note that you don't have to explicitly change the 'givetocustomer' > value to a string; that's done by the formatting. You also have an un- > Pythonic loop; it would be better written (without the Hungarian notation, > too!): > > for pos, denom in denominations: > # floor division yields no decimals and no rounding > givetocustomer[pos] = change // denom > # modulus returns remainder > change = change % denom > if givetocustomer[pos] > 0: > if givetocustomer[pos] > 1: > print str(givetocustomer[pos]) + ' ' + > moneys[pos] > else: > print str(givetocustomer[pos]) + ' ' + money[pos]
Ed: "for pos, denom in denominations:" gave me a "type error - unpacking non-sequence" so I changed it to: "for pos in range(len(denominations)):" and it worked. I am using Python 2.5. Jeff Jeff Johnson [EMAIL PROTECTED] 623-582-0323 Fax 623-869-0675 --- StripMime Report -- processed MIME parts --- multipart/signed text/plain (text body -- kept) application/x-pkcs7-signature --- _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]
