(spoiler, kindof) 4.The sum of the scores | Is this cheating? Using the sum() function


#1



https://www.codecademy.com/en/courses/python-intermediate-en-7mgOa/1/1?curriculum_id=4f89dab3d788890003000096#

This code passes.
Maybe Codecadamy should throw an error on anyone trying to use sum() in this exercise. :sweat_smile:


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

def grades_sum(scores):
    return sum(scores)

print grades_sum(grades) #returns and prints 1045.5


#2

Rather than cheating this could be accepted as getting the correct answer in another fashion of which has not been taught to you unless I am mistaken for I have not seen the python course recently but nonetheless well done and could you share the question so I may analyse it further.

I can see that it says not to use the sum function so it seems to be and error on their part
Codacademy marks you by A: checking to see the console log to see if they are no errors, if not then to the next part, B: were it checks if the output is correct, with few courses to mark your code as the amount of variations to compute would exceed their computing power,
Imagine this, You write:
print Grades_Sum(x)
and another person writes like:
print grades_sum(x)
You are both correct but there are variations within your code.

Hope this helped. :slight_smile:


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.