Introduction
Function basics
3. First function
More advanced concepts
Summary

Instruction

Great! Let's write a very simple function.

def hello_world():
  print('Hello, World!')

Functions begin with the def keyword, followed by a pair of parentheses and a colon. Following is an indented block of code that contains all of the instructions the function should execute. Our hello_world() function does only one thing: prints Hello, World! to the console.

Once you define a function, you can use it anywhere by providing its name with parentheses and any arguments that it takes (in this case, none):

# invoke function first_function
hello_world()

Exercise

Define a function named show_amazing_skills() that prints the following sentence:

I can write my own function!

Stuck? Here's a hint!

Start with:

def show_amazing_skills():