> > Much appreciated André! > > I think our solutions are similar: >
... yours is better though, in that you don't make use of exec. My use of it was superfluous. Changing my solution, in light of yours: #=== def makeroot(N): try: assert type(N)==type(1) and N>=0 except: raise ValueError("0 <= N <= integer") fname = "root" + str(N) if N==0: globals()[fname] = lambda x: pow(x, 0) else: globals()[fname] = lambda x: pow(x, float(1)/N) for i in range(11): makeroot(i) #=== Kirby _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig