#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    7
    Rep Power
    0

    How should I make this array?


    https://gist.github.com/anonymous/5544366

    That's a link to my data and the current line, and subsequent error message, I'm facing.

    May the gods of programming bless you.
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,709
    Rep Power
    480
    I suggest you learn common terminology.


    "I'm looking to make an array that will add up values in an element by"

    Arrays store data. Arrays do not manipulate data.


    "I'm looking to make an array that will add up values in an element by"

    What's an element?


    Anyway, I'd write a cumulative summation function.
    Code:
    def cumsum(LIST):
        '''
            >>> cumsum([1,2,3,4])
            [1, 3, 6, 10]
        '''
        # your code here
        return result # result is a list of the cumulative sums in LIST
    Then you could call it as

    topbottom = cumsum(array)
    bottomtop = cumsum(list(reversed(array)))

    now compare the values at like indexes of
    topbottom and bottomtop, giving your astounding report when the values are equal.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo