solutions

Invoking Functions

The first step to understand functions from a practical standpoint is using them. The fancy tech name we give to the action of "using" a function is is "invoke a function". Python has many functions that we can just use out of the box. For example, print is a function (check the notes below) that lets you send characters to the console. Let's see a few different examples of invoking the print function:

print("Hello World")
print(42)

my_name = "Santiago"
print(my_name)

print("Santiago")

In this case, the function name is print. The only parameter that it receives is "something to print". So we invoke print passing as an argument that thing that we want to print in the screen.

Check the examples in the editor and complete the assignment: use the len and sum function to calculate length_of_hello_world and sum_of_first_10_numbers.

Test Cases

test length of hello world - Run Test

def test_length_of_hello_world():
    assert length_of_hello_world == 11

test sum of first 10 numbers - Run Test

def test_sum_of_first_10_numbers():
    assert sum_of_first_10_numbers == 55