I have looked around but have been unable to find out why my code is failing, and how to do it right. I'm new (3 days) to coding, so forgive my noobishness.
I start with a list of integers, and essentially I want to make a new or updated list where the new list's first index has a value = the sum of the first 10 values of the original list (0-10), and then the new list's second index has a value = the sum of the original list's (1-11) index values.
The problem is that it adds everything incorrectly, and in a manner such that I have not yet been able to figure out the pattern.
Here's what I have:
def sum_range(filename, grouping = 10):
"""sums up the ss values for 'groupings' numbers of indices.
Shows ALL results, regardless of how high or low strandedness is"""
sslist = ssc_only(filename)
# "ssc_only(filename)" takes my input and returns it as a list of int,
# which I want to use for this function
sslist = [sum(sslist[i:i+grouping]) for i in sslist]
return sslist