Functions

1 / 5

Functions allow you to package code into reusable blocks. In Python, you define a function using the def keyword followed by the function name and parentheses. The code block within every function is indented.

For example:

def greet():
    print("Hi there!")

This defines a function called greet that prints a message. To execute the function's code, you must call it:

greet()

Function definitions

Define a function called hello_world that prints "Hello, world!" when called.

Congratulations!

You passed the !

Welcome!

Would you like a guided tour on how to use Vibewise?

Your email has been verified!