> if name in plural: > name = plural[name] > else: > name += 's' This could be written more cleanly (although arguably not as readably) as
name = plural.get(name, name + "s") d.get(key, default) returns the value from d mapped to key if it exists, or default otherwise. You might also want to split your calculation and display code into two separate loops. This might seem wasteful, but it will make your code easier to read and maintain, and the waste is only marginal with the loops you're running - there is a maximum of only 17 passes (once for each value of coin and note) -- Richard "Roadie Rich" Lovely, part of the JNP|UK Famile www.theJNP.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor