Python Functions: Using Built-in Functions and Creating Functions
In the Variables, Data Types, and Lists in Python course, we used commands such as
round(). We call these statements functions.
In this functions fundamentals lesson, you’ll learn how to speed up your workflow using functions. You will also learn how to create your own functions and use built-in Python functions. You will learn concepts such as the structure of a function, parameters and arguments, and writing functions that use a
When writing a program, you could just keep rewriting the same code, but that would be tedious, and it would result in an unnecessarily large program. Functions are self-contained routines that perform a specific task that you can incorporate into your program. After declaring the function, you can use the function anytime to save time and resources. A function displays these patterns: it takes an input, transforms the input, and returns an output.
While learning about functions, you’ll create your own functions, including one to create a frequency table that you’ll build in the following lesson: Python Functions: Arguments, Parameters, and Debugging. For more information on frequency tables, you might want to check out our Python Dictionaries and Frequency Tables lesson.
As you go through this lesson, you’ll get to apply what you’ve learned from within your browser; there’s no need to use your own machine to do the exercises. The Python environment inside of this course includes answer-checking to ensure you’ve fully mastered each concept before learning the next.
- Learn how to define the structure of a function
- Learn how to create your own functions
- Learn how to employ built-in functions
- Learn how to return values from a function call
- Built-in Functions
- Creating Our Own Functions
- The Structure of a Function
- Parameters and Arguments
- The Return Statement