Function arguments

We're going to explore how to receive parameters and operate with them in your functions. In the editor you'll see a simple function that accepts just one parameter (named x in this case). This function's job is to multiply x by 2 and return the result. For example, if we pass 3 as the parameter, we're going to receive 3 * 2 as the result:

multiply_by_two(3)  # 6

Parameters are matched by position. In this case multiply_by_two receives only one parameter (x), so when we invoke it passing the number 3, it gets assigned to x.

Now go ahead and try implementing the multiply_by_two function by yourself.

Test Cases

test five times two - Run Test

def test_five_times_two():
    assert multiply_by_two(5) == 10

test two times two - Run Test

def test_two_times_two():
    assert multiply_by_two(2) == 4