my code is :

number = 5

def my_function(x):

return x

print my_function(number * 3 )

It gives the same result as changing return to x * 3 but codecademy gives an error when i write this one why so?

my code is :

number = 5

def my_function(x):

return x

print my_function(number * 3 )

It gives the same result as changing return to x * 3 but codecademy gives an error when i write this one why so?

If the function is supposed to return x * 3, then making the function return x is to change the behaviour of the function, the function no longer meets specification

Imagine if the `+`

operator suddenly did multiplication instead

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