Skip to content

Files

Latest commit

 

History

History

02-What-is-a-function

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
tutorial

02 What is a function?

You can see a function as a fragment of code we can use several times.

For example: If we want to get the sum of two numbers, we can declare a function called sum that returns the sum of number1 and number2:

def sum(number1,number2):
    return number1 + number2

After the function is declared, we can use it as many times as we want, like this:

total = sum(2,3)
total2 = sum(5,10)

print(total)  # Prints 5 on the console
print(total2)  # Prints 15 on the console

📝 Instructions:

  1. Please calculate the sum between 3445324 and 53454423 and assign the result to a variable called super_duper.