1 00:00:00,320 --> 00:00:00,990 Hello guys. 2 00:00:01,020 --> 00:00:04,560 Welcome back to another class of our course about Python. 3 00:00:04,560 --> 00:00:06,330 The complete introduction. 4 00:00:06,480 --> 00:00:12,360 So until now we talked about all what other strings we talk about numbers. 5 00:00:12,600 --> 00:00:18,420 And that today we are going to talk about another aspect of programming that is very important. 6 00:00:19,380 --> 00:00:24,860 So and normally when you go let's say on the Web site or anywhere. 7 00:00:25,470 --> 00:00:28,460 What's happening is that you interact with the Web site. 8 00:00:28,920 --> 00:00:33,760 So let's say you are looking at products and then you are interested by certain products. 9 00:00:33,780 --> 00:00:36,580 You click on the product and you go to pay the product. 10 00:00:36,590 --> 00:00:40,980 So the Web site will ask you questions so let's say for example the Web site asks you for your name 11 00:00:40,980 --> 00:00:45,330 your address your method of payment and everything. 12 00:00:45,330 --> 00:00:51,810 You enter all those the Web site will send automatically a receipt to you and will send you a thank 13 00:00:51,810 --> 00:00:57,600 you message and we'll send to the person who owns the Web site a message that someone bought their product. 14 00:00:58,260 --> 00:01:02,080 So how all this works behind the scene. 15 00:01:02,130 --> 00:01:08,850 Well there is a way to reproduce all this on Python and the most basic way to do it will be by using 16 00:01:09,030 --> 00:01:18,910 the input function so the input function will simply allow another user to interact with our let's say 17 00:01:19,090 --> 00:01:19,800 app. 18 00:01:19,840 --> 00:01:25,690 So this way you ask that so you you will be able to ask basically in the most basic basic way you'll 19 00:01:25,720 --> 00:01:29,600 be able to ask questions to your user. 20 00:01:29,710 --> 00:01:33,100 So let's look what all this looks like. 21 00:01:33,220 --> 00:01:35,350 So how do you write an input function. 22 00:01:35,350 --> 00:01:36,450 It's very simple. 23 00:01:36,680 --> 00:01:38,900 So it's gonna be written like this. 24 00:01:38,900 --> 00:01:44,800 So it's just input and you write down the text that well you write down what you want to ask from the 25 00:01:44,800 --> 00:01:49,370 person let's say for example we want to ask from the person what is their age. 26 00:01:49,420 --> 00:01:54,790 So what is your age. 27 00:01:54,910 --> 00:01:57,590 So it looks something like this. 28 00:01:57,910 --> 00:02:00,460 And if you want to print it you simply write down print 29 00:02:03,220 --> 00:02:04,890 and you print your function. 30 00:02:04,900 --> 00:02:05,160 All right. 31 00:02:05,410 --> 00:02:09,070 So as you can see here we ask the person their age. 32 00:02:09,100 --> 00:02:10,490 The program is still running. 33 00:02:10,540 --> 00:02:17,710 So right now we'll answer let's say the age of the person is 20 years old and you click on enter that's 34 00:02:17,710 --> 00:02:17,890 it. 35 00:02:17,920 --> 00:02:20,530 So the program is done to process finished. 36 00:02:20,710 --> 00:02:22,690 The answer is 20. 37 00:02:22,720 --> 00:02:28,540 So in this case with it's something that is very very simple we print it up directly the input but let's 38 00:02:28,540 --> 00:02:29,980 say we want to make it a bit. 39 00:02:30,070 --> 00:02:37,030 Well not more complicated a bit more cool and instead of just printing what is your age. 40 00:02:37,030 --> 00:02:39,810 Just printing this and then printing the answer. 41 00:02:40,120 --> 00:02:45,030 We want to print and we want to put our input into a variable. 42 00:02:45,310 --> 00:02:49,900 So let's say in this case with we will put it in the variable age 43 00:02:53,250 --> 00:02:55,140 so we'll say age equal 44 00:02:57,820 --> 00:03:01,270 and in this case will be input. 45 00:03:01,390 --> 00:03:04,380 What is your age. 46 00:03:04,630 --> 00:03:09,300 All right so right now we have this. 47 00:03:09,350 --> 00:03:11,590 So in this case it's age. 48 00:03:11,900 --> 00:03:15,540 So our variable age is equal to the input. 49 00:03:15,620 --> 00:03:17,660 What is your age. 50 00:03:17,660 --> 00:03:17,960 All right. 51 00:03:18,680 --> 00:03:22,400 So what exactly do we want to print. 52 00:03:22,460 --> 00:03:25,880 So right now we have let's say we want to print our age. 53 00:03:25,880 --> 00:03:28,810 So our variable age and we run the up. 54 00:03:28,970 --> 00:03:30,860 So the exact same thing will appear here. 55 00:03:30,890 --> 00:03:31,990 Let's say Write down 20. 56 00:03:32,060 --> 00:03:33,980 And that's at the up ends like this. 57 00:03:33,980 --> 00:03:40,040 Let's say I want to make something let's say I want to make it a bit more cooler so we can write down 58 00:03:41,270 --> 00:03:42,920 my age is 59 00:03:45,550 --> 00:03:51,110 plus our variable age and we can just run the up. 60 00:03:51,160 --> 00:03:52,260 What is your age. 61 00:03:52,270 --> 00:03:56,150 Write down 20 as you can see my age is 20. 62 00:03:56,160 --> 00:03:59,870 This is just you. 63 00:04:00,570 --> 00:04:02,790 And as you can see my age is 20. 64 00:04:02,830 --> 00:04:10,100 So basically we just asked a question to the person that is let's say in front of us right now let's 65 00:04:10,100 --> 00:04:13,070 say you want to do it a bit more cool. 66 00:04:13,100 --> 00:04:14,500 So just practice it. 67 00:04:14,690 --> 00:04:20,320 Let's create let's say I don't know ask a person what this person wants to eat. 68 00:04:20,330 --> 00:04:27,710 So in this case will well eat drink and let's say ask that person their name where they want to eat 69 00:04:27,770 --> 00:04:29,260 and their age. 70 00:04:29,270 --> 00:04:29,530 All right. 71 00:04:30,920 --> 00:04:34,340 So first of all we need to define our variables. 72 00:04:34,340 --> 00:04:38,550 So the first variable will be name. 73 00:04:38,570 --> 00:04:40,290 So ask the person their name. 74 00:04:40,290 --> 00:04:47,480 So input and the person will write down what is your name 75 00:04:50,930 --> 00:04:51,830 the age of the person. 76 00:04:51,840 --> 00:04:56,010 So the second variable that we are going to look at will be the age of the person. 77 00:04:56,010 --> 00:05:03,220 So once again input and then write down what is your age. 78 00:05:03,420 --> 00:05:04,200 Third input. 79 00:05:04,590 --> 00:05:05,820 So what. 80 00:05:05,820 --> 00:05:08,580 So in this case food 81 00:05:11,380 --> 00:05:15,060 in this case will ask the person once again what an input. 82 00:05:15,160 --> 00:05:26,310 So what do you want to eat and finally our last question will be what do you want to drink. 83 00:05:29,860 --> 00:05:31,900 So what do you 84 00:05:36,060 --> 00:05:40,080 let's just call it a drink drink. 85 00:05:41,250 --> 00:05:44,130 What do you want 86 00:05:48,250 --> 00:05:49,020 to drink. 87 00:05:51,240 --> 00:05:53,660 Right so you get the point on C and it's very simple 88 00:05:58,530 --> 00:05:58,830 good. 89 00:05:59,220 --> 00:06:05,040 So right now what exactly we want our app to print us because right now we have our variables which 90 00:06:05,130 --> 00:06:06,330 are right here. 91 00:06:06,330 --> 00:06:09,410 Name each food drink you want. 92 00:06:10,890 --> 00:06:21,870 We want to print a let's say not a statement but a basic sentence which will say Hello my name is 93 00:06:24,660 --> 00:06:28,230 just below so here we will have a string. 94 00:06:28,230 --> 00:06:31,350 So hello my name 95 00:06:35,370 --> 00:06:45,960 is and the first thing I want to do is a plus and I want to add the variable name and we continue our 96 00:06:45,960 --> 00:06:46,470 sentence 97 00:06:50,040 --> 00:06:55,710 by yam this time we'll add the variable H. 98 00:06:55,940 --> 00:06:56,990 We'll continue our sentence 99 00:07:01,170 --> 00:07:10,300 I want to eat here we'll continue our sentence so we add food our third variable 100 00:07:14,160 --> 00:07:16,830 and I want to drink 101 00:07:21,710 --> 00:07:26,640 and we add our last variable which will be drink good. 102 00:07:27,060 --> 00:07:35,450 So right now we have our basic set up which will simply print what the person wants to eat and to drink. 103 00:07:35,560 --> 00:07:40,690 Well what's the name of the person the age of the person what the person wants to eat and to drink. 104 00:07:40,740 --> 00:07:42,920 So very important simply add those. 105 00:07:42,960 --> 00:07:48,100 Well if you want to look good not forget to add space. 106 00:07:48,120 --> 00:07:55,550 Because if not you'll see everything will be too close. 107 00:07:55,670 --> 00:07:56,490 Great. 108 00:07:56,510 --> 00:08:00,010 So after that simply click on plain. 109 00:08:00,060 --> 00:08:02,280 So first question What is your name. 110 00:08:02,280 --> 00:08:05,570 So in this case let's say my name is. 111 00:08:06,330 --> 00:08:10,460 I don't know Max what is your age. 112 00:08:10,500 --> 00:08:11,540 I'm 35. 113 00:08:13,500 --> 00:08:17,600 What do you want to eat pizza. 114 00:08:17,730 --> 00:08:20,060 And finally what do you want to drink. 115 00:08:20,080 --> 00:08:23,570 Caller Hello my name is Max. 116 00:08:23,580 --> 00:08:24,680 I am thirty five. 117 00:08:24,690 --> 00:08:25,780 I want to eat pizza. 118 00:08:25,800 --> 00:08:27,140 I want to drink cola. 119 00:08:27,360 --> 00:08:32,820 So as you can see here we created a small app that will generate the name of the person the age of the 120 00:08:32,820 --> 00:08:36,630 person what the person wants to eat and what the person wants to drink. 121 00:08:36,630 --> 00:08:39,360 All this with the simply the function. 122 00:08:39,360 --> 00:08:41,790 All this simple with the input function. 123 00:08:41,820 --> 00:08:48,420 So once again as I explained before this allow us to talk with the well this allow us to talk with the 124 00:08:48,420 --> 00:08:54,590 person who is behind the apps or the person the user the person who will use the app. 125 00:08:54,600 --> 00:09:01,560 So once again what I just saw you slow up is the basic of the basic in Python and what you can do with 126 00:09:01,560 --> 00:09:06,330 the input function you'll see the more we're going to advance in this course the more you will do cool 127 00:09:06,330 --> 00:09:07,430 stuff. 128 00:09:07,770 --> 00:09:14,040 And as I said this is just the basic of the basic you'll see with the input function you can do a lot 129 00:09:14,040 --> 00:09:15,840 of very interesting things. 130 00:09:15,840 --> 00:09:20,820 And when you put everything one way to put everything that you guys will learn you'll see you'll be 131 00:09:20,820 --> 00:09:22,920 able to do a lot of very very cool stuff. 132 00:09:22,920 --> 00:09:24,300 That's it for this class guys. 133 00:09:24,390 --> 00:09:25,630 And I hope. 134 00:09:25,740 --> 00:09:31,020 Well right now I suggest you to practice what you just saw and see all in our next class.