yhlee: Alto clef and whole note (middle C). (Default)
yhlee ([personal profile] yhlee) wrote in [community profile] intro_to_cs 2009-11-17 04:17 am (UTC)

For summing up the logs you'd need a new function that takes in a tuple. Basically:

def logSum(tuple):


and make sure there's a tab indent for the next line, where you define the block of code. What you'll probably want to do is get the length of the tuple, then use that to define a while loop (or you could do this with a for loop but I'd have to look up the syntax), looping over each item in the tuple: take the log, then add it to a running sum variable. At the end you'll want to return the running sum. Does that help a little?

Post a comment in response:

This community only allows commenting by members. You may comment here if you're a member of intro_to_cs.
(will be screened if not on Access List)
(will be screened if not on Access List)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting