Python and R #1.4: Making functions

preview_player
Показать описание
In this video you'll learn how to make your own functions, which will make your code much more readable and easy to edit, and will help you to avoid mistakes. I will cover the syntax of creating functions, as well as general concepts and philosophy that you should follow. You will even learn how to make your own custom error messages, which should be more helpful than the error messages you typically see.



I was super pregnant while recording this one, so apologies for being out of breath and even more nasal than usual.

Table of Contents:

00:00 - Programming with Python and R #1.4: Making your own functions
00:08 - Learning objectives
01:37 - Reminders
02:21 - Abstraction
04:54 - Creating your own functions
06:19 - Components of a function definition
07:27 - Simple function in Python
14:53 - Simple functions in R
19:14 - Exercise
24:07 - Variable scope
30:27 - Quick exercise
31:07 - A more complex example
34:17 - Setting argument defaults
38:32 - Documenting functions
41:51 - Exercise
54:29 - Adding error messages
58:43 - Putting functions into separate files
1:04:29 - NSF Acknowledgement
Рекомендации по теме