On 28/09/2015 21:27, Ken Hammer wrote: As you've all ready had answers I've just one thing to say below.
total = 0.0 for i in range(len(poly)): totalTerm = poly[i]* (x ** i) total += totalTerm print "totalTerm ", i , totalTerm print "Equation Value", total
Perhaps the most used piece of code that although not actually wrong, is certainly frowned upon as you can write:-
for i, item in enumerate(poly): totalTerm = item * (x ** i) ... -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor