Syntax error in It's Ok to be average


#1

I really can't figure out why it's giving me a syntax error with the arrow pointing at '='. I've tried indenting more and less, I've tried putting it all in one line. The lines inside the function are all indented one tab, this does not appear to show in the posting. I've looked around, and this seems to be one of the ways this should work. I'd appreciate any input! Thank you!

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

Console output:
File "python", line 22
total = sum(numbers)
^ (pointing at = )
SyntaxError: invalid syntax


#2

We're in Python, we don't put curly braces around the function's block.


#3

Ooh, right. Thank you! I've been working in R a lot recently...