Identation issue


#1

https://www.codecademy.com/courses/learn-python/lessons/student-becomes-the-teacher/exercises/just-weight-and-see?action=lesson_resume

Hi,
I am doing this exercise and I am wondering why sometimes I get indentation issues. In the code below, you see two functions, in the fist one, def average, the indentation is shorter than in def get_average. When I tried to run def get_average with the same indentation as def average, I got a syntax error (marked after quizzes=average(student[“quizzes”]) ), but when changed it to 4 spaces, it worked; whereas def average works without any issues with that indentation.
Basically, I just don’t understand why the different indentation levels for both functions.
Thanks!



# Add your function below!
def average(numbers):
  total=float(sum(numbers))
  return total/len(numbers)
  
def get_average(student):
    homework=average(student["homework"])
    quizzes=average(student["quizzes"])
    tests=average(student["tests"])
    return 0.1*homework+0.3*quizzes+0.6*tests



#2

codecademy got updated to the new learning enviroment, there still seems to be some indention issues which need sorting.


#3

Ok, thanks! I am new here so I have not seen other environment than the present one. I was getting very confused, but I suspected it should not be a problem of how I was writing the code but more of how it was being processed.


#4

yes, exactly. So don’t worry about it, you are doing fine :slight_smile:


#5

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