1 00:00:01,803 --> 00:00:03,260 - [Instructor] In this video, we're going to 2 00:00:03,260 --> 00:00:07,960 take a look at defining your own custom function. 3 00:00:07,960 --> 00:00:11,100 Now up to this point, whenever we've used any functions, 4 00:00:11,100 --> 00:00:14,050 we've specifically taken advantage 5 00:00:14,050 --> 00:00:17,380 of functions that were already built into Python. 6 00:00:17,380 --> 00:00:20,420 Things like print function or the int function 7 00:00:20,420 --> 00:00:22,500 to convert a value to an integer, 8 00:00:22,500 --> 00:00:24,510 or the float function to convert a value 9 00:00:24,510 --> 00:00:25,840 to a floating point number 10 00:00:27,144 --> 00:00:29,210 and we also took advantage of the sum function 11 00:00:29,210 --> 00:00:32,240 to add together all of the elements in a list 12 00:00:32,240 --> 00:00:35,870 and the len function to calculate the length 13 00:00:35,870 --> 00:00:37,263 of a list as well. 14 00:00:38,470 --> 00:00:40,120 Of course, many of the things 15 00:00:40,120 --> 00:00:41,860 that you'll want to do in programming 16 00:00:41,860 --> 00:00:45,170 will involve packaging up your own code 17 00:00:45,170 --> 00:00:46,970 and one of the key ways to do that 18 00:00:46,970 --> 00:00:49,230 is by creating a function 19 00:00:49,230 --> 00:00:51,330 that you can then reuse. 20 00:00:51,330 --> 00:00:53,710 So our key goal in this particular video 21 00:00:53,710 --> 00:00:56,450 is to just introduce the basic syntax 22 00:00:56,450 --> 00:00:58,110 of a function in Python 23 00:00:58,110 --> 00:01:00,440 and the terminology associated with it, 24 00:01:00,440 --> 00:01:02,280 show you how to call the function 25 00:01:02,280 --> 00:01:04,810 and also introduce a couple of other things 26 00:01:04,810 --> 00:01:09,010 that are specific to functions in the context of Python. 27 00:01:09,010 --> 00:01:11,820 Now to save me a little bit of typing pain, 28 00:01:11,820 --> 00:01:15,110 I'm going to paste in a function definition 29 00:01:15,110 --> 00:01:17,840 for a function that we're going to talk about. 30 00:01:17,840 --> 00:01:22,050 We are defining here a function named square 31 00:01:22,050 --> 00:01:23,740 and the purpose of this function, 32 00:01:23,740 --> 00:01:26,100 as you can see in the next line here, 33 00:01:26,100 --> 00:01:29,460 is to calculate the square of a number. 34 00:01:29,460 --> 00:01:31,990 Now, for those of you who might be coming from 35 00:01:31,990 --> 00:01:34,000 other programming languages, 36 00:01:34,000 --> 00:01:39,000 you'll notice that the definition of a function in Python 37 00:01:39,150 --> 00:01:41,780 is somewhat different from various 38 00:01:41,780 --> 00:01:43,340 other programming languages, 39 00:01:43,340 --> 00:01:46,100 especially C-based programming languages 40 00:01:46,100 --> 00:01:48,740 where you're typically required 41 00:01:48,740 --> 00:01:51,950 to specify the types of everything. 42 00:01:51,950 --> 00:01:54,460 That is not how Python works. 43 00:01:54,460 --> 00:01:56,730 Python is much more flexible than that. 44 00:01:56,730 --> 00:01:59,870 It is a scripting language first 45 00:01:59,870 --> 00:02:01,670 and as a general purpose, 46 00:02:01,670 --> 00:02:04,400 scripting language not only enables you 47 00:02:04,400 --> 00:02:06,700 to be quite expressive, 48 00:02:06,700 --> 00:02:09,160 but enables you to do some very powerful things 49 00:02:09,160 --> 00:02:13,560 as you're going to see through the next many lessons. 50 00:02:13,560 --> 00:02:15,970 Now, every function definition 51 00:02:15,970 --> 00:02:18,330 begins with the keyword D-E-F, 52 00:02:18,330 --> 00:02:20,430 which is short for definition. 53 00:02:20,430 --> 00:02:22,570 The name of the function is next, 54 00:02:22,570 --> 00:02:25,230 and of course, as you define a function, 55 00:02:25,230 --> 00:02:28,340 you should give it a name that this understandable, 56 00:02:28,340 --> 00:02:31,420 something that has to do with the purpose of that function 57 00:02:31,420 --> 00:02:33,280 and then following the function name 58 00:02:33,280 --> 00:02:36,600 will always be a set of parentheses, 59 00:02:36,600 --> 00:02:40,620 which defines what is known as the parameter list. 60 00:02:40,620 --> 00:02:44,800 In the parameter list, you specify variable names 61 00:02:44,800 --> 00:02:48,550 that will receive any information that the function needs 62 00:02:48,550 --> 00:02:51,110 in order to perform its task. 63 00:02:51,110 --> 00:02:52,850 And in the case of our square function, 64 00:02:52,850 --> 00:02:55,150 it needs to receive some number 65 00:02:55,150 --> 00:02:59,420 that it can then square and return the result. 66 00:02:59,420 --> 00:03:01,690 So we have one parameter in this case, 67 00:03:01,690 --> 00:03:03,310 but if we had multiple parameters, 68 00:03:03,310 --> 00:03:06,050 they would be separated by commas. 69 00:03:06,050 --> 00:03:07,840 Notice we say nothing at all 70 00:03:07,840 --> 00:03:10,130 about the type of that parameter 71 00:03:10,130 --> 00:03:13,110 which means this function actually could be used 72 00:03:13,110 --> 00:03:14,980 for example with integers, 73 00:03:14,980 --> 00:03:17,980 but it could also be used with floating point numbers. 74 00:03:17,980 --> 00:03:20,570 If you happen to pass into this function, 75 00:03:20,570 --> 00:03:22,930 something for which we cannot use 76 00:03:22,930 --> 00:03:24,950 the exponentiation operator, 77 00:03:24,950 --> 00:03:27,840 well, then you'll wind up with a syntax error 78 00:03:27,840 --> 00:03:31,900 when the interpreter tries to define the function 79 00:03:31,900 --> 00:03:34,890 based on the code that you've provided. 80 00:03:34,890 --> 00:03:37,470 Now just like when you have a control statement, 81 00:03:37,470 --> 00:03:39,810 the first line of a function definition 82 00:03:39,810 --> 00:03:41,580 ends with a colon. 83 00:03:41,580 --> 00:03:43,670 In the context of a control statement, 84 00:03:43,670 --> 00:03:46,060 we call the lines that are indented 85 00:03:46,060 --> 00:03:48,660 within the control statement a suite. 86 00:03:48,660 --> 00:03:50,800 In the context of a function, 87 00:03:50,800 --> 00:03:54,530 we call those lines a block of code. 88 00:03:54,530 --> 00:03:57,080 So a block of code is basically a suite 89 00:03:57,080 --> 00:03:59,510 that belongs to a function for the moment. 90 00:03:59,510 --> 00:04:03,640 And we'll see that classes also have blocks of code as well 91 00:04:03,640 --> 00:04:08,010 when we get to that concept in lesson 10. 92 00:04:08,010 --> 00:04:12,240 So we have the colon, we drop to the next line and indent. 93 00:04:12,240 --> 00:04:17,120 Again, four spaces are the default indentation 94 00:04:17,120 --> 00:04:19,730 and the style guide for Python code 95 00:04:19,730 --> 00:04:23,300 specifically recommends that the very first thing 96 00:04:23,300 --> 00:04:26,962 you place inside the body of your function 97 00:04:26,962 --> 00:04:29,130 is a doc string. 98 00:04:29,130 --> 00:04:32,820 Now you may recall when I introduced triple-quoted strings 99 00:04:32,820 --> 00:04:36,000 that one of the cases for triple-quoted strings 100 00:04:36,000 --> 00:04:38,210 is a documentation string 101 00:04:38,210 --> 00:04:41,338 and this is an example of such a string. 102 00:04:41,338 --> 00:04:44,580 This is a particularly short example. 103 00:04:44,580 --> 00:04:47,460 Sometimes when you have more complex functionality 104 00:04:47,460 --> 00:04:49,430 or functions that you're defining, 105 00:04:49,430 --> 00:04:52,080 you'll have possible paragraphs of text 106 00:04:52,080 --> 00:04:56,770 or much more detail about what a given function does 107 00:04:56,770 --> 00:04:59,760 in a multi-line triple-quoted string 108 00:04:59,760 --> 00:05:01,750 and towards the end of this video, 109 00:05:01,750 --> 00:05:06,750 I'm going to show you how you can access that doc string 110 00:05:07,470 --> 00:05:10,510 through the documentation capabilities 111 00:05:10,510 --> 00:05:13,860 of the Interactive Python interpreter 112 00:05:13,860 --> 00:05:15,600 and in fact, those same capabilities 113 00:05:15,600 --> 00:05:19,372 are available to you through Jupyter Notebooks as well 114 00:05:19,372 --> 00:05:23,270 so here, we have a simply documentation string, 115 00:05:23,270 --> 00:05:25,670 notice the three double-quote characters 116 00:05:25,670 --> 00:05:26,880 on either end here. 117 00:05:26,880 --> 00:05:29,120 Calculate the square of number 118 00:05:29,120 --> 00:05:33,810 and then we have a one additional statement in the body, 119 00:05:33,810 --> 00:05:38,040 a return statement which is going to give a value back 120 00:05:38,040 --> 00:05:40,260 to whoever calls this function. 121 00:05:40,260 --> 00:05:43,670 So just like when we called the sum function 122 00:05:43,670 --> 00:05:46,610 in the preceding lesson to calculate 123 00:05:46,610 --> 00:05:49,220 the sum of the numbers inside of a list, 124 00:05:49,220 --> 00:05:52,210 and it gave us back the total, the sum, 125 00:05:52,210 --> 00:05:54,240 this return statement is going to take 126 00:05:54,240 --> 00:05:57,110 whatever number the square function receives 127 00:05:57,110 --> 00:05:58,880 and it will use that value 128 00:05:58,880 --> 00:06:00,450 and it will square that value 129 00:06:00,450 --> 00:06:03,900 and then give back that value that it calculates 130 00:06:03,900 --> 00:06:06,420 to whoever calls that function. 131 00:06:06,420 --> 00:06:11,150 Now, when you execute a snippet that defines a function, 132 00:06:11,150 --> 00:06:15,880 executing that literally just brings the function to life. 133 00:06:15,880 --> 00:06:19,420 It is now something that can be executed. 134 00:06:19,420 --> 00:06:21,610 It exists at this point. 135 00:06:21,610 --> 00:06:25,210 But until you actually call it, nothing happens. 136 00:06:25,210 --> 00:06:28,450 So for example, if I go ahead and say square 137 00:06:28,450 --> 00:06:31,620 and I give it the value seven, woops, 138 00:06:31,620 --> 00:06:32,630 sorry about that, 139 00:06:32,630 --> 00:06:35,230 I give it the value seven and then I press enter, 140 00:06:35,230 --> 00:06:38,770 you can see that I get, as a result, 49. 141 00:06:38,770 --> 00:06:42,350 Now, I could have assigned that result to a variable. 142 00:06:42,350 --> 00:06:46,050 In this case I simply at IPython display the value 143 00:06:46,050 --> 00:06:49,600 and this is a really handy way to develop a function 144 00:06:49,600 --> 00:06:52,660 and test it out before you incorporate it 145 00:06:52,660 --> 00:06:56,023 into a more robust application. 146 00:06:56,910 --> 00:06:59,660 As I mentioned, this function does not care 147 00:06:59,660 --> 00:07:03,120 what type of number you give it, so, for example, 148 00:07:03,120 --> 00:07:06,470 I can say square and give it 2.5, 149 00:07:06,470 --> 00:07:08,190 which is a floating point number 150 00:07:08,190 --> 00:07:10,250 and it will happily give me back 151 00:07:10,250 --> 00:07:11,760 a floating point number as well. 152 00:07:11,760 --> 00:07:13,170 So if I give it an integer, 153 00:07:13,170 --> 00:07:14,900 it will give me back and integer. 154 00:07:14,900 --> 00:07:17,143 If it give it a floating point number, 155 00:07:17,143 --> 00:07:18,380 it'll give me back a floating point number 156 00:07:18,380 --> 00:07:21,200 and by the way, if I give it a decimal, 157 00:07:21,200 --> 00:07:24,870 it will calculate the square of that decimal value 158 00:07:24,870 --> 00:07:28,030 and give me back the squared decimal value 159 00:07:28,030 --> 00:07:29,330 in that case as well. 160 00:07:29,330 --> 00:07:33,760 Anything that supports this exponentiation operator 161 00:07:33,760 --> 00:07:36,570 can be passed into the square function 162 00:07:36,570 --> 00:07:39,240 as an argument to the function. 163 00:07:39,240 --> 00:07:41,600 Each argument you pass to a function 164 00:07:41,600 --> 00:07:45,010 gets assigned to a corresponding parameter, 165 00:07:45,010 --> 00:07:49,050 so when I pass the argument seven to the square function, 166 00:07:49,050 --> 00:07:51,600 number gets assigned the value seven, 167 00:07:51,600 --> 00:07:53,740 so I'm doing seven squared down here 168 00:07:53,740 --> 00:07:55,880 and when this return statement executes 169 00:07:55,880 --> 00:07:57,990 the value is returned back 170 00:07:57,990 --> 00:07:59,810 to the snippet number two, 171 00:07:59,810 --> 00:08:01,680 where the IPython Interpreter 172 00:08:01,680 --> 00:08:04,957 then uses that value as the output result 173 00:08:04,957 --> 00:08:08,220 and the same basic thing is happening down here 174 00:08:08,220 --> 00:08:10,423 in snippet three as well. 175 00:08:11,730 --> 00:08:14,670 Now, one thing to know about Python 176 00:08:14,670 --> 00:08:17,540 that's a little different from other languages 177 00:08:17,540 --> 00:08:22,060 is that when you return from a function 178 00:08:22,060 --> 00:08:24,170 to the caller of that function, 179 00:08:24,170 --> 00:08:28,530 something is always returned back to the caller, 180 00:08:28,530 --> 00:08:32,100 whether you have a return statement or not. 181 00:08:32,100 --> 00:08:34,080 If you have a return statement, 182 00:08:34,080 --> 00:08:37,210 then the expression to the right of the return 183 00:08:37,210 --> 00:08:40,560 is what is going to be given back to the caller. 184 00:08:40,560 --> 00:08:43,150 If there is no expression, 185 00:08:43,150 --> 00:08:47,910 there's actually a value in Python called None 186 00:08:47,910 --> 00:08:52,140 that gets returned, so that's actually an object 187 00:08:52,140 --> 00:08:53,860 that represents nothing 188 00:08:53,860 --> 00:08:56,300 and you can actually use that in your code 189 00:08:56,300 --> 00:08:58,600 to test and see whether a function 190 00:08:58,600 --> 00:09:00,990 returns something or not, 191 00:09:00,990 --> 00:09:03,680 if you need to test for things like that 192 00:09:03,680 --> 00:09:08,490 and we'll use the None value in later lessons. 193 00:09:08,490 --> 00:09:12,170 So if I have an empty return statement, 194 00:09:12,170 --> 00:09:14,620 the value None gets returned to the caller, 195 00:09:14,620 --> 00:09:17,950 or if I have no return statement whatsoever, 196 00:09:17,950 --> 00:09:22,533 the value None also gets turned to the caller as well. 197 00:09:23,610 --> 00:09:26,560 Now, the variable number, the parameter number 198 00:09:26,560 --> 00:09:29,410 that we defined back here in the square function 199 00:09:29,410 --> 00:09:34,323 exists only for the lifetime of the function's call 200 00:09:35,470 --> 00:09:37,320 so when you call the function, 201 00:09:37,320 --> 00:09:40,730 the variable number is now available for use. 202 00:09:40,730 --> 00:09:43,360 It receives the argument that you pass. 203 00:09:43,360 --> 00:09:45,870 When the return statement finishes executing, 204 00:09:45,870 --> 00:09:47,800 then the variable number goes away 205 00:09:47,800 --> 00:09:50,980 and I would not be able tot use that down here 206 00:09:50,980 --> 00:09:55,080 in my subsequent snippets of code. 207 00:09:55,080 --> 00:09:56,650 So if I try to go ahead 208 00:09:56,650 --> 00:10:00,950 and auto-complete or tab-complete the word number, 209 00:10:00,950 --> 00:10:04,350 it's not doing anything as I type the tab character here 210 00:10:04,350 --> 00:10:07,490 because it doesn't know what number is 211 00:10:07,490 --> 00:10:11,760 and if by any chance I were to try to evaluate number, 212 00:10:11,760 --> 00:10:14,210 you'll see that you get a NameError 213 00:10:14,210 --> 00:10:16,520 because number does not exist 214 00:10:16,520 --> 00:10:19,840 once a given function call to the square function 215 00:10:19,840 --> 00:10:21,100 completes execution. 216 00:10:21,100 --> 00:10:22,773 It only exists during the call. 217 00:10:24,140 --> 00:10:26,330 Now, another thing I wanna talk about 218 00:10:26,330 --> 00:10:29,060 is, again, this doc string here. 219 00:10:29,060 --> 00:10:32,370 So it turns out that in IPython, 220 00:10:33,910 --> 00:10:38,910 there's a handy character that you can attach to something 221 00:10:39,050 --> 00:10:41,250 to look at its help documentation 222 00:10:41,250 --> 00:10:43,870 and that character is a question mark. 223 00:10:43,870 --> 00:10:46,270 So I can go ahead and type square 224 00:10:46,270 --> 00:10:47,580 followed by a question mark, 225 00:10:47,580 --> 00:10:50,460 square being the name of my function, 226 00:10:50,460 --> 00:10:53,870 and automatically, the IPython Interpreter 227 00:10:53,870 --> 00:10:57,170 will display information like what you see here. 228 00:10:57,170 --> 00:10:59,540 The first piece of information that gives me 229 00:10:59,540 --> 00:11:02,150 is the signature of the function. 230 00:11:02,150 --> 00:11:04,660 The signature is the name of the function 231 00:11:04,660 --> 00:11:08,890 and what parameters it expects to receive. 232 00:11:08,890 --> 00:11:11,730 So, that is something that as we'll talk about 233 00:11:11,730 --> 00:11:13,970 in more detail later, is important 234 00:11:13,970 --> 00:11:17,970 because it helps Python decide which function gets called 235 00:11:17,970 --> 00:11:21,760 when you have an expression like here in snippet two 236 00:11:21,760 --> 00:11:23,090 or snippet three. 237 00:11:23,090 --> 00:11:25,440 So it's going to look, in particular, 238 00:11:25,440 --> 00:11:27,220 for a function with the name square 239 00:11:27,220 --> 00:11:30,000 that takes one argument in each of these cases 240 00:11:30,000 --> 00:11:33,200 and we have a square function that takes one argument 241 00:11:33,200 --> 00:11:35,640 or one parameter, I should say, called number 242 00:11:35,640 --> 00:11:37,520 in this particular case. 243 00:11:37,520 --> 00:11:39,830 The next thing it shows you is the doc string 244 00:11:39,830 --> 00:11:41,320 associated with that function 245 00:11:41,320 --> 00:11:45,110 so even for example using the sum function 246 00:11:45,110 --> 00:11:47,860 that's built into Python, 247 00:11:47,860 --> 00:11:50,650 I can go ahead and say sum question mark 248 00:11:50,650 --> 00:11:53,770 and get details about that function 249 00:11:53,770 --> 00:11:55,890 that's built into the language. 250 00:11:55,890 --> 00:11:58,960 I won't go into the details of what's going on here, 251 00:11:58,960 --> 00:12:01,730 but you can see that it's giving me the doc string, 252 00:12:01,730 --> 00:12:04,550 which for the sum function, is a little bit more elaborate 253 00:12:04,550 --> 00:12:07,240 than what I had for my square function up above. 254 00:12:07,240 --> 00:12:09,550 It also tells you the type of that item 255 00:12:09,550 --> 00:12:12,150 is a built-in function or method, 256 00:12:12,150 --> 00:12:14,270 something that's built into Python 257 00:12:14,270 --> 00:12:17,940 as opposed to a function that I defined myself 258 00:12:17,940 --> 00:12:20,223 back up above in this session. 259 00:12:21,420 --> 00:12:24,010 If the source code for the function 260 00:12:24,010 --> 00:12:25,350 is available to you, 261 00:12:25,350 --> 00:12:27,330 you can also take this a step further 262 00:12:27,330 --> 00:12:29,350 and use two question marks, 263 00:12:29,350 --> 00:12:32,280 in which case, not only will it give you 264 00:12:32,280 --> 00:12:34,410 the signature of the function, 265 00:12:34,410 --> 00:12:37,980 it will give you the full source definition 266 00:12:37,980 --> 00:12:40,000 of that function as well. 267 00:12:40,000 --> 00:12:43,326 So here is the actual definition of the function. 268 00:12:43,326 --> 00:12:45,820 By the way, up above, it did this as well. 269 00:12:45,820 --> 00:12:49,150 It's telling me where this function is defined. 270 00:12:49,150 --> 00:12:53,050 In my case, I'm working in the Chapter Four folder 271 00:12:53,050 --> 00:12:55,490 which is the set of examples 272 00:12:55,490 --> 00:12:58,010 that correspond to Lesson Four of these videos 273 00:12:58,010 --> 00:13:01,180 and it's telling me that the function was defined 274 00:13:01,180 --> 00:13:04,080 in IPython input number one, 275 00:13:04,080 --> 00:13:07,130 which was snippet number one back up here, 276 00:13:07,130 --> 00:13:09,970 so that's what this information means. 277 00:13:09,970 --> 00:13:13,860 This last piece is actually a hexadecimal, 278 00:13:13,860 --> 00:13:18,860 unique id code that just identifies the function in memory 279 00:13:19,350 --> 00:13:22,340 and that's something you can simply ignore 280 00:13:22,340 --> 00:13:25,333 in any messages where you see something like this. 281 00:13:26,220 --> 00:13:29,590 But again, it says the type of that thing is function 282 00:13:29,590 --> 00:13:33,180 and I don't believe the sum function is available to us 283 00:13:33,180 --> 00:13:34,830 but we can do ahead and check 284 00:13:34,830 --> 00:13:37,240 and what you see here is it did not give us 285 00:13:37,240 --> 00:13:39,410 the details of the sum function, 286 00:13:39,410 --> 00:13:42,460 so what happens when you use two question marks 287 00:13:42,460 --> 00:13:44,680 and the source code is not available 288 00:13:44,680 --> 00:13:48,240 is it simply gives you the same result 289 00:13:48,240 --> 00:13:50,710 as using a single question mark 290 00:13:50,710 --> 00:13:54,660 to access the health information about that function. 291 00:13:54,660 --> 00:13:57,640 So those are a couple of nice little tricks 292 00:13:57,640 --> 00:13:59,965 that you can use the learn about things. 293 00:13:59,965 --> 00:14:04,965 When you start importing other libraries, 294 00:14:04,990 --> 00:14:09,990 so for example, we had imported the statistics library 295 00:14:10,790 --> 00:14:13,640 back in the preceding lesson, so, 296 00:14:13,640 --> 00:14:17,230 woops, I didn't spell it correctly, there we go. 297 00:14:17,230 --> 00:14:19,800 So if I import the statistics library 298 00:14:19,800 --> 00:14:22,440 and I want to know more about it, 299 00:14:22,440 --> 00:14:24,883 I can go ahead and, 300 00:14:27,070 --> 00:14:29,540 apparently I can't type very well here, 301 00:14:29,540 --> 00:14:31,810 I can learn about the statistics library 302 00:14:31,810 --> 00:14:34,750 by simply typing its name in a question mark 303 00:14:34,750 --> 00:14:39,660 and now it starts giving me more detailed information 304 00:14:39,660 --> 00:14:41,960 about the statistics library. 305 00:14:41,960 --> 00:14:45,310 So as you can see, it's actually not done 306 00:14:45,310 --> 00:14:48,710 giving me information about the statistics library. 307 00:14:48,710 --> 00:14:51,700 When it is done, I'll get my next input prompt back 308 00:14:51,700 --> 00:14:55,120 but I can now simply use the arrow key to move down 309 00:14:55,120 --> 00:14:56,900 or I can press the Space key 310 00:14:56,900 --> 00:14:59,400 to move down in bigger chunks at a time. 311 00:14:59,400 --> 00:15:02,420 Now you can see end at the end here 312 00:15:02,420 --> 00:15:03,940 and, excuse me, 313 00:15:03,940 --> 00:15:06,570 when the end is displayed, 314 00:15:06,570 --> 00:15:08,640 you can go ahead and type a Q 315 00:15:08,640 --> 00:15:12,550 and it will return you back to prompt 316 00:15:12,550 --> 00:15:16,280 so that you can input your next snippet of code 317 00:15:16,280 --> 00:15:18,810 in the current IPython session. 318 00:15:18,810 --> 00:15:23,210 So if the full documentation can be displayed all at once, 319 00:15:23,210 --> 00:15:26,900 it will automatically give you your input prompt back 320 00:15:26,900 --> 00:15:29,710 if the full documentation cannot be displayed 321 00:15:29,710 --> 00:15:31,460 in the vertical amount of space 322 00:15:31,460 --> 00:15:33,380 available to you on your screen. 323 00:15:33,380 --> 00:15:35,160 Then you'll simply see a colon, 324 00:15:35,160 --> 00:15:38,620 until eventually the documentation has been full displayed. 325 00:15:38,620 --> 00:15:40,440 Then you'll see that word end 326 00:15:40,440 --> 00:15:45,193 and you just press the Q to quit from the Help system.