Just weight and see


#1

This is my code:

def get_average(student):
homework = average(student[“homework”])
quizzes = average(student[“quizzes”])
tests = average(student[“tests”])

get_average = homework * 0.1 + quizzes * 0.3 + tests * 0.6
return get_average

And this is the error i’m getting:

File “python”, line 31
get_average = homework * 0.1 + quizzes * 0.3 + tests * 0.6
^
IndentationError: unindent does not match any outer indentation level

I don’t understand what am I doing wrong and what does it mean “unident”?


#2

Hi @betamaster17745,

Your posted code is not formatted, therefore we cannot see its indentation.

See How do I format code in my posts?.

In the code that you submitted to the Python interpreter, this line might not be indented to the same degree as the line above it …

   get_average = homework * 0.1 + quizzes * 0.3 + tests * 0.6

Also, in that line you are assigning the result to the name of the get_average function. It is best not to do that.

Replace these two lines …

   get_average = homework * 0.1 + quizzes * 0.3 + tests * 0.6
   return get_average

… with …

  return homework * 0.1 + quizzes * 0.3 + tests * 0.6

… and make sure the indentation of that line matches exactly the indentation of the line above it.


#3

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