1 00:00:00,150 --> 00:00:07,470 Input function the input function allows to take input from the user. 2 00:00:07,470 --> 00:00:11,960 And this is the syntax for the input function. 3 00:00:12,210 --> 00:00:16,690 So let's call the input function. 4 00:00:16,810 --> 00:00:27,770 I have called the input function and when I executed I have a box here that is displayed in the output. 5 00:00:27,850 --> 00:00:34,480 So because the input function is used to take input from the user. 6 00:00:35,380 --> 00:00:37,630 So let enter Some text here. 7 00:00:37,820 --> 00:00:40,420 I'm gonna see how are you. 8 00:00:40,420 --> 00:00:51,470 And then hit enter the interpreter has displayed what ever text I have entered in the squared box that 9 00:00:51,470 --> 00:00:53,420 was displayed here. 10 00:00:53,420 --> 00:01:03,470 Python has taken the line that I have entered and then printed what ever line it got. 11 00:01:03,950 --> 00:01:07,490 But it is not obvious what is going on here. 12 00:01:08,090 --> 00:01:09,320 So let's do one thing. 13 00:01:09,400 --> 00:01:15,130 Let's assign the input function to a variable and then execute this in. 14 00:01:15,830 --> 00:01:22,570 So I have a squared box again just below the Input cell. 15 00:01:22,880 --> 00:01:25,820 So I'm now going to end it. 16 00:01:25,820 --> 00:01:31,870 How are you and then hit enter now. 17 00:01:32,020 --> 00:01:45,480 Let's display a So the variable E has been assigned the text whatever was input from the keyboard but 18 00:01:45,480 --> 00:01:53,460 in real life the user has to know what a program is asking him or her to enter. 19 00:01:53,850 --> 00:02:00,900 Let's say I'm going to assign the input function to a variable just like we did before. 20 00:02:00,960 --> 00:02:02,960 I'm going to enter this text. 21 00:02:03,060 --> 00:02:12,280 How old did you then execute the cell. 22 00:02:12,420 --> 00:02:21,660 As you can see the text that we have passed as a parameter to the input function is reproduced in front 23 00:02:21,990 --> 00:02:23,670 of the place we type. 24 00:02:23,670 --> 00:02:32,120 And this is called a prompt because it promises to enter something I am hundred and then hit enter. 25 00:02:32,250 --> 00:02:34,610 And now let's display the variable. 26 00:02:35,400 --> 00:02:46,590 So a is a string as you can see it is the number hundred is enclosed in quotes. 27 00:02:46,770 --> 00:02:53,210 Let check the type of the variable a it is a string. 28 00:02:53,210 --> 00:02:54,660 The input function. 29 00:02:54,680 --> 00:02:56,150 Convert. 30 00:02:56,330 --> 00:03:04,340 What about the user has entered into a string so that is the reason the variable e is of the data type 31 00:03:04,640 --> 00:03:05,630 string. 32 00:03:05,630 --> 00:03:15,620 Now if you want to convert into another data type say for example I want to convert the input from the 33 00:03:15,620 --> 00:03:17,660 user into an integer. 34 00:03:18,080 --> 00:03:22,310 I'm gonna pass this message How old are you. 35 00:03:23,150 --> 00:03:33,080 So this will be displayed to the user and I want to convert the message that the user has entered into 36 00:03:33,110 --> 00:03:33,830 an integer. 37 00:03:34,460 --> 00:03:41,920 I'm going to parse the input function as a parameter to the integer function I N D. 38 00:03:41,990 --> 00:03:43,990 So let's execute this. 39 00:03:44,120 --> 00:03:53,540 So I'm gonna say hundred into and then display a it's hundred. 40 00:03:53,540 --> 00:03:58,650 Now check the type of a it's an integer now. 41 00:03:58,970 --> 00:04:06,530 So when the input function is called the program flow will be stored until the user has given an input 42 00:04:07,190 --> 00:04:12,830 and has ended the input with D in case of the Jupiter notebook. 43 00:04:12,830 --> 00:04:22,700 When the user hits the shift and enter keys the text that we have endured here for the input function 44 00:04:23,330 --> 00:04:24,730 is optional. 45 00:04:25,620 --> 00:04:32,360 And the text that we enter here will be reproduced in front of the place we type. 46 00:04:32,430 --> 00:04:38,500 But just call a prompt because it prompts us to enter something. 47 00:04:38,930 --> 00:04:44,540 And this brings us to the end of this tutorial on built in functions.