<< Chapter < Page | Chapter >> Page > |
This module is one in a collection of modules on Python designed for teaching ITSE 1359 Introduction to Scripting Languages: Python at Austin Community College in Austin, TX.
So far under the general topic of control flow , you have learned how to construct while loops, for loops, and if statements. In addition, you have learned
This module will depart significantly from the above. In this module, you will learn the basics of defining and calling functions in Python.
I recommend that you open another copy of this module in a separate browser window and use the following links to easily find and view the Figuresand the Listings while you are reading about them.
(Note to blind and visually impaired students: most of the Figures and all of the Listings inthis module are presented in plain text format and should be accessible using an audio screen reader or a braille display. Note however that the requiredindentation may not be properly represented by an audio screen reader.)
According to tutorialspoint -- Python Functions
A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing. As you already know, Python gives you many built-in functions like print(), etc. but you can also create your own functions. These functions are called user-defined functions.
Again according to tutorialspoint , the rules for defining a basic function are as follows:
The docstring mentioned above is a string literal. We will ignore the docstring in this module. We will learn about tools in a future module that use docstrings to automatically produce online or printed documentation.
Notification Switch
Would you like to follow the 'Itse 1359 introduction to scripting languages: python' conversation and receive update notifications?