grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]

def grades_sum(scores):

total = 0

for i in grades:

total += i

return total

print grades_sum(grades)

grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]

def grades_sum(scores):

total = 0

for i in grades:

total += i

return total

print grades_sum(grades)

i have the ask:

def grades_sum(scores):

total = 0

for i in scores:

total += i

return total

print grades_sum([100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5])

This is what finally worked for me:

grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]

def grades_sum(scores):

****total = 0

****for i in scores:

********total = total + i #could simply use total += i

****return total

print grades_sum(grades)

Wrap your code in `[code] [/code]`

, it will keep the tab alignment.

Also a simpler way is to use the sum() function (mentioned in the overview of the exercise)

```
def grades_sum(scores):
total = sum(scores)
return total
print grades_sum(grades)
```

Hi there, I also try it this way:

grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]

def grades_sum(scores):

total = 0

for grade in grades:

total = total + grade

return total

print grades_sum(grades)

But I keep getting an error message: "It looks like your grades_sum function doesn't properly compute the sum of all the grades! It returned 1045.5 instead of 48 for grades_sum([48])". I have no idea what I am doing wrong. Any ideas?

Just FYI, the exercise mentions this "I know what you're thinking, "let's just use the built-in sum() function!" The built-in function would work beautifully, but it would be too easy."

Isn't that the whole point though? To make it easier.

I mean, sure you can use a loop and do it all manually, but that's not the python way, and in general is a bad way to go about programming. The purpose of learning a language is to utilize its functions to make coding easier/more concise.

same with me...nice code

```
grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]
def grades_sum(grades):
total = 0
for g in grades:
total += g
return total
print grades_sum(grades)
```

Hi sicklad,

can you review my code :

grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]

def grades_sum(scores):

total = 0

for i in range(len(grades)):

total += grades[i]

return total

i += 1

grades_sum(grades)

it seems to compute for first grade then exit. let me know if it is the real problem and how can i compute the whole sum instead of running some.

grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]

def grades_sum(grades):

total = 0

for i in grades:

total += i

return total

print grades_sum(grades)

This did it for me