Python基础 · free preview
Creating Functions
Define a function that takes parameters. Return a value from a function. Test and debug a function. Set default values for function parameters. Explain why we should divide programs into small, single-purpose functions.
1. Overview
Overview
2. Composing Functions
Composing Functions
3. Variable Scope
Variable Scope
4. Tidying up
Tidying up
5. Testing and Documenting
Testing and Documenting
6. Defining Defaults
Defining Defaults
7. Readable functions
Readable functions
8. Combining Strings
Combining Strings
9. Return versus print
Return versus print
10. Selecting Characters From Strings
Selecting Characters From Strings
11. Rescaling an Array
Rescaling an Array
12. Testing and Documenting Your Function
Testing and Documenting Your Function
13. Defining Defaults
Defining Defaults
14. Variables Inside and Outside Functions
Variables Inside and Outside Functions
15. Mixing Default and Non-Default Parameters
Mixing Default and Non-Default Parameters
16. Readable Code
Readable Code
Practice this interactively
Free account · instant grading · spaced review that schedules itself.
Start this course for free