1 00:00:00,570 --> 00:00:03,220 Hello and welcome to this video. 2 00:00:03,270 --> 00:00:11,010 In this video we are going to be creating some variables creating variables in Python is really straightforward 3 00:00:11,410 --> 00:00:19,390 or you need to do is give the variable in name and then you assign some values for the variable to store. 4 00:00:19,470 --> 00:00:28,110 I'm going to be using my command prompt to create some variables so I'll be accessing the python interactive 5 00:00:28,110 --> 00:00:33,620 shell so to do that I just type in Python and press enter. 6 00:00:33,810 --> 00:00:42,330 If you are on a Mac you need to go to your terminal and type in Python 3 so the first thing you need 7 00:00:42,330 --> 00:00:46,130 to do when creating a variable is to give the variable a name. 8 00:00:46,140 --> 00:00:55,070 So give it a name that is descriptive that reflects what type of data of value that the variable stores. 9 00:00:55,080 --> 00:01:00,790 So let's say I create a variable H and you use equals 2 to assign a value. 10 00:01:00,810 --> 00:01:07,050 So say I give it an h of for a presenter and that's a variable created. 11 00:01:07,410 --> 00:01:13,200 If I want to access that variable the value inside that variable all I need to do is call a variable 12 00:01:13,230 --> 00:01:17,850 by its name and press enter and it will return the value. 13 00:01:17,850 --> 00:01:21,660 You can also change the value that the variable holds. 14 00:01:21,660 --> 00:01:28,610 For example I can come here and say H equals to fight and presenter. 15 00:01:28,600 --> 00:01:32,820 Now if I call that variable a it will no longer store for. 16 00:01:32,820 --> 00:01:41,280 It will not store five because the value has changed so that the value that a variable stores can vary. 17 00:01:41,280 --> 00:01:47,940 So let's say I create another variable and I give it a value of say blue line. 18 00:01:48,000 --> 00:01:56,340 Now if I want to reference name I just say name and it will give me the tex blue line. 19 00:01:56,820 --> 00:01:58,620 If you notice there are quotes around it. 20 00:01:58,680 --> 00:02:01,770 If you don't want the quotes you can go to print. 21 00:02:01,770 --> 00:02:10,140 I can just say print name by wrapping the variable inside the print function to print out the value 22 00:02:10,230 --> 00:02:12,210 without the quote. 23 00:02:12,270 --> 00:02:21,420 So let's create a few more or create another one called City and I give it the value of say London I 24 00:02:21,420 --> 00:02:25,370 will create or another variable. 25 00:02:25,370 --> 00:02:35,930 So create one called green team and inside this I can store a long piece of string or text so you can 26 00:02:35,960 --> 00:02:45,020 always store what you like inside your variable value so say hello world and do that. 27 00:02:45,020 --> 00:02:48,810 So I'll say hello world and say thank you. 28 00:02:49,100 --> 00:03:00,020 So variables are quite useful so for example any time I want to see something like this I don't need 29 00:03:00,020 --> 00:03:05,540 to keep typing it out each time I just call the variable by its name. 30 00:03:05,540 --> 00:03:15,830 For example I can say print inside the print function I just pass in the name of my variable which is 31 00:03:15,830 --> 00:03:23,360 great team and it will just spit out the value you can see here is just printed out the value of that 32 00:03:23,370 --> 00:03:23,780 variable. 33 00:03:23,840 --> 00:03:30,080 So variables are quite useful because you can store a lot inside them and that saves you typing things 34 00:03:30,500 --> 00:03:31,580 all over and over again. 35 00:03:31,580 --> 00:03:38,690 So if you have values that you want to use or reference often within your application you can store 36 00:03:38,720 --> 00:03:43,880 those values inside variables and then just change it as you go along. 37 00:03:44,000 --> 00:03:55,640 You can also construct a sentence or statement using variables for example I could see print in some 38 00:03:55,700 --> 00:04:04,310 print function I could construct a simple sentence I could reference a name which is in name of I've 39 00:04:04,310 --> 00:04:13,490 got a variable code name with a value Blue Line psycho's a name and a comma and then the quote I'll 40 00:04:13,490 --> 00:04:15,770 say is from 41 00:04:18,330 --> 00:04:26,030 our end quote and a comma now city. 42 00:04:26,560 --> 00:04:31,690 Now the name and the city are both variables. 43 00:04:31,900 --> 00:04:34,660 So I've got a name here with a valid blue line. 44 00:04:34,930 --> 00:04:40,780 I've gotten a variable here called City with the value of London. 45 00:04:41,200 --> 00:04:47,350 So what I'm saying here I want this print function to print out the name which is blue line and then 46 00:04:47,470 --> 00:04:52,040 add this piece of text and then add this variable name. 47 00:04:52,180 --> 00:04:58,120 So if I press enter you can see is constructor something same blue line is from London. 48 00:04:58,540 --> 00:05:01,860 So you can see the power of variables. 49 00:05:02,080 --> 00:05:03,940 You can store any data time. 50 00:05:03,940 --> 00:05:11,230 You can store numeric related values and you can store string or text reflected values. 51 00:05:11,230 --> 00:05:13,220 Also variable names can change. 52 00:05:13,220 --> 00:05:16,550 So you can create a mean variable values can change. 53 00:05:16,630 --> 00:05:24,930 You can create a variable and then later on reassign the values that the variable holds. 54 00:05:24,970 --> 00:05:27,790 So that's set for creating variables. 55 00:05:27,790 --> 00:05:29,380 Thanks for watching. 56 00:05:29,380 --> 00:05:30,210 Bye for now.