Syntax problem


#1

I met a syntax problem with my code as followed:
def ave(numbers):
{
total=sum(numbers),
total=float(total),
ave=total/len(numbers),
return ave
}
I don't know where the error is...please help:tired_face:


#2

:smiley: in python { } not means block of code.

for say here is block of some thing such as if .... : or for ..... : or anything else, press enter button and use Tab buttom( or 4 space ) to create a indent, now you are in that block. see below:

def phelo():
   print "hello world!"

#3

in fact, i had used Tab buttom....


#4

I know where the probleme is now. there should not have{ } after the function:weary:


#5

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