CHAPTER 27 •
PYTHON
Python Functions
Learn how to create reusable blocks of code.
01 What is this?
Learn how to create reusable blocks of code.
02 Syntax
Python Syntax
def function_name():
statement
03 Example
Python Example
def greet():
print('Welcome to AIFA')
greet()
04 Important Points
Functions reduce repeated code.
05 Common Mistakes
Remember to call the function after defining it.
06 Real World Use
Functions are used in almost every real-world Python application.
07 Practice This Topic
Now try the example yourself in the AIFA Python Editor.
- Read the example carefully.
- Change the values.
- Run the code.
- Observe the output.
- Try creating your own example.