What is a block of code?



What makes up a block of code?


Any time you hear something referred to as a block or block of code it typically means the same thing. At least in programming.

There’s no better way to explain it than to show you visually! Don’t worry about understanding the code below, but understand that the chunks of code written at the same indentation level in Python make up a block of code. Notice the small gray arrow on line 4? That indicates a block of code belonging to whatever is on the line with the arrow - a function in this case.

FAQ: Learn Python - Python Syntax - Strings

Hello, how can I call that block code inside my_function and how can I name my_function?
Thank you


the general syntax for a function:

def function_name():

def is short for define. So here you define the function, then you name the function anything you like, then to call the function do: