We have reached the point where you understand that programs cannot be truly useful when following a sequential flow. Conditionals and Loops provide us with a great way to break up a program and its control flow, but by far the most valuable control flow mechanism for programming are functions.
Functions are a way to organize code, specifically a block of code, so it can be used throughout a program. They should be written in a way that they perform a single, related action. If done correctly, they will make a program more modular by allowing you to reuse code.
Python provides three different types of functions:
- Built-in Functions
- Python provides a handful of built-in functions, some of which you have already been introduced to.
print()
,len()
,int()
, etc. are all examples of these. They are always available to you as a Python programmer as they get loaded into memory as soon as you execute the Python interpreter.
- Python provides a handful of built-in functions, some of which you have already been introduced to.
- Built-in Module Functions
- This concerns you less, as we haven't introduced modules to you yet and we don't include any external modules in this Dojo. But, it is worth mentioning that Python has numerous modules and that these modules define their own group of functions. All of these function are not readily available until you import the module into your program. Again, we won't cover this here in this Dojo, but they can be very useful when building out larger programs.
- User-defined Functions
This module is all about learning Python functions. Topics to be covered: User-Defined Functions, Calling Functions, Arguments, and Return Values.
Challenges
30-Day Scoreboard:
This scoreboard reflects solves for challenges in this module after the module launched in this dojo.
Rank | Hacker | Badges | Score |