Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 11 Online
OpenStudy (anonymous):

guys i am not really sure about the syntax of the second line of this function: http://codepad.org/U1QXNiAR i have seen this structure many times but i don't understand it. how the for loops are coming after the "sum" function. how does this work please?

OpenStudy (anonymous):

actually i might have worked it out . seems to be the concept of "list comprehensions" which i had not seen before. correct me if i am wrong

OpenStudy (anonymous):

yep, it's a list comprehension http://codepad.org/lpMcBnSr what is msum used for? looks like something from one of those project euler problems where you try to find the largest sum from consecutive values in a sequence of numbers

OpenStudy (anonymous):

yeah it is used to return the largest consecutive sum in an array of numbers and the bounds of the subarray that make it up. it is actually from the reading material of the course related to dynamic programming.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!