1 00:00:00,860 --> 00:00:03,290 Hey you're still sticking your round. 2 00:00:03,290 --> 00:00:03,710 That's good. 3 00:00:03,710 --> 00:00:10,460 I didn't bore you with all my talking but yes in this video finally we're going to write some python 4 00:00:10,760 --> 00:00:11,540 code. 5 00:00:11,540 --> 00:00:12,190 Holy moly. 6 00:00:12,200 --> 00:00:12,610 Thank God. 7 00:00:12,620 --> 00:00:14,860 I thought that was going to last forever. 8 00:00:14,950 --> 00:00:15,670 All right. 9 00:00:15,770 --> 00:00:18,450 So what is our first program going to do. 10 00:00:19,190 --> 00:00:22,910 Well let's create a very very simple function. 11 00:00:23,570 --> 00:00:29,870 And probably the first thing any programmer learns to do to print our own name. 12 00:00:30,110 --> 00:00:39,230 So in here once you have your rebel thought I.T. setup or remember you can also use got that Io we're 13 00:00:39,230 --> 00:00:40,610 simply going to write. 14 00:00:40,610 --> 00:00:48,150 Print and then you see over here that it gives us some information but all we want to do is write brackets 15 00:00:49,260 --> 00:00:56,870 a quote so we can do double quotes here or a single quote and just type your name. 16 00:00:59,420 --> 00:01:08,440 And if we click run on the right side we've just run our very first python program. 17 00:01:08,610 --> 00:01:12,570 Very exciting but what's happening here. 18 00:01:12,570 --> 00:01:14,680 Well let's let's look at everything. 19 00:01:14,730 --> 00:01:17,550 First of all if you're confused why. 20 00:01:17,550 --> 00:01:20,850 My thing is dark and yours might be light. 21 00:01:20,970 --> 00:01:27,510 It's because if I go to settings I've set my theme too light or too dark. 22 00:01:27,510 --> 00:01:28,820 I prefer the dark version. 23 00:01:28,950 --> 00:01:34,380 But you can change some of your settings you can change the font size if you want based on when you 24 00:01:34,380 --> 00:01:35,300 watch the video. 25 00:01:35,310 --> 00:01:41,420 This Web site the look might be different but most of the settings should be the same we see that we 26 00:01:41,420 --> 00:01:52,750 have a main dot pie which is the python extension any file that has a dot Pi or P Y is a python file. 27 00:01:52,790 --> 00:02:00,180 So while we've just written here on line one is a program that prints. 28 00:02:00,350 --> 00:02:04,640 In this case Andre now goy or in your case your own name. 29 00:02:04,820 --> 00:02:12,800 And we've written it to this file now wrap all that i t takes this file already has this interpreter 30 00:02:13,740 --> 00:02:23,460 for us it runs this piece of code gives this source code of main dot pi to the interpreter and runs 31 00:02:23,460 --> 00:02:25,860 it right here on our right side. 32 00:02:26,190 --> 00:02:30,790 If you look over here we're using python version three point six point one. 33 00:02:30,960 --> 00:02:36,870 And down below we see that we have Andre Bagley printed. 34 00:02:37,100 --> 00:02:38,680 That's awesome. 35 00:02:38,780 --> 00:02:42,120 So this is our code running. 36 00:02:42,220 --> 00:02:50,440 Remember this diagram all we've done is we have our main dot pi where we wrote print Andre Agassi we 37 00:02:50,440 --> 00:02:58,780 gave it to the interpreter that the ripple already provides for us that interpreter takes our code converts 38 00:02:58,780 --> 00:03:07,460 it into byte code in here he'll say Andre Agassi and then it runs it in the C Python VM which was on 39 00:03:07,460 --> 00:03:13,880 the right side that we saw and it finally prints our name because it tells the machine hey we want that 40 00:03:14,030 --> 00:03:15,460 text printed. 41 00:03:15,620 --> 00:03:17,290 So that's what we're seeing here. 42 00:03:17,360 --> 00:03:24,230 This is the C Python virtual machine essentially running this code and telling this machine Hey I want 43 00:03:24,230 --> 00:03:25,820 you to print this. 44 00:03:26,080 --> 00:03:28,410 All right but this isn't very exciting. 45 00:03:28,420 --> 00:03:33,400 I mean let's let's make this program a little bit more dynamic for our first program we want to do something 46 00:03:33,400 --> 00:03:36,340 more impressive than just print name. 47 00:03:36,340 --> 00:03:40,900 So I'm going to teach you a another thing we can do in Python. 48 00:03:41,050 --> 00:03:51,270 And it's called input now in here I can say input and you see that ripple it actually gives me some 49 00:03:51,900 --> 00:03:58,450 information saying that oh I have this you can just click here and this input over here. 50 00:03:58,560 --> 00:03:59,700 Well what can we do. 51 00:03:59,850 --> 00:04:02,640 This input is going to prompt a user. 52 00:04:02,730 --> 00:04:10,050 And if I hover over it you can see how it's giving me some information but input simply gives us a way 53 00:04:10,050 --> 00:04:11,910 to capture information. 54 00:04:11,910 --> 00:04:24,800 So let's say what is your name and if I run this code we see that we have our Python code running and 55 00:04:24,800 --> 00:04:28,170 it's asking me what is my name with this cursor here. 56 00:04:28,310 --> 00:04:29,980 So I can actually type something here. 57 00:04:30,110 --> 00:04:36,190 I can say Andre and if I hit enter. 58 00:04:36,410 --> 00:04:37,970 Well there you go. 59 00:04:37,970 --> 00:04:41,720 I've just typed in my own name. 60 00:04:41,720 --> 00:04:42,860 Nothing that exciting. 61 00:04:42,920 --> 00:04:43,640 Right. 62 00:04:43,820 --> 00:04:51,420 But this is where code becomes interesting because we can store this information on our computer. 63 00:04:51,480 --> 00:04:57,570 So again these are things that we're going to go over in detail in our basics Python section. 64 00:04:57,780 --> 00:05:06,630 But just to write our first code well let's assign this too memory that is let's say that name equals 65 00:05:06,960 --> 00:05:11,760 whatever is the input of what is your name. 66 00:05:11,870 --> 00:05:20,560 And then finally we can just print the name so remember the interpreter is going to take this first 67 00:05:20,560 --> 00:05:24,750 line it's going to ask what is your name. 68 00:05:24,770 --> 00:05:32,750 I'm going to type something that typed information is going to get assigned to name and then finally 69 00:05:32,930 --> 00:05:35,280 we print name. 70 00:05:35,480 --> 00:05:37,560 Remember an interpreter takes. 71 00:05:37,610 --> 00:05:40,480 Line by line converts code to bite code. 72 00:05:40,490 --> 00:05:44,300 And then finally runs it so let's give this a try. 73 00:05:44,300 --> 00:05:46,820 I'm going to click Run. 74 00:05:46,840 --> 00:05:47,080 All right. 75 00:05:47,110 --> 00:05:48,550 What's your name. 76 00:05:48,550 --> 00:05:56,190 My name is Andre do you see the I typed in my name. 77 00:05:56,360 --> 00:05:59,230 Hit enter and then it printed out. 78 00:05:59,300 --> 00:06:05,090 ANDRE So for the final feat let's greet. 79 00:06:05,280 --> 00:06:10,070 So we're going to say print Hello. 80 00:06:12,490 --> 00:06:14,550 And then plus name. 81 00:06:14,710 --> 00:06:16,390 Now don't worry about the syntax. 82 00:06:16,400 --> 00:06:24,610 We're gonna go over it but all we're doing is saying hello and then adding our name to the end of this 83 00:06:25,720 --> 00:06:29,650 so let's see what happens if I run this and say What is your name. 84 00:06:30,160 --> 00:06:36,330 My name is Andre and I hit enter I get Hello Andre. 85 00:06:36,330 --> 00:06:44,300 But no spaces so let's add a little space hit run again for the fourth time My name's Andre and says 86 00:06:44,480 --> 00:06:54,300 Hello Andre there it is our first python program now it's not very exciting because it is our first 87 00:06:54,300 --> 00:07:01,200 program we're just learning the steps here but I hope because we've covered some of these topics ahead 88 00:07:01,200 --> 00:07:05,370 of time that this isn't just pure magic right. 89 00:07:05,580 --> 00:07:13,380 You understand that this is source code this is main dot PI that we give to an interpreter that runs 90 00:07:13,380 --> 00:07:19,680 our code line by line and then executes our program. 91 00:07:19,680 --> 00:07:22,370 In this case are what is your name. 92 00:07:22,410 --> 00:07:23,950 Program. 93 00:07:24,090 --> 00:07:27,080 How cool is that. 94 00:07:27,100 --> 00:07:28,670 This is just the beginning. 95 00:07:28,710 --> 00:07:31,730 We're gonna get more and more advanced here. 96 00:07:31,930 --> 00:07:33,830 See if he can play around with this. 97 00:07:33,850 --> 00:07:39,130 We don't know that much about Python yet but I hope this gets you excited because while there's a lot 98 00:07:39,130 --> 00:07:42,020 more coding coming along I'll see in the next one. 99 00:07:42,090 --> 00:07:42,640 Bye bye.