5\9 i hate my life already


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-python/lessons/student-becomes-the-teacher/exercises/its-okay-to-be-average-?action=lesson_resume&link_content_target=interstitial_undefined

<In what way does your code behave incorrectly? Include ALL error messages.>
File “python”, line 24
total = float(total)
^
IndentationError: unindent does not match any outer indentation level

def average(numbers):
	total = sum(numbers)
  total = float(total)
  return total/len(numbers)

#2

As we can see the indentation is incorrect and needs to be fixed.


#3

it was bugged, i believe, i have retyped this again with the same manner, and it started to work


#4

Hi @justyjust,

To inspect the whitespace at the beginning of each line in your posted code, use the mouse to select that whitespace, one line at a time. It will reveal that the indentation in your code consists of a tab at the beginning of this line …

	total = sum(numbers)

… and two spaces at the beginning of each of these two lines …

  total = float(total)
  return total/len(numbers)

Using a combination of spaces and tabs for indentation is a hazard in Python programs, and is often the cause of an IndentationError. In the Codecademy Python environment, use two spaces for each level of indentation, and avoid using tabs.


#5

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