10. please help


#1

def list_function(x):
x[1] = x[1] + 3
return x[1]

n = [3, 5, 7]
print list_function(n)

it says:
list_function([6, 6]) returned 9 instead of [6, 9]


#2

It would appear from the error message that the lesson checker is expecting the whole array in return, not just a single value. Your function is correct, but the return value is not.

    return x

#3

Handy Tip

Python supports what are known as augmentation operators which are essentially shortcuts that perform an arithmetic operation AND an assignment in one go.

a = a + 3

may be written,

a += 3

The expression on the right will be augmented to the left side variable. We can use these operators in just about any primitive operation (including strings).

a -= 1
a *= 5
a /= 2
a //= 10

Strings

    s = "Monty"
    s += " Python"
    print s         # Monty Python

#4

for me the error message states:
File "python", line 3
SyntaxError: 'return' outside function