GIS Python Tutorial: Gentle Introduction to VS Code and Python Computer Programming #Python #GIS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign so in class for today we're going to make an introduction to the vs code environment and we're going to just do some real basics of of python computer programming um so there's nothing really geospatial spatial algorithm per se about what we're going to cover today but today in some sense is probably one of the most important uh lectures you can ever have if computer programming in general is something that you're new to so I am screen recording this if you're watching this video later um there is a lab assignment based on this lecture and um because it's really the the building blocks the foundations for going in other places with coding in general so if we look at my diagram I've been using um semester so far so today we're we're now you know we've covered a lot of things we're going over sort of python Concepts as a conceptual topic and then we're going to start to use vs code so raise your hand if you've used vs code before a couple people have okay um but if you've never seen it you know um uh it's it's a pretty robust tool for a lot of things not just python okay so that's what we'll go over python Concepts basics of computer programming and then also the vs code environment so before we get started let's just talk about getting it even up and running now if you've never like let's say um you are uh doing this on your own computer not one of the computers in the lab here and you need to get python python is a um um if you watch the video for today that was assigned for today you know it's a it's a modern object oriented programming language um it's used in a lot of things most notably nowadays we're in the era of data science that's the one thing I think of python most notably um for those of you that have coded in Python what kinds of uses have you used it for or if if you raise your hand if you've coded and python before okay how how have you used python developing business applications okay how about um you wrote some malware just kidding yeah so um so business applications um writing or writing malware like as a class not as a thank you right um now if you need to go and get python though on your own machine what you can do in fact I thought I would try this I'll go out on a whim here um I'm using my own compete I'm going to go to that that link there and um you can go ahead you know it's a free and open source you guys know what I mean by you guys probably know what I mean by free and open source what is free and open source me you know what free and open source is yeah anyone can use it there's no commercial license that's why python and a lot of these things are so popular because you don't have to pay any money for them right so if I were to go to downloads you know I'm on a Windows machine I'm going to go ahead and download python 3.10.7 um now I have a couple different versions of python on my machine but um I'm gonna download this one just for the demonstration of it and see if I can connect Visual Studio code to python so I go there I'm going to go download that and um 28 um about 28 megabytes I'm gonna go ahead and run it now even just for the learning moment of this install now to my name python 310 and it's going to come with stuff that I don't really necessarily need because well basically what we're going to do is um I'm gonna try to point Visual Studio code at this instance of python because when I was prepping for class today I have I think the latest version I had was python 3.9 they're constantly putting new versions of it out there so I'll just go ahead and install that and again like I said earlier you know to start class saying this is just to get you um kind of get you started with python if this is something that you're new to you've never seen it or maybe not done it on your own computer and so forth and hopefully this won't uh be a big problem so here it goes it took us um about maybe 60 seconds to get running here But Here Comes all the stuff for python coming on the machine now and there's probably way more things that for what I'm going to do in this lecture that we need um if you would watch that video uh I assigned for class I actually use the idol which is a development tool that comes right with python um but that so just remember that so I just installed Python 3.10 and we'll hopefully we'll come back to that and use it now for for uh so here's what I just installed python310 here's what I had before so you can have multiple um multiple instances of python running on a machine and that is something to make note of depending if you ever get some code that was written in say an earlier version of python sometimes you might not want to make the effort to have to go back and update like python 2.x code to the python three point x code or something or other that does come up every once in a while depending on what you're doing so that gets us python okay oh yeah there was the There's the link there you can um you know download it from okay so that gets us started with that um and I thought I had a screenshot of Visual Studio code um oh I'm sorry no this is I'm sorry this is the visual studio code um so the other tool we're gonna use so we got python we got that from here this is now Visual Studio code I'm not going to install Visual Studio code on my machine but just for um for learning about it it's also a free and open source tool you can go to this link here um and and grab it you know depending on what uh what flavor of operating system you're on and it's really become from what I've learned it's really become like I think perhaps the most popular development environment meaning it's a it's a tool for lack of you know not to oversimplify it because it is a pretty powerful piece of software but it's a tool that you can use to write computer code in a lot of different languages not just python um and so if we'll use it several times in the class mostly for python but later when we get to um JavaScript later in the semester um we'll we'll use vs code okay so vs code should be should be on your machines you know if you're using a house computer um if not go ahead and download it and install it and uh we'll go from there so what I wanted to do in class today then is we'll get python just working in vs code we'll create a project workspace we'll we'll do um we'll create a simple py that's the python extension and we'll do some really just basic computer programming Concepts okay and that's kind of why again a lot of the students a lot of students in this class have this kind of background especially in the 300 level class um but if you've never seen this stuff before the class does not have a programming prerequisite so it's it's all good um for you to learn here today and I I I should mention as well computer programming in general is often being promoted as a skill that all RIT students should be graduating from so even if like you're in the College of liberal arts and you don't really like working on a computer but there's this idea of like computational literacy so even if you're not going to become a software developer knowing how to write some computer code is a really helpful thing in a lot of different contexts anywhere from something as simple as writing formulas inside of a spreadsheet um or if you go down the road of GIS um I've been saying from the beginning of my career you know learning coding in general is a really good thing to do I know in my own experiences that I learned computer programming um you know and I didn't have any kind of I don't know computer science or whatever Information Technology background but my ability to code really opened up a lot of possibilities for me so I'm trying to make this a very very gentle introduction to the topic um because sometimes it can be intimidating it's essentially like trying to learn to speak a foreign language so um I speak a little Spanish I've learned other languages I play music it's kind of a different way of thinking but if you're if that's something that you don't have as much experience with it can seem a little intimidating but I think if you just you know if it's presented in a very um straightforward clear manageable manner I think you'll find it pretty easy actually to get up and running so let's start then with let's um let's try to see if we can do this let's get python working in vs code as our first step and I'm going to type up bring up visual studio code okay and one of the first things I want to do is we're going to load up an extension and so um Visual Studio code has various tools that can be plugged into or extensions really they can get plugged into the bigger coding environment right so if I um if I were to go click here where it says extensions or Ctrl shift x uh you know according to the help help there I'm going to click on that now I already have a few extensions installed um and the one that I'm going to recommend we use p y t h o n um I'm gonna I'm using this one which is um is Microsoft so this is so what this does is this isn't the actual this isn't the actual python libraries um but it will give you tools to work with python okay are you guys seeing that out there I don't know what you guys are seeing um so you should see python intellisense but it's from Microsoft right so sometimes with these extensions just like I don't know you know like you've probably seen it like if you have an Android phone you've gone to the Google Play Store if you ever download some kind of stream like it looks cool but it's a strange app and like written by somebody in another you know but so that's why you know Microsoft right we can trust Microsoft it's been verified so go ahead and go ahead and install that you know um and let me know did it install pretty smoothly for you okay and then later in the semester we'll come back to some of these other extensions um that um can help be helpful for things okay so we have the python Microsoft extension and what we're going to do now is work um another really basic concept in Visual Studio code is your project folder and that's kind of where all all your stuff happens like for example when um like the class web page when I um when I'm putting together the class web page um I often use um here's like I use Visual Studio code to write the page right and so when I'm and this is now an HTML file it's it's a simple uh HTML page I use um I point it basically at a folder on my on my computer where I do my work so what we're going to do is we're going to we'll do that we'll point it at a folder where we're going to put our python file and run it and so forth so to do that I'm going to use behind the scenes I'm going to use C temp because that's what I always use it's easy to find so what you should do is create a folder somewhere on your machine if you want to follow my example if you if you have access to it see Charlie temp there's nothing in it sort of nothing up my sleeve here and I'm going to go like this I'm going to go to um file open folder put it at ctab and let's get rid of that okay so right now if you look in my Explorer view which by the way that's what you know when I was on extensions if I go back here the sort of two pieces of paper that's sort of what's in c10 there's actually nothing in there right now because um we haven't created anything okay so so far so good with all that stuff if you're following along all right so let's now use that extension that python extension that we uh just installed the Microsoft to point it at a version of Python and the way that I learned to do that was going to be um if you look at this slide if you do Ctrl shift p you should then see um some tools pop up you want python select interpreter and I'm going to assume the python Microsoft has been installed okay so if I go back over to the code control shift p okay and uh mine is mine is already showing up see how it says recently used but for you if you type in p y t h o n and you start if I'm using my arrow key now to go down through all this stuff do you guys have select interpreter did that show up so hit hit on that one okay now check it out there's actually a lot happening here just with that I have how many of them I have I have four versions of python on this machine I don't necessarily need that many of them but this is what I was talking about earlier um you can have multiple versions of python on your machine and just for making note for later in the semester notice this one here the 3.79 notice it says arcgis Pro py3 conda and then program files arcgis Pro later in the semester when we get to um back to my diagram when we get over kind of like arcgis like if we go from here to like kind of over here and so forth we're going to basically Point vs code at special instances of the arcgis pro python that ships with um with arcgis Pro and also using um tools called conda that allow you to clone like basically copy python environments um and add extra libraries into them depending on what you're doing okay now Note 2 though earlier you know I I downloaded Python 3.10 and there it is so the the Microsoft tool was able to go and find that version of it and I'm going to point at that so what do you guys see out there what do you guys have what versions the download okay cool similar for you guys everybody else all right just that nothing else just curious yeah anyways okay so I'm just going to select that one and um let's see so that's been selected now I'm going to go and um a couple ways I can do it I'm going to create a file now I can do a new file here I'll go file new file and because I already have a point in my folder I'm going to call it class for a dot p y and it's going to point it at where my directory was that we just did I'm going to create a file there okay now a whole bunch of things actually just kind of happened when I did that right well not maybe a lot of things but take a look take a look down um do you guys have Downs or on the bottom right does it say 3.10.764 bit you see that yeah okay so that's that now you're ready to sort of start going with python right you went if you never had it on your machine you downloaded the python sort of libraries um from the python.org website we hope we got Visual Studio code and we we pointed Visual Studio code at python now we're ready to start writing some basic python uh statements so again um it may not seem like a lot but it really is because that's getting you started now with your development environment which is we didn't really formally discuss that uh the development environment is the idea of the tools and all the various things that go into creating computer code that then can be compiled into an application or um whatever if I go back to the business example your business like what did you actually do with your python code did you like mainly just like use it in their faces okay so you really so the example we just heard in their project they actually built a GUI a graphical user interface and so it had a thing sometimes though python are just scripts that just kind of run they don't you know going the distance of building an interface that's actually a whole other kind of level to take it to right I mean we're just gonna in this class really even the other stuff is just gonna be scripts okay so and use Visual Studio code to do all that I'm just curious this visual I've never seen does it have tools for interface design yeah yeah does it give you a graphical preview okay so that that would be an example of like you would probably go to when you would get an extension okay all right yeah okay yeah so we got that up and running let's get down to it now and start doing some very basic um coding and one of the very first things um where you have to learn in any kind of computer programming I would say our comments and variables okay so like any kind of language you're learning to speak um you have sort of rules and grammar and syntax so in Python our comment anybody want to tell me what a comment is in computer coding [Music] um and it doesn't impact the code whatsoever just that that well with the comments or something yeah yeah um a comment is basically as we heard it's just like a note of something in the code but it's not going to be compiled or have any real impact and if you're a good coder you always put lots of comments which are notes to yourself or somebody else that comes along so the Syntax for that is going to be um see if I can zoom this in a little bit [Music] uh I thought there was a way to zoom it in well can you guys see it okay back there I'm just gonna all I did here is I just slid I just put this uh I'm gonna move the Explorer out of the way just so I have more room here [Music] okay all right so comment so the pound key and then um that's it I mean that's an example of a comment okay okay so for for learning this um let's do now a variable so I'll do another comment okay so I wrote this is a string variable what do I mean by a string because someone tell me what a string is the oldest string is yeah a sequence of characters right and then somebody tell me what is a variable in general how about you guys know what a variable is [Music] what's a variable [Music] s it right yeah exactly so you know we're going to hear about things like strings doubles integers um I often try to use like Microsoft Excel as a as a comparative thing um because the same concepts are the same things are going to be there in our GIS Pro and attribute tables but basically the way um variable works is um like this so I'm going to type in the name of it the name of the variable and then for a string I put in this case a double quote like that okay so type that out and then I'll do another one um yeah so I've just put two string variables in hello and world okay [Music] and um let me take check this one out now I'm going to type in print set the word print notice by the way too how things are changing colors so notice how the green um is what a comment is becoming a variable and then when I put my mouse over it it's telling me the variable um is in blue and the the value of the variable is in um I guess what would you call that kind of like uh a reddish orange color right and so most good development environments will um do that for you it'll give you some kind of visual cue um to tell you what things are now I just typed in the word print and that's a function that's what's called a built-in function it's part of just it comes with python it's there when you put your mouse over it you get all what are called the arguments the thing that print can that you send into the function to have it do things um and so with print I'm going to do this I'm going to I typed in the word print then I'm going to do um parentheses I'm going to start typing in h e now notice when I do that h e a whole bunch of stuff is starting to come out onto the screen for me all right now if I use my arrow key I can go through all that stuff and take a look to how they have different um icons next to them so where I'm going with this is I'm trying to get at my variable that was called hello and there it is right so I put the um with my arrow key I put it over hello and I hit enter and it kind of fills it in for me okay and I'll check this out I'm gonna I'm gonna go this one but hello then I'm gonna put a plus sign and notice what's going on just just again because this is a this is a first introduction to all this stuff notice how notice how there's like a red um do you guys see that underneath the parentheses there's like a red squiggly right and if you put your mouse over it it's trying to tell you that there's a problem it's it's um because I put basically I put the plus character with nothing after it okay anybody know where I'm going with this why I put a plus character there [Music] if that's what I want to do right string concatenation right so I'm going to take these two string variables hello and world I'm going to stick them together and that's what that's that was something that was in the video um uh that was assigned for class so check out what I'm gonna do hello plus then I'm going to go quote [Music] that and I'm gonna go Plus then w o r until the word to um again you know there's my stuff filling in world and so forth okay do you guys get get that all typed in all right okay so now I mean this is the as you probably know if you've done coding before this is like sort of the classic first program you always write a hello world program I'm Gonna Save my work I'm gonna do um file save or control s now I'm going to run it I'm going to take this couple lines of code that I wrote then I'm going to go up here I'm going to go run and I'll do it run without debugging and let's see if we can get it to work Runs run without debugging now when I do this just to let you know um look under where it says terminal [Music] if everything goes according to plan you'll see some kind of text kind of come out when the program runs and you should see the output of what of what the code does in this case it's only going to do a print statement which I didn't really talk about what print is print is basically just a way to send something from the code to the terminal so python often will run in sort of like in a command prompt that's what you're seeing down here with the terminal so the print will send things to the terminal and it can be really helpful for looking at what your code is doing and so forth so if I go to run run without debugging okay and there it is so it happened somewhat quickly so what it did was and even like you know to really break it down it took um it took the file class 4a.py and take take a look so it sent it fired up the python EXE um I I frankly don't know what the rest of this stuff is um maybe one of you do but what it did was it then sent our file from c10py it sort of passed it in to Python and the python executable and sort of the debugging tools I guess what those are so and then it took that and then ran ctemp class for a py went through the sort of eight lines of code and there there's the hello world right that was from line eight up here um and it ran it because we did a print and it ran it in the um the the terminal did you guys did that work okay I know this is pretty basic stuff but did it work that's the key thing it worked okay so again might not be much visually you know impacting like an explosion in a video game however you got python you got vs code you wrote some code you ran it this is the Gateway into the whole world of it I mean you have to start with you know basic steps to get going but now that you have this um you know there's a lot this is this is it you know you can do so much more so let's do a little more coding with it let's actually try to break it like let's say you did something like um let's say you did something like that so what do you think the problem is there on my line eight yeah it'll even tell you like if I you know you know it's looking for the print statement needs to have the two parentheses let's see if I can even run it if I were to save it and try to run it yeah so notice down here in the terminal it won't even sort of compile um syntax error was never closed it won't let you go right um so I have to go back and put that in there save it and then if I run it runs fine okay so this will probably be the easiest day of coding and then from here it'll get more complicated um so that's why those um things like that just some some help with just simple um syntax errors or missing uh a missing parenthesis or whatever it is and so forth okay let's look now a little closer on any questions so far by the way so far so good all right let's look again let's look a little closer at some concatenation um other uh variable types anybody know what kind of uh what kind of variable types would you call like the data type what would you call it what do you think those are right they're integers they're they're non-decimal numbers so I might put a comment and so with concatenation um it's not really now this time it's addition I spell the word Edition [Music] okay so I get two integer variables I I I'm going to use the the plus sign to put them together if it works correctly it should I should see the number three come out in the console I'm gonna comment out my my original um hello world they're just kind of relics now and I go to run it okay and there it is so in this case so with string with with using the what are called The Operators really the plus operator so sometimes that plus operator can be um can be used to stick different strings together but can also be used for you know in this case really simple um addition so there's other operators that can you know especially a belief for um [Music] multiplication if I do that [Music] so in that case I switched it from addition to multiplication um and um you know two times one so that's the idea of an operator um that allow you to do things especially with um string concatenation addition and so forth okay all right all right so far so good all right let's let's go over a couple other basic concepts let's talk about a list can anybody tell me what a list is in python or other languages you know what a list is [Music] there's more than one value yeah that's probably a good way um I think although you guys know what arrays are like an array right so oh in Python they're called um lists uh so let's let's look at what a list looks like so I my notes have contain a collection of objects and those objects then are um you can get at them by their index or where they're located so um they can be a couple different things here's a so list is its own kind of variable type so if I were to do something like um I'll type I'll call on so I create a new variable called feature classes and it's going to be equal to because I'm using that um I guess I didn't really mention that earlier when you have a variable the name of the variable the the equal sign is use the assignment of the value to that variable right and so the syntax in for a list is going to be um you use brackets to kind of tell python that a list is coming and if I want to do a list of strings um inside of it I put two quotes in a comma and so forth and that's what um [Music] that looks like now lists can be anything though they're just objects and we're not really talking about objects in a formal sense today but objects are the various things so um a string variable or a list of integers or a list could have um there could be a list of lists you know inside each element or each thing inside the list could be a list in itself and that's going to be really important too by the way is that ID of the index the the position inside of the list so my list currently has two things in it because two strings I had the first one called roads that's um the first one then a comma and then the second one is called is water it doesn't really matter what the string is but the idea is that um um they're in there with the correct syntax so if again kind of like we saw with that print theme and if something's missing you know the program will start to blow up on you you'll get um you know red warnings and all that okay so I'm gonna comment out so in this case now if I want to print the first element of the list I'm going to do um something like this I'm going to type in print then I'm going to reference the name of that list variable feature classes and then I'm going to use brackets again and put 0 in does anybody know why I put if I want the first element why did I put 0 instead of one now because that's just how it is right so again if you're if you're new to this kind of stuff um pretty much all computer programming languages when you they all have this idea of a list in the index is the idea of the position of the thing in the list and so the first thing the first element you use actually the the number zero so the very first thing is zero the second thing is one and you start referencing their their position or index based on you know using zero one and so forth okay so if this works correctly when I I save this I'll save it and run it I should see the word roads come out on the um terminal prompt because I'm telling it to go into that variable feature classes that's a list of strings and get the very first item as referenced by position zero and there it is there's the word roads showed up okay so if I change that to one we should see the word water um come out now check it out here I'll break it what if I put two in um I'm trying to think of my my programming teaching uh lingo here so this this is not going to work so this is the code will compile correctly but it's sort of uh an error maybe in the logic I I can't remember the exact way to describe it but like I don't have a problem like uh an error like that you know that's a that's a coding like a syntax error like I'm missing something in the code but as far as the code the compiler knows number two for feature classes it it's fine syntactically it's fine but it's more I think it's a lot they call it maybe a logic error like it's not what kind of error a runtime error okay right yeah a little compile right when I go to run it um it'll blow up on me here it'll say you know and this this is a good learn good to learn too so if you look at what it says Trace back file this line 23 it's pointing me at line 23 right here is saying um list index out of range right because I went from zero one but I told it to go after number two there is no number two in the overall list and the you know it blows up it gives me a you know a problem so that itself you know if as you start to do more complex coding this kind of stuff is going to be really really important because when you start having problems when you have long hundreds of lines of code and it's telling you where the problem is um that'll give you a starting point to begin to look for any issues that come up okay so just for the um the practice as well let's um we'll fix that actually let's do this let's go um okay so you know um you can also like I said have integers and so in this case I want to change it around um machine [Music] so just just to kind of continue on the point there so I changed it I made a list of integers I changed it down here to go to the first um thing it'll print 100 okay any questions about lists did that all work okay if you were following along all good all right um all right let's let's cover one more thing today and um actually from what I've shown you in class review now after this last thing you'll have enough to do um the lab the simple python lab looping so computers in general are good at doing counting going through things and processing them so looping is a natural progression to a list right so we have two lists up here we have feature classes this variable called feature classes with a list of strings distances with a list of uh of integers or numbers now in line 25 here I've just told it to go and get the the item in that list at that particular index and sometimes that's good but really what you're going to often encounter is you're going to have a list and you're going to need to what's called Loop through basically go systematically go through every item in that list and do something with it and very soon um within the next week or so we're going to start seeing that kind of thing we're gonna start if you watch that video I had assigned for today um you saw that where I was opening a comma separated value CSV file bringing things in um it's very common so let's go over looping um we're gonna go through all of the um items in the list I sure I'll use my stunning PowerPoint um animation for this okay ready for this so the concept of a list with my stunning animations here ready so if I have um I have uh lists here comes the loop so we're going to go through everything in the list so if that's oh it didn't work oh man well that's kind of that'll work so what you do is you um you start with your list right and then this line here um this is what's called a for Loop where you just go through systematically through um everything in the list and then you print it out to the command line there's actually a lot going on there um that we haven't seen yet in this kind of introduction to all of this make note of well there when it's on the gray notice um there's a new keyword for there's also a colon and then when I go here notice how um the word print is indented in okay so if you've done coding in languages like JavaScript or Java um and others they're really big on the curly braces right curly braces are used to delineate things out in the world of python it's all about the indents to kind of show how things are sort of nested inside of each other for maybe a lack a better word describe it but let's let's code this out and we'll uh we'll go over this so um so what we're gonna do is um [Music] okay so we're gonna Loop in the feature class list and [Music] print out every value okay so the basics of a loop so I'm going to type in there's different kinds of Loops we're going to do a four Loop so we're going to see four and then you basically just kind of create like a temporary variable so I'm going to do 4 f c in feature classes okay then I need to put um a a colon now watch what happens when I um see where the cursor is flashing at the moment when I hit the enter key notice how it went down to line 29 and the um the cursor kind of automatically indented itself right that's actually really important because whenever you whenever python sees the um the colon it knows that there's going to be something kind of coming after that that's related to so in this case it's a for Loop and so I'll do it again when I just hit the enter key I'm going to type in print FC okay and now when I'm done with that I need to back out see how when I after F print FC the cursor is flashing right below the letter uh P I'm going to backspace out of that and go down okay um I'll save it I'll run it and we'll see what happens here okay so um I had the other print scene from before but it worked right let me run it again just to go okay so if it works correctly I should see the words roads and water come out okay and you know there's what it did so again just to make sure we're clear on this it's going to go into the loop is going to go in and get every value out of this variable feature classes temporarily assign them to this variable called FC that I just made that up and then FC is going to be printed and that's the idea of looping it's going to go through and uh um print out whatever the current element is and it's going to run it's going to do that until there are no more things in the list to be um sort of accessed okay any questions on that and that's also really really core nuts and bolts kind of but you got a question or I don't know you do yes you do let's see what happens if I just put the word feature classes in let's see what would happen so see what it did um it did pre it so it printed out the whole list and notice it did it twice why do you think it did it twice what's that [Music] okay it does anybody else why did we had the question you know why can't you just put like the whole list variable right in there which you can but why did it but it did it did what we told to do it printed out the list variable but it printed it twice anybody know why why yeah why item [Music] yeah yeah exactly right so it's on line 28 it's still getting at it's got that Loop is going to run any the number of times um it's gonna run it's gonna cycle through based on the number of things in the list what you do with it is up it doesn't you know what you do with that is up to you that's why you have the colon breaking down you know you could be you could go crazy in Ray you know foreign you can do whatever you want you could you know it just keeps on rolling keeps on going so um that's why you typically with a list you want to get at um the individual item that's in there and then do something with it you know and that's where um we weren't even going to get into like um conditional statements but you might check the value of it like so if the current like let's uh foreign see what I just did there right this is more this is more getting a little closer to what you actually kind of do with looping you don't just necessarily print things out so in this case I changed it around a little bit I this time I'm looping on all of the values and the distances which is a bunch of integers so as I go through and put every as every value from that list gets put into this variable dist right so first up is a hundred um next up is 200 and 300 then I ask it you know and this is a we didn't really talk about this but a conditional statement right on line 29 there it's going to say if that that current value in the loop is greater than 100 right there's one of those colons and notice too how notice now we've got one we got two levels of indent happening right it's that value is returned true then it's going to print um it's going to print that out and you could do something like this you could I don't know if you could do that I don't know if this would work this might be string and integer it's not going to like this we'll see yeah doesn't like that but um that's for another day we'll talk about casting um a comma okay let's see a comma like that okay okay great awesome thanks for the tip I learned learn from you guys all the time so I just learned that I I always thought um um you'd have to concatenate so so this is kind of this is helpful right so you know the first time around 100 was not greater than 100 because I didn't set it to greater than or equal so the next time around 200 comes and I had it stick the value the value of disk in along with is greater and so two of the three evaluated is true um when the loop was running okay and uh again that's real nuts and bolts kind of stuff but that's to show you how all these Concepts kind of start building on top of one another and and so forth and with that that was really what I wanted to show you guys for today so again we actually did Cover a lot of material for as a very introduction to this we got python from off the web we downloaded python um we didn't download vs code but we you know we can get that easily it's a free and open source we um we went and used the um the python um extension to work with python through Microsoft we use that tool to then point us at um the version of you know we use the latest version of python that we got because this is all pretty basic stuff um and then we went through variables from a string variable to an inner variable we looked at operators um in this case um the plus sign which we use for both concatenating or combining strings but also some basic um um addition and multiplication we went over lists where we then talked about the elements within a list that start at zero um and then we learned about how to Loop through those values using a basic for Loop and we also did a very quick introduction to uh conditional statements so um again it's like speaking a foreign language if you've done this stuff before it may seem um pretty um intuitive to you but if you've never ever seen it you got to start somewhere and thank you for the tip on the comma I learned something to myself for this print statement okay [Music] hi this is Brian thomaszewski if you enjoyed this video be sure to like comment and share this video also please consider subscribing to this Channel and clicking the notification icon to stay up to date on new videos from this channel thanks for watching
Info
Channel: GIScience
Views: 2,694
Rating: undefined out of 5
Keywords: GIS, GeographicInformationSystems, Geography, GIScience, ArcGIS Pro, Esri, GIS Software, GeographicInformationScienceandTechnology, GIS&T, Maps, Mapping, Training, Education, Computers, Python, Computer Programming, Code, VS Code
Id: cDOorillpak
Channel Id: undefined
Length: 56min 32sec (3392 seconds)
Published: Fri Sep 23 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.