Python for the .NET developer Transcripts
Chapter: The Python Language
Lecture: Concept: Python function basics

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Creating Python functions
0:01 always start with the key word def.
0:03 We're defining a function.
0:05 We give it a name.
0:06 This one we're calling evaluate_guess
0:08 following the python naming conventions of snake case
0:11 not camel case. Then we can optionally
0:14 in this case, we want to take some arguments here
0:17 So we're defining some parameters, guess and number.
0:20 They're positional, but you can also use them keyword style.
0:24 And then these functions have the implementation
0:26 and they always have a return value.
0:28 So here we're explicitly returning the single value
0:31 that we can, which is True or False.
0:33 Is the guess equal to the number or is it not?
0:36 But if we don't specify a return value
0:38 the value will be None.
0:41 So if you think of functions as always
0:42 like returning nullable of something
0:45 something to that effect
0:46 even the ones that you would conceptualize
0:48 as void functions, those return None
0:51 so every function always returns something
0:53 just sometimes None.