Lesson: Functions – Fundamentals
In the Python Fundamentals for Data Science course, several commands — such as
max() — were used. These statements are more often known as functions.
In this functions fundamentals lesson, you will learn how to speed up your workflow using functions. You will also learn how to create your own functions, as well as combining and debugging custom functions. You will learn such concepts as parameters, keywords, and the three different kinds of arguments.
When writing a program, you could just keep rewriting the same code, but that would be quite tedious, and 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 are free to use the function anytime in an effort to save time and resources. A function displays these patterns: Takes an input, transforms the input, and gives back an output.
While learning about functions, you will create your own function including one to create a frequency table. For more information on frequency tables, you might want to check out our dictionary 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.
2. Built-in Functions
3. Creating Our Own Functions
4. The Structure of a Function
5. Parameters and Arguments
6. Extract Values From Any Column
7. Creating Frequency Tables
8. Writing a Single Function
9. Reusability and Multiple Parameters
10. Keyword and Positional Arguments
11. Combining Functions
12. Debugging Functions
13. Next steps