1 00:00:00,920 --> 00:00:07,310 Biton input, output and input, we know that each and every programming language, we are supposed 2 00:00:07,310 --> 00:00:13,730 to have some input statements to take data from the environment, from the keyboard, from the users 3 00:00:13,880 --> 00:00:15,580 who are interacting with the application. 4 00:00:16,100 --> 00:00:19,340 And we should produce some output of the processing, the input. 5 00:00:19,490 --> 00:00:22,770 We should produce some output in some representable form. 6 00:00:23,300 --> 00:00:30,590 So how to get this input from the keyboard and produce output for the visualization to the users in 7 00:00:30,590 --> 00:00:31,130 Python? 8 00:00:31,250 --> 00:00:34,580 We are going to discuss that one in our respective video. 9 00:00:35,210 --> 00:00:36,360 So what about input? 10 00:00:36,680 --> 00:00:40,770 Sometimes we believe on the usability of our programming code. 11 00:00:41,060 --> 00:00:47,390 We shall divide our program, a large program into smaller models, and those models will be used by 12 00:00:47,390 --> 00:00:52,700 the other python codes by importing those models in their respective Cordier. 13 00:00:53,030 --> 00:00:54,600 So let us go for that discussion. 14 00:00:55,550 --> 00:01:01,700 So some of the functions, like our input, function and brain functions, are widely used for standard 15 00:01:01,700 --> 00:01:03,870 input and output operations respectively. 16 00:01:04,580 --> 00:01:11,990 When our program goes big bigger, it is a good idea to break it into different models for the easy 17 00:01:11,990 --> 00:01:18,950 understanding, for the easy debugging and for for the easy handling of our code for the user program. 18 00:01:18,950 --> 00:01:26,120 Development definitions inside the model can be imported to another model or the interactive interpreter 19 00:01:26,120 --> 00:01:33,270 in Python, and we use the input keyword to import that external model to the current code. 20 00:01:33,680 --> 00:01:37,070 So to have a better idea, let us go for one practical demonstration. 21 00:01:37,280 --> 00:01:43,730 Very shall be showing you that how to take inputs, how to put the outputs on the screen, and how we 22 00:01:43,730 --> 00:01:46,940 are going to import our models in our current code. 23 00:01:47,330 --> 00:01:48,850 So here is a demonstration for you. 24 00:01:49,520 --> 00:01:56,360 We're going to discuss the print function and its usage to print a sentence or to print a variable value 25 00:01:56,600 --> 00:01:57,370 on the screen. 26 00:01:57,380 --> 00:02:03,260 We use the method print, so print this sentence is output to that screen here. 27 00:02:03,470 --> 00:02:09,290 So if you go for the execution, you can find that this sentence is output to the screen is equal to 28 00:02:09,290 --> 00:02:09,810 five. 29 00:02:09,830 --> 00:02:13,430 And here you are writing the value up is equal to eight. 30 00:02:13,460 --> 00:02:15,470 So now this five has got printed. 31 00:02:16,040 --> 00:02:18,750 And if you go for this print, one, two, three, four. 32 00:02:18,770 --> 00:02:22,550 So print is producing the outcome as one, two, three, four in this way. 33 00:02:23,390 --> 00:02:28,700 Now see, if I go on writing this one as e this added value up is. 34 00:02:28,700 --> 00:02:35,210 Plus it will produce one error message because it is the type of integer, it is not a string. 35 00:02:35,210 --> 00:02:36,740 So it can be done in this way. 36 00:02:37,060 --> 00:02:37,930 That is it. 37 00:02:38,610 --> 00:02:44,090 Is that because we are converting this to the string type and then we are going to print that one as 38 00:02:44,090 --> 00:02:44,450 this. 39 00:02:45,110 --> 00:02:47,590 So that is not the way to print the same address. 40 00:02:47,780 --> 00:02:49,580 The simple syntax is this one. 41 00:02:52,390 --> 00:02:58,660 These are simple Syntex, you can find that this print and this print, they are coming and the outcome 42 00:02:58,660 --> 00:03:00,790 is coming into two separate rooms. 43 00:03:01,060 --> 00:03:06,370 But if I want to print this one in the same room in which it got printed, in that case, I shall be 44 00:03:06,400 --> 00:03:10,090 right here is equal to and is equal to this. 45 00:03:10,270 --> 00:03:16,950 That means the string, which is having one default slash in that is a new line character as that as 46 00:03:16,950 --> 00:03:18,980 the trailing new character by default. 47 00:03:19,180 --> 00:03:21,490 So I'm just replacing that one using null. 48 00:03:21,730 --> 00:03:22,920 So now what will happen? 49 00:03:23,230 --> 00:03:26,080 These two lines will get printed in the same room. 50 00:03:26,290 --> 00:03:31,900 So now if I put this one has this so you can find that the outcome is coming, something like this one 51 00:03:32,200 --> 00:03:37,240 address, if you don't mention in the end here, then they'll get printed in separate lines. 52 00:03:39,580 --> 00:03:45,430 Not one, two report anticipated here it is, star, so print one, two, three, four, separated. 53 00:03:45,460 --> 00:03:50,060 Here he starts to print as one starts to start. 54 00:03:50,120 --> 00:03:52,280 Three Starford and this way. 55 00:03:52,330 --> 00:03:57,580 So here you have given the and if you give the separated as comma, if you give the separated us comite, 56 00:03:57,580 --> 00:04:00,810 you see that they get separated by this comma and blank spaces. 57 00:04:00,820 --> 00:04:03,520 If it is so, so they'll get separated in this way. 58 00:04:04,060 --> 00:04:09,340 So separated is actually indicating that will the what character you are supposed to get within the 59 00:04:10,060 --> 00:04:11,980 within the variables are the values. 60 00:04:11,980 --> 00:04:17,840 When you get printed using the print statement here you are having this hash as a separate at an end 61 00:04:18,100 --> 00:04:19,410 with this ampersand. 62 00:04:19,630 --> 00:04:27,490 So they had this hash, as we saw before, that this is a separate and this ampersand is coming as the 63 00:04:27,490 --> 00:04:28,680 respective end one. 64 00:04:29,050 --> 00:04:31,000 So that's why it is getting printed in this we. 65 00:04:34,020 --> 00:04:40,080 Next one I love, this is my placeholder, and the placeholder number is zero and the placeholder number 66 00:04:40,080 --> 00:04:45,810 is one who had this braid will be the will be at the zero place, will be replacing the zero placeholder 67 00:04:45,990 --> 00:04:48,960 and his partner will be replaced as that one placeholder. 68 00:04:49,350 --> 00:04:50,640 So we can find that it is coming. 69 00:04:50,640 --> 00:04:53,120 It is producing the output, something like this. 70 00:04:53,910 --> 00:04:55,350 So I love one. 71 00:04:55,360 --> 00:04:57,140 I love one and zero. 72 00:04:57,180 --> 00:04:58,610 So here we are having the same. 73 00:04:58,620 --> 00:05:00,090 So I love butter and bread. 74 00:05:00,090 --> 00:05:04,620 In this way it is by default it will be taking this one need not to mention any kind of placeholder 75 00:05:04,620 --> 00:05:11,700 here so we can find out what the strings are getting printed accordingly here to pass this bread at 76 00:05:11,700 --> 00:05:12,480 first in butter. 77 00:05:12,480 --> 00:05:15,230 So bread is coming down here and butter is coming down here. 78 00:05:15,870 --> 00:05:18,120 So now here to see this is my bread. 79 00:05:18,540 --> 00:05:20,340 So this bread, is that the Delaplane? 80 00:05:20,350 --> 00:05:24,140 So it will be coming down here and butter, this is the first. 81 00:05:24,150 --> 00:05:27,210 So if it is at the right place, it is at the index one. 82 00:05:27,570 --> 00:05:30,270 So this year the butter will be coming here accordingly. 83 00:05:30,570 --> 00:05:36,420 So you can find out how this respective placeholders and the respective values are getting related in 84 00:05:36,420 --> 00:05:36,810 this way. 85 00:05:37,020 --> 00:05:39,270 So we can get the idea that. 86 00:05:41,500 --> 00:05:47,200 Without mentioning any placeholder number, if you can just mention them, the book, these two lines 87 00:05:47,200 --> 00:05:48,970 will produce the same output as well. 88 00:05:49,150 --> 00:05:51,120 Will these two lines will produce the same output. 89 00:05:51,520 --> 00:05:55,680 But in this case, Red will be will be at the Ziliak Index here. 90 00:05:55,780 --> 00:06:00,590 The placeholder GELO will be taken this spread and his partner is at the index number one. 91 00:06:00,940 --> 00:06:03,540 So that's why it will be taking out a placeholder one. 92 00:06:03,550 --> 00:06:05,500 It will be replacing the placeholder one. 93 00:06:05,650 --> 00:06:08,230 So in this way, the outcome is getting different. 94 00:06:10,270 --> 00:06:16,210 Next, how to take input from the keyboard in that case, we can we can use the input method, we can 95 00:06:16,210 --> 00:06:17,440 use the input method here. 96 00:06:17,890 --> 00:06:24,130 So using this input and as a prompt, we're having and using this input, we're getting the value from 97 00:06:24,130 --> 00:06:29,990 the keyboard as input and that will be assigned to X and input returns the value in the terms of a string. 98 00:06:30,370 --> 00:06:31,480 So let us go for this. 99 00:06:31,480 --> 00:06:33,580 So I'm just putting this one one hundred. 100 00:06:34,680 --> 00:06:36,940 So we can find that entertaining any number. 101 00:06:36,960 --> 00:06:42,800 So this has come I put this one hundred subindex is printing this one as one hundred. 102 00:06:43,230 --> 00:06:48,360 This is actually getting this one in in the time of the type of string. 103 00:06:48,840 --> 00:06:50,800 So input returns string here. 104 00:06:50,820 --> 00:06:52,380 So now we can go for this. 105 00:06:53,220 --> 00:07:00,750 If we go for this, why if they want to convert it to this integer, I can do that one in the gives. 106 00:07:00,750 --> 00:07:02,040 The typecasting is equal. 107 00:07:02,070 --> 00:07:06,270 That is the method conversion method from string to digit be required here. 108 00:07:08,530 --> 00:07:13,300 So I'm making this one is one hundred, I'm giving this one as two hundred, you can find that this 109 00:07:13,300 --> 00:07:15,360 one hundred and two hundred will get printed. 110 00:07:15,640 --> 00:07:17,290 I'm just repurposing it by white. 111 00:07:20,710 --> 00:07:26,860 So one hundred is nothing but hair string, and this two hundred is nothing but here indigent because 112 00:07:26,860 --> 00:07:29,710 we have done the typecasting accordingly using the method. 113 00:07:30,060 --> 00:07:37,520 And so now if we go for the addition, if you go for the print, if you go for this white, then obviously 114 00:07:37,520 --> 00:07:41,800 it will produce some error message because we are trying to do string plus integer. 115 00:07:45,660 --> 00:07:52,050 So that is a tie, Peter, so I want to convert it, I should be converting this one to integer. 116 00:07:53,430 --> 00:08:00,320 So now if I go for the addition, you can find that I'm getting here three hundred as is what others 117 00:08:00,330 --> 00:08:03,030 if convert converted to the string, the other integer one. 118 00:08:03,150 --> 00:08:07,020 If you convert it to the string, then algebraic additions will not take place. 119 00:08:07,020 --> 00:08:08,940 But string concatenation will take this. 120 00:08:12,590 --> 00:08:17,150 You see, the supreme on television has taken place, so in this way you can use the input function 121 00:08:17,150 --> 00:08:24,140 to take the values from the input from the keyboard and default output argument for this input function 122 00:08:24,140 --> 00:08:25,010 will be a string. 123 00:08:26,110 --> 00:08:31,510 Next one, we are having this import, so import not similarly done at the top of the program. 124 00:08:31,660 --> 00:08:38,020 So this math module we have imported and literally from the axis, this power supply means power so 125 00:08:38,020 --> 00:08:43,410 mad that power we can access and that is able to do so in this way. 126 00:08:43,410 --> 00:08:45,580 It will it will make this one as two. 127 00:08:45,790 --> 00:08:47,540 But that is extra to in this case. 128 00:08:47,950 --> 00:08:51,490 So if I make this X is equal to, say, 100 if I make this one. 129 00:08:53,040 --> 00:08:59,220 So here I'm getting this one handed to the prop to that is that is of one thousand we're getting this 130 00:08:59,220 --> 00:09:00,000 one is 10000. 131 00:09:00,300 --> 00:09:02,120 So that is my math duckbill. 132 00:09:02,370 --> 00:09:08,640 So this math is nothing but one model and the model will be imported by the, quote, import and later. 133 00:09:09,530 --> 00:09:15,820 This method, which is defining this model map, can be accessed using that is a matter metadata power, 134 00:09:16,070 --> 00:09:19,130 and this is my respective first argument. 135 00:09:19,160 --> 00:09:23,440 It is a second argument and it is working as fast argument to the second argument. 136 00:09:23,750 --> 00:09:26,760 So as a value up here it is one hundred. 137 00:09:26,790 --> 00:09:32,540 So I'm getting the ten thousand as AZAPO and we can find that this power is returning a value of the 138 00:09:32,540 --> 00:09:34,160 type of local supply. 139 00:09:34,280 --> 00:09:39,240 Power is getting a value of the type of if we can obtain it, I'm getting hundred as outcome. 140 00:09:39,770 --> 00:09:47,000 So here to discuss a lot on this print, on this input and also on this import export, watching this 141 00:09:47,000 --> 00:09:47,300 video.