1 00:00:00,630 --> 00:00:01,060 Hi guys. 2 00:00:01,090 --> 00:00:04,110 Welcome back to another class of our course. 3 00:00:04,120 --> 00:00:06,820 About the complete introduction to Python. 4 00:00:07,720 --> 00:00:15,220 So in this class we are gonna talk principally about variables and the ways that we can store data in 5 00:00:15,820 --> 00:00:21,240 our let's say programming when we are programming on Python All right. 6 00:00:21,300 --> 00:00:24,600 So very basically there is two types of variable that exist. 7 00:00:24,610 --> 00:00:30,930 Well there are more but the major ones will be well those three the first one is the tags that up. 8 00:00:30,960 --> 00:00:34,320 So let's say we have text that we want to print. 9 00:00:34,320 --> 00:00:36,160 This will be our first type of that. 10 00:00:36,180 --> 00:00:43,020 In this case we call it string so a string simply a plain text that we are writing down. 11 00:00:43,260 --> 00:00:50,190 So let's say for example we are printing printing hello world well hello world is a string the second 12 00:00:50,190 --> 00:00:54,150 type of data will be that that can be used for calculations. 13 00:00:54,150 --> 00:00:58,510 So let's say for example we want to calculate things well this type of data will be numbers. 14 00:00:58,650 --> 00:01:01,580 So twenty five twenty thirty five. 15 00:01:01,830 --> 00:01:06,510 Any type of numbers will be plain the plain that sorry will be numbers. 16 00:01:07,470 --> 00:01:09,870 So this type of data is simply numbers. 17 00:01:09,870 --> 00:01:17,460 So every every type of numbers is can be technically numbers data very important to understand also 18 00:01:17,460 --> 00:01:21,700 that numbers could potentially be also string. 19 00:01:21,720 --> 00:01:27,360 So in this case let's say for example you want to write down 20 you can write down 20 as a text or you 20 00:01:27,360 --> 00:01:29,100 can write it down as a number. 21 00:01:29,100 --> 00:01:34,460 The only difference is if you write down if you write it down as a text you won't be able to make calculations 22 00:01:34,470 --> 00:01:36,230 with it because it's a text. 23 00:01:36,270 --> 00:01:37,780 It's not a number. 24 00:01:39,030 --> 00:01:40,560 So very important guys. 25 00:01:40,710 --> 00:01:42,260 When you use those. 26 00:01:42,270 --> 00:01:48,810 Well those those data for example if you use a number well very important to write it down as a number 27 00:01:48,810 --> 00:01:50,000 if you want to make calculations. 28 00:01:50,220 --> 00:01:54,900 If you don't want to make calculations with it simply write it down as a text. 29 00:01:54,900 --> 00:01:58,230 Finally the last step of that will be the boolean data. 30 00:01:58,230 --> 00:02:00,720 This type of data simply returns. 31 00:02:01,050 --> 00:02:06,460 What works with the true and false when you have to use Twin Falls Well this is boolean data. 32 00:02:06,570 --> 00:02:12,210 Once again it won't talk too much about it in this class since we're still talking about basics but 33 00:02:12,210 --> 00:02:14,910 just for you guys to know that it exists. 34 00:02:14,940 --> 00:02:16,310 I'll also show you an example. 35 00:02:16,320 --> 00:02:18,160 Boolean data at the end of this course. 36 00:02:18,180 --> 00:02:24,360 So just for you guys to see what it looks like and for you to understand a little bit to have a visual 37 00:02:24,720 --> 00:02:25,830 of what it looks like. 38 00:02:26,850 --> 00:02:27,160 All right. 39 00:02:27,180 --> 00:02:28,310 So let's start. 40 00:02:28,310 --> 00:02:36,270 So to be able to work with the variables what we want to do we'll write down a simple text for let's 41 00:02:36,270 --> 00:02:45,050 say well we'll just write down a simple text and we'll change variables off in this text. 42 00:02:45,310 --> 00:02:53,380 So 1 what we want to do right now we'll write down a text to someone to ask him about his car and his 43 00:02:53,380 --> 00:02:53,880 house. 44 00:02:54,940 --> 00:02:58,750 So let's say this person is named Mr. Jack. 45 00:02:59,050 --> 00:03:03,070 So we'll say hello Mr. Jack 46 00:03:15,420 --> 00:03:21,300 I am very interested by your car 47 00:03:27,680 --> 00:03:29,060 is it red 48 00:03:39,140 --> 00:03:39,730 also. 49 00:03:40,040 --> 00:03:45,910 Mr. Jack is your house 50 00:03:50,060 --> 00:03:53,990 older than 20 years. 51 00:03:54,350 --> 00:03:54,670 Oh 52 00:04:02,610 --> 00:04:04,380 thank you Mr. Jackson. 53 00:04:04,380 --> 00:04:10,080 Thank you Mr. Jack. 54 00:04:10,090 --> 00:04:10,420 All right. 55 00:04:10,930 --> 00:04:19,570 So right now we have our very basic text once again that's just a very very basic text from here. 56 00:04:19,600 --> 00:04:27,550 What we want to do is simply change let's say some words by variables that will y we'll do this is let's 57 00:04:27,550 --> 00:04:29,560 say for example right now it's just four lines. 58 00:04:29,560 --> 00:04:36,250 But let's say you have one hundred lines of text and you have words that you want to change at major 59 00:04:36,250 --> 00:04:36,720 places. 60 00:04:36,760 --> 00:04:38,670 Or for example you have e-mail. 61 00:04:38,700 --> 00:04:44,370 So you have models of e-mails and you want to add names in those e-mails so let's say Hello Mr.. 62 00:04:44,380 --> 00:04:46,340 And you want to write down in name. 63 00:04:46,570 --> 00:04:52,090 So you have templates of e-mails and you want to let's say change the name or change anything in this 64 00:04:52,090 --> 00:04:52,960 template. 65 00:04:52,960 --> 00:04:54,310 Well this is a way to do it. 66 00:04:55,210 --> 00:04:56,820 So very simple. 67 00:04:57,190 --> 00:05:03,020 What you want to do here is simply identify your variables so the first thing as I showed you the up 68 00:05:03,170 --> 00:05:06,580 work so I'm able to generate my app right here. 69 00:05:06,790 --> 00:05:15,970 So right now the next thing that I want to do is very simple is identify my variables. 70 00:05:15,980 --> 00:05:18,940 So whatever variables I have here I have the name. 71 00:05:18,980 --> 00:05:23,900 So person's name our first variable will be person name. 72 00:05:23,930 --> 00:05:27,650 So we want to create our variables we are creating our variables right now. 73 00:05:27,680 --> 00:05:28,640 So how we do this. 74 00:05:28,640 --> 00:05:35,870 First of all we write the name of the variable we write down equal and we write down the name that we 75 00:05:35,870 --> 00:05:36,470 want to create. 76 00:05:37,250 --> 00:05:41,260 So in this case it's Mr. Jack. 77 00:05:41,300 --> 00:05:45,880 So this is the name of our first variable so the person's name is Mr. Jack. 78 00:05:46,250 --> 00:05:47,340 All right. 79 00:05:47,360 --> 00:05:53,210 The first the next variable that we want to change will be car. 80 00:05:53,210 --> 00:05:57,320 So object one in this case will we'll call it Object 81 00:06:00,190 --> 00:06:00,490 82 00:06:03,470 --> 00:06:05,380 and what is Object 1. 83 00:06:05,510 --> 00:06:09,030 So in this case Object 1 is a string data called core. 84 00:06:09,260 --> 00:06:12,150 So we have to string that is right here. 85 00:06:12,170 --> 00:06:15,150 Next thing we want to change is the color. 86 00:06:15,230 --> 00:06:22,150 So we'll call this the this variable object. 87 00:06:23,540 --> 00:06:32,350 One color and in this case the color of the object one is red. 88 00:06:33,580 --> 00:06:39,880 So as you can see what I'm doing right now I am naming my variable so I'm I have my variable and I named 89 00:06:39,880 --> 00:06:40,590 my variable. 90 00:06:40,600 --> 00:06:42,690 This is the data that I store in my variable. 91 00:06:42,790 --> 00:06:46,080 So I have the variable and the data stored in. 92 00:06:46,870 --> 00:06:47,680 All right. 93 00:06:47,680 --> 00:06:53,400 Next thing we have our fourth variable which is house. 94 00:06:53,410 --> 00:06:56,740 In this case we'll write down object 95 00:07:00,660 --> 00:07:02,820 name to 96 00:07:06,840 --> 00:07:09,720 so in this case what's the name of the say an object. 97 00:07:11,200 --> 00:07:12,130 Well it's very simple. 98 00:07:12,130 --> 00:07:14,650 It's house. 99 00:07:14,650 --> 00:07:21,230 Next thing we're looking for is our in each of our let's say a house. 100 00:07:21,250 --> 00:07:27,700 So it's 20 so object in this case the name will be object 101 00:07:31,790 --> 00:07:36,470 to age equal. 102 00:07:36,890 --> 00:07:38,310 In this case it's 20. 103 00:07:38,420 --> 00:07:40,130 So I can write down 20 in two ways. 104 00:07:40,150 --> 00:07:41,880 I can write it down just like this. 105 00:07:42,050 --> 00:07:50,210 Since this type of variable is a number so I can leave it like this or I can write it as a string. 106 00:07:53,330 --> 00:07:58,550 So in this case we'll write it as a string because I want to write down 20 years or so I'll write down 107 00:07:58,550 --> 00:08:08,360 the complete verbal 20 years old presidency I have my fifth variable and then I can use it as a number 108 00:08:08,360 --> 00:08:14,130 so for example I want to say also Mr. Jack is your house older than I can just change a 20. 109 00:08:14,220 --> 00:08:16,060 But I want to change the 20 years old as well. 110 00:08:17,610 --> 00:08:19,510 All right the less variable. 111 00:08:19,700 --> 00:08:21,640 Well we don't have any variables anymore. 112 00:08:21,710 --> 00:08:22,370 So that's it. 113 00:08:22,370 --> 00:08:27,770 We have our five five variables what we want to do now is add those variables to our text right here 114 00:08:27,800 --> 00:08:31,390 well to our small upright here since this is a map. 115 00:08:31,460 --> 00:08:37,170 So if I run the app it will come back the same way because we didn't add those variables here. 116 00:08:37,190 --> 00:08:37,450 All right. 117 00:08:37,490 --> 00:08:42,090 So the first place where what we want to change will be the person's name. 118 00:08:42,150 --> 00:08:44,450 In this case it's Mr. Jack. 119 00:08:44,510 --> 00:08:48,380 So what I want to do was simply write down our text. 120 00:08:48,380 --> 00:08:50,600 So our first birth which is Hello. 121 00:08:50,660 --> 00:09:00,680 Then we add a plus and then we add a person's name so which is our first variable so hello first plus 122 00:09:00,710 --> 00:09:03,170 first variable all right. 123 00:09:03,710 --> 00:09:11,090 Second second sentence I am very interested by your SO in this case we'll use the second variable which 124 00:09:11,120 --> 00:09:15,290 is correct so we'll add our plus right here. 125 00:09:15,320 --> 00:09:18,870 So we divide our text right here. 126 00:09:19,070 --> 00:09:24,630 Second part of text right here and add a plus object 127 00:09:31,290 --> 00:09:33,020 one very important guys. 128 00:09:33,060 --> 00:09:41,010 If you have kept the letters in your variable if you named your variable with a capital letter don't 129 00:09:41,070 --> 00:09:42,250 write small letters. 130 00:09:42,300 --> 00:09:48,060 And if in the other case you wrote small letters here don't write up the letters because it's not gonna 131 00:09:48,060 --> 00:09:54,150 work is it plus. 132 00:09:54,470 --> 00:09:58,980 So in this case we add that we add object one color 133 00:10:07,480 --> 00:10:07,830 all right. 134 00:10:08,580 --> 00:10:10,820 So we get the point next. 135 00:10:10,950 --> 00:10:15,500 Also Mr. Jack in this case we have our variable. 136 00:10:15,540 --> 00:10:16,920 So Mr. Jack plus 137 00:10:23,300 --> 00:10:24,730 so plus person name 138 00:10:32,680 --> 00:10:34,000 is your. 139 00:10:34,180 --> 00:10:40,460 So in this case we are talking about the object name too which is the house. 140 00:10:40,460 --> 00:10:44,470 So object name to 141 00:10:53,480 --> 00:10:57,560 older then and in this case 20 years old. 142 00:11:01,580 --> 00:11:09,080 So 10 years old will be our object to each so we'll just take this 143 00:11:21,320 --> 00:11:27,080 as I can see I made a mistake in object I wrote object so it doesn't detect any variable so very important 144 00:11:27,380 --> 00:11:29,780 we need to write down the exact same thing 145 00:11:46,350 --> 00:11:47,100 as you have here 146 00:12:03,700 --> 00:12:04,340 all right. 147 00:12:04,430 --> 00:12:05,310 Amazing. 148 00:12:05,360 --> 00:12:07,490 So now we have absolutely everything that we need. 149 00:12:07,490 --> 00:12:09,770 The only place left will be here. 150 00:12:09,770 --> 00:12:10,350 So it's gonna be. 151 00:12:10,350 --> 00:12:19,770 Thank you and this case will we'll have our person name so person name. 152 00:12:20,400 --> 00:12:21,300 Right. 153 00:12:21,340 --> 00:12:23,490 So right now we have all our variables. 154 00:12:23,540 --> 00:12:25,340 What what to do right now. 155 00:12:25,440 --> 00:12:28,550 We'll simply write our function. 156 00:12:28,680 --> 00:12:31,530 So as you can see our function is the exact same thing. 157 00:12:31,530 --> 00:12:31,670 So. 158 00:12:31,680 --> 00:12:32,520 Hello Mr. Jack. 159 00:12:32,520 --> 00:12:39,350 Right now let's say instead of Mr. Jack we write Mr. Tom and we run our up. 160 00:12:39,920 --> 00:12:41,420 So you can see we can see here. 161 00:12:41,480 --> 00:12:42,460 Hello Mr. Tom. 162 00:12:42,470 --> 00:12:51,010 I'm very interested by your car also Mr. Tom is your house older than 20 years or so as you can see 163 00:12:51,010 --> 00:12:58,000 sometimes here we have words that are well close to each other how we can change this simply by adding 164 00:12:59,150 --> 00:13:04,000 I think the clicking on the spacebar and that well you'll have no more problems. 165 00:13:04,240 --> 00:13:12,120 So very simple simply click on the spacebar and it should have no problems with that. 166 00:13:12,250 --> 00:13:12,680 All right. 167 00:13:13,040 --> 00:13:20,210 So you understand the point for variables so let's say I want to change the 10 year old for 10 years 168 00:13:20,210 --> 00:13:20,660 old. 169 00:13:20,690 --> 00:13:22,550 It's gonna work the exact same way. 170 00:13:22,580 --> 00:13:34,330 So here I have my answer which will be 10 years old. 171 00:13:34,570 --> 00:13:34,820 Right. 172 00:13:34,830 --> 00:13:41,330 Let's say I want to change house for I don't know duplex 173 00:13:45,720 --> 00:13:48,930 as you can see here is going to be the object theme. 174 00:13:48,940 --> 00:13:49,810 So hello. 175 00:13:50,650 --> 00:13:58,470 Well also Mr. Jack is your duplex older than 20 years old so it's just perfect. 176 00:13:58,500 --> 00:14:01,550 So right now we have Mr. Thompson in this case it's Mr. Thome. 177 00:14:01,800 --> 00:14:04,060 As you can see here we have everything want. 178 00:14:04,200 --> 00:14:10,370 So this is the way that we can store our viable so this will be our variables right here. 179 00:14:10,380 --> 00:14:14,190 This will be the data that is stored in our variables. 180 00:14:14,190 --> 00:14:14,890 What is cool. 181 00:14:14,940 --> 00:14:15,420 Oh cool. 182 00:14:15,420 --> 00:14:22,230 Also with python is let's say for example I have this text right here but right now I want to generate 183 00:14:22,290 --> 00:14:23,790 another text right here. 184 00:14:23,820 --> 00:14:28,730 I don't have to change desirable names so let's say for example I have my text right there. 185 00:14:29,160 --> 00:14:32,790 I copy my text and I pass that right here. 186 00:14:32,790 --> 00:14:39,080 So in this case let's say I generate my answer so I will have to text. 187 00:14:39,080 --> 00:14:39,980 So hello Mr. Tom. 188 00:14:40,030 --> 00:14:48,760 Let's say in our segment the text right here I want to change Mr. Tom for Mr. Andrew 189 00:14:51,880 --> 00:14:56,540 as you can see in my second text it's gonna change but in my first text it's gonna stay the same. 190 00:14:56,540 --> 00:15:01,950 So let's say my first text I want to go from Mr. Thumb to Mr. Jack so it's gonna stay the same thing 191 00:15:02,370 --> 00:15:06,870 I can do this also with a 10 year old let's say here it's gonna be ten I want to I want it to be 20 192 00:15:06,870 --> 00:15:08,650 years old. 193 00:15:08,890 --> 00:15:11,320 So as you can see it will look something like this. 194 00:15:11,530 --> 00:15:12,680 So I can have. 195 00:15:12,790 --> 00:15:18,130 Well I can have the same names of variables but since I just change of places so for example I created 196 00:15:18,130 --> 00:15:25,540 two texts one under the other my variables will adapt to Python will automatically adapt to let's say 197 00:15:25,540 --> 00:15:30,730 my what I'm writing my program that I'm writing so I can change the name of my variables for example 198 00:15:30,730 --> 00:15:36,410 here person name will be Mr. Jack and here this person's name will become mister and all right. 199 00:15:36,640 --> 00:15:38,350 So this is for our first date. 200 00:15:38,500 --> 00:15:41,120 Well for variables variables and data. 201 00:15:41,140 --> 00:15:45,970 So as I explained this will be your variable you can name your variable and you can change it when you 202 00:15:45,970 --> 00:15:52,650 want and if you want to change it you simply change the type of data that is here you have two types 203 00:15:52,710 --> 00:15:54,000 of variables. 204 00:15:54,210 --> 00:16:01,810 You have strings which are texts you have numbers which are numbers the words set it. 205 00:16:01,920 --> 00:16:05,100 And as I showed you for example here we have 20 years old. 206 00:16:05,100 --> 00:16:09,680 You can change your 20 years old by simply writing down 20 20 will be for example. 207 00:16:09,690 --> 00:16:13,220 In this case your number. 208 00:16:13,500 --> 00:16:17,610 And finally the last step of variables we have will be the boolean. 209 00:16:17,610 --> 00:16:25,590 So we'll delete all this so boolean value is simply true or false that variables that have true or false 210 00:16:25,590 --> 00:16:26,340 in them. 211 00:16:26,340 --> 00:16:30,120 I'll show you a quick example of what it looks like. 212 00:16:30,120 --> 00:16:41,400 So let's say for example having a house once again you don't have right now to not to understand but 213 00:16:41,400 --> 00:16:46,590 just that you have to understand that it's simply true or false a false value. 214 00:16:46,710 --> 00:16:48,110 So I'll just show you how it works. 215 00:16:48,120 --> 00:16:50,160 I won't talk too much in details in it. 216 00:16:50,160 --> 00:16:51,690 We'll talk later about it. 217 00:16:52,190 --> 00:16:53,130 Let's say having 218 00:16:56,310 --> 00:17:08,640 House equals let's say true so if once again right now I'm also writing down a function so it's just 219 00:17:08,640 --> 00:17:10,770 to present to the boolean. 220 00:17:15,670 --> 00:17:16,130 All right 221 00:17:19,860 --> 00:17:26,250 I own a small house. 222 00:17:26,280 --> 00:17:27,720 All right. 223 00:17:27,880 --> 00:17:29,100 Here we go. 224 00:17:29,110 --> 00:17:29,640 Perfect. 225 00:17:30,010 --> 00:17:37,690 So because while my boolean my my boolean value which will be here true or false. 226 00:17:37,690 --> 00:17:41,500 So if I read I read I right to right here. 227 00:17:41,710 --> 00:17:44,110 This will be generated in the other case. 228 00:17:44,290 --> 00:17:47,430 If I write I write false sorry. 229 00:17:47,800 --> 00:17:48,910 This will not be generated. 230 00:17:48,910 --> 00:17:49,650 So let me show you. 231 00:17:50,170 --> 00:17:55,260 Let's say I'm here and I write down false well. 232 00:17:55,370 --> 00:17:57,080 This will not be generated. 233 00:17:57,080 --> 00:17:58,750 So as you can see there is no code generate. 234 00:17:58,760 --> 00:18:00,400 There is no end search and read. 235 00:18:00,540 --> 00:18:06,470 So we can understand boolean value is simply working with the true or false. 236 00:18:06,470 --> 00:18:12,410 Once again this is just a quick example it's very very like let's say just explaining what it should 237 00:18:12,410 --> 00:18:15,200 look like true or false. 238 00:18:15,230 --> 00:18:16,180 In Python. 239 00:18:16,520 --> 00:18:17,820 So it looks like this. 240 00:18:18,020 --> 00:18:19,880 We won't talk too much about it right now. 241 00:18:19,880 --> 00:18:23,740 But true or false is a huge part of Python. 242 00:18:23,840 --> 00:18:25,580 And we'll see in our next guests. 243 00:18:25,590 --> 00:18:26,370 That's it for this course. 244 00:18:26,370 --> 00:18:26,990 Guys I hope. 245 00:18:27,020 --> 00:18:32,360 But right now you know well until now I think you should know the types of variables that exist and 246 00:18:32,360 --> 00:18:35,420 how you can implement variables in your programming.