Creating a function to add two integers

Report a typo

From time to time, you might need to adjust someone else's code for a different purpose. This is when reading code comes in handy. Let's give it a go!

Scan the #comments and the code below, then complete it by filling in the gaps. You may not understand every line of code yet, but you definitely can use it, relying on your language intuition!

Fill in the gaps with the relevant elements
# Define a function that adds two numbers
 add_numbers(num1, num2):
     num1 + num2

# Call the function with two numbers
result = add_numbers(3, 4)

# Print the result
("The sum of the numbers is " + str(result)) 
returnprintdef
___

Create a free account to access the full topic