Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Function basics
4. Calling your function
Summary

Instruction

Great! You've created your first function. In order to use your function, you have to call it:

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

hello_world()

This way, the function actually prints the Hello, World! sentence. Observe that the function call hello_world() is not indented. It is at the same indentation level as the def keyword. This way Python knows that the function definition is over and what follows is regular code.

Exercise

Create a function named motivate() that prints the following sentence:

You can do this!

Then, call it in order to print the sentence.