What you'll learn
- Install and set up Visual Studio Code on Windows, macOS, or Linux and customize its layout and color theme
- Find and evaluate VS Code extensions by publisher, install count, and ratings, including extension packs
- Explain why open source, cross-platform tools and languages suit early software development work
- Install Python, update the PATH environment variable, and verify the interpreter from the command prompt
- Create, run, and debug Python scripts from within VS Code and a standalone terminal
- Use print statements to trace how data changes as a Python script runs
Free 58-minute video lesson with a full transcript and knowledge checks. No account needed to watch.
Introducing VS Code
A wise person once said "use the right tool for the job." Writing code is no different - it's a job, and there are a lot of tools at your disposal. Some of them are task-specific, and some are general purpose. This set of videos is designed to help you understand how to use the most popular general purpose coding tool - VS Code.
Install and Set Up VS Code
In order to use VS Code, you have to have VS Code. This video will show you where to go to get VS Code and then begin setting it up to your preference.
Knowledge Check
Who created the general purpose IDE VS Code?
Understand What Open Source Really Means
In the last video, I hinted at what "Open Source" means and identified one of the more common characteristics about ("code that can run anywhere"). While that's true, open source software (often abbreviated OSS) is much deeper than that. Let's talk for a moment about the current development landscape and how we got here.
Knowledge Check
True or False: Developers are beginning to prefer to work on open source software so that they can ensure that their application can run anywhere without barriers to entry.
Install Python
To begin our coding journey, we'll be starting off with Python. Python is widely accepted as the most human readable programming language which makes it the most beginner friendly programming language. Once you learn the core constructs of programming in Python, you'll find transitioning to other programming languages much easier.
Knowledge Check
True or False: Python ships with most Linux and Unix operating systems by default.
Work with Python Scripts
Now, I want to stress this - the title of this video might make you think this is a "Python video." It's not. What we're really focused on here is how to interact with and run code that was written in VS Code. It's still focused on how to use the tool. Don't worry if you don't fully grasp how the code works yet - plenty of code-specific content is headed your way.
Knowledge Check
You have a script named "myscript.py". What command can you use to run that script from the terminal?
Importing Python Packages
Now we'll start to shift our attention more towards the usage of Python, still driving home the concepts of how to use the IDE. Off the shelf, programming languages can do a lot, but they can't do everything.. In fact, their real power is hidden away waiting for you to request to access it.
What I mean is that we can import special "code plugins" called packages that unlock the ability to do even more things in code. In this video, we'll import the Datetime package in order to access helper code that helps us work with dates and times (something that Python can't do by default).
This is an important concept because every programming language has this. Python has packages that you can import, JavaScript has modules that you can import, Rust has crates that you can import, etc - they all do the same thing.
Knowledge Check
If you want to work with dates or times in your Python code, what should you type at the top of your script?
CHALLENGE
You are in a job interview for a position that will work with code. The interviewer has asked you to prove that you know how an IDE works. Can you create a file, write some basic Python code, and run the code all within the IDE to validate that you have the experience required for the job?
Solution:
Knowledge Check
True or False: VS Code has a built-in terminal where you can run and debug your code without leaving the app.
Knox's FINAL NOTES:
For your studies, I strongly encourage you to explore other IDEs mentioned in the first video. Pycharm is an excellent Python IDE, and IntelliJ is another great general purpose IDE.
View Transcript
Introducing VS Code
0:00Welcome to the content on getting started with software development fundamentals and setting up your own development environment. Look, this is content that I'm particularly excited to talk about because software development was something that I got started with a little bit later in my technological career. I actually began as a hardware person focused on networking appliances, but software development became a huge part of my career starting around 2017 or so when I was forced to start automating massive large scale deployments of my network infrastructure.
0:37The long story short year is that even though it was something that I put off towards the latter part of my technical implementations, I found out that this was actually the most valuable thing I have ever added to my skill set was just understanding software development fundamentals. That led me down even bigger rabbit holes and architecting some of the most massive and enjoyable and automated full scale solutions I've worked on in my entire career.
1:07Now, here we are at the beginning of a software development fundamentals journey. And the biggest thing that I want to say here is yes, we could talk a lot about theory. We could talk about the history of software development. We could talk a lot about keywords. That's not really my style. I'm more of a let's jump in and get some wins under our belt. Let's start building things. Let's start seeing how does it actually work. What happens when I click this button or turn this knob or flip this switch. That's my style.
1:38And what I propose we do right out of the gate is make sure your environment is ready for software development. Let's install some applications. Let's learn how those applications work. Let's learn how to create some basic software and run it. That's what we're going to do in this skill. Then once we've got that under our belt nine we know our environment works, at least with Python. That'll make transitioning to other programming languages, which is a requirement for this course, a little bit easier because once you've done one, the rest of them are pretty similar.
2:13So without further ado, let's get started setting up your environment for software development. Let's go.
Install and Set Up VS Code
0:00So what is this? What are we looking at here on the screen right now? Don't focus on the code. Don't focus on the text that you see. Focus on the entire picture. Focus on the application that I'm looking at. This is called an interactive development environment or an IDE. And I think the key word right there is actually this "I", the interactive part . It is interactive. It's more than just a text editor. It's something that you can not only write text or code in like you see right here, but also interact with it. It will actually tell you things about your code.
0:40It can tell you when it's broken. It can tell you when some of these syntax or the stylization of the code is wrong. And it can even test your code or debug your code as we like to say. Now you're gonna get to know the ins and outs of IDE's quite a bit throughout this set of videos. Your first step is just to well get one. So how do you get an IDE? Well, check this out. If I flip over one page right here, I've Googled popular IDE's, even though I already know exactly which one we're gonna be working with. The thing is with IDE's is there's lots of them.
1:17Sometimes they're free. Sometimes they cost money. Some IDE's are really good for specific programming languages. In fact, right here is kind of one that I'm looking at for that example. PyCh arm. PyCharm is really good for the Python programming language. Some programming languages are a little bit more general purpose. For the most part, this list that you're looking at right here is all pretty specific to specific programming languages.
1:51IntelliJ for the most part has been used by Java developers, even though it adds some support for a couple other programming languages. PyCharm is for Python. Ruby mine is for, well, Ruby. Visual Studio right here. This is Visual Studio. Basically, the class version of it is for the dot net framework, which is heavily used by the C# programming language. You'll learn more about those key terms and what makes a framework in a programming languages later.
2:22Just trust me when we're talking about the applications for right now. Xcode is largely for Apple developers. And for paid solutions, a lot of software developers do like working with things like JetBrains. JetBrains does make a lot of IDE's. If you click on developer tools right here, you'll see a lot of the items that we just talked about are listed right here. But for most developers, a one size fits all solution that is modular, meaning we can add stuff to it, is Visual Studio code.
2:56This is free. This is general purpose. But we can add extensions or basically like plugins into it that hone in the ability to work with specific programming languages and do some really cool stuff with it. Visual Studio code is open source. And open source is something we're going to talk a little bit more about what that means and why it's important and why it's a big deal in the next video. For now, we're just going to leave it at one sentence. It means it can really run on anything.
3:29And again, I'll dwell on that what that really means a little bit more in the next video. But for now, this is the application that I'm going to be working with. And quite frankly, this is the application that I actually do my production software development in right now. It is free. It is extraordinarily powerful. And if it doesn't come out of the box with the functionality or the support that I want, I can add it with extensions. So what I'd encourage you to do right now is download and install Visual Studio code.
4:02You can see the various platforms that are supported right here, Mac OS, Windows and Linux. And it does work on Apple Silicon. So if you're working with the ARM CPUs, it'll absolutely work for that too. So go ahead and install that and then go ahead and open up Visual Studio code, which is where I am right here. I'll go ahead and close these files here and kind of show you some of the things that you can do. We're going to spend some time setting up Visual Studio code to work the way that you want it to go here under code, go to settings and take a moment to actually explore color themes.
4:39I know you're thinking, wait a minute, like this is a software development course. And we're talking about color themes. Yes, we are talking about color things because you know why you're going to be staring at this screen for a long time. And it needs to be in a color format that your eyes are comfortable with. You can even add new color themes by browsing additional color themes right here at the top. It'll search for color themes. You can actually load a huge list, although right now my loading failed. I think probably because I'm connected to a VPN right now.
5:10So again, I do highly recommend you actually take the time to explore your themes and pick a color theme that you can stick with. I know this is it seems silly, but it's actually something that I found has been a really important thing for me to stay focused in on what it is that I'm working with. OK, next thing that I want to talk about is just the layout of VS code right here. Now your layout is going to look a little bit different the first time you launch it. All of this stuff right here on the right hand side of my screen is actually going to be on the left hand side of your screen.
5:47I moved it to the right hand side of my screen on purpose. You might be thinking, why would I have done that? I'll show you just to flip it back for a second. This is probably more like what you're seeing by default. When I click this little gear down here by the bottom, I'll click command palette and I'll search for the word position. You see this toggle primary sidebar position. If I give it a click, it'll flip it over here to the right side. Now, why did I do that? It's kind of a subtle thing again.
6:19It's just about keeping my attention and keeping me focused in on working. Whenever I actually bring up a file, any file that I want to work with, I'll show you if I bring up just a, you know, a little script right here that I'm working with. If I do command B or control B on Windows machines, it collapses that screen. So I get a little more real estate on my screen to work with. When I have this stuff over here, this positioned window over here on the right hand side, it doesn't move my code.
6:50See, check us out. If I put it back, go to command palette, type in position, toggle the position bar over here. Now, when I do command B, see it shifts my code, it's a subtle thing, but it's another thing that's really, really important for me to be focused in on being efficient. So the ability to collapse without shifting my code is just another thing about setting up my environment in such a way that I can do a lot of software development over a long period of time and just make it a little bit more sustainable.
7:23Now, some other things that are going to be helpful to you to actually just understand how to navigate around VS code. One of the things VS code shows you is what programming language you're currently working on. It's small, it's subtle, but it's right here. See where it says move right there where my mouse is at the bottom? That's because I'm actually working with the move programming language right now. If I change this to something entirely different, like this markdown file, see, I changed to the markdown file and now it's pointed out that this is a markdown language right here.
8:01I can change it one more time to be something like a rust file. Let's just grab a rust file here. And there it is. There we go. There's a rust file. And you see now it shows that this is a rust file down there. So visual studio code can detect what programming language you're working on just by looking at the file extension. And importantly, it can also highlight the syntax and understand some of the things that are going on in that file by this detection.
8:35Sometimes though, it doesn't get the detection just right. And you can actually click on the language right here and choose all of these languages that it can support out of the box. Or maybe not out of the box. If you need to add support for certain types of programming languages or any additional functions, this is where VS code really shines. This is what makes it so popular. It's the ability to add basically plug ins into VS code on the fly that extends all of the things that it can do, that it can extend all of the support that it has.
9:11And that's what these little building blocks right here are. These represent. These are the extensions. If we give it a click right here, I'll collapse the extensions that I have installed and you can see some of the extensions that it recommends right out of the box. But you can search for anything that you want, like Python support search for Python. And you'll see a lot of Python extensions pop up for you to work with the official Microsoft supported Python language extension is probably the one that you want to go with.
9:46I go ahead and encourage you to click on this Python extension right now. And where you see right here, it says like disable for me, I would go ahead and click the install button for you. Go ahead and do it. You'll see in just one second, Python support has been dropped into your VS code application. That's all you had to do to turn this into a Python development environment. Feel free to explore other things. Search for something like go. The go programming language is very popular this day and age.
10:17So you see this one right here, go team at Google, give that one a click, install it too. Now VS code supports go. You can do the same thing for rust, another programming language that I highly recommend getting familiar with. I'm personally using the rust analyzer extension right here. In my own environment, now there's a lot more extensions that I'll probably introduce you to when the time comes. This is all about just getting familiar with the tool, getting familiar with VS code.
10:49The final thing that I want you to see is the terminal itself. This is where you can actually run and debug your code. All you have to do is go to the top window of your screen and click new terminal. And it'll pop up a command line terminal right here in the application. You don't have to jump between applications now, leaving your text editor to go to a terminal to run a script and see what it does. Now you can look at it all in one place, thus proving that this really is interactive.
11:21Now I promise you're going to see so much more of this application, the ins and outs of what it can do, even in this skill. So for now, we just wanted to get VS code and start getting familiar with just the landscape of it. Take some time to customize it and kind of set it up to work the way that you would like it to. Basically, pick a good color theme and choose if you want this window to be collapsible on the right hand side or the left hand side. Some of the other things that these icons mean, don't worry.
11:51We're going to explore them as we progress. But for now, this has been getting your first application installed, the IVE VS code.
Understand What Open Source Really Means
0:00Now before we dig into this anymore, I wanted to take a moment to elaborate on what open source software Really means this is very frequently abbreviated OSS in the software world and if you ever find yourself on this website github.com It's very likely that you're going to be taking a look at open source software now nothing There's always these gotchas. There's always these well, maybe not maybe this you know Not open to the public but the idea the core ethos of github is a place where people Can share their work and share their software out in the open and Anyone can come along make a copy of that and contribute to it They could add their own fixes to problems or improvements or features into it And that's exactly what VS code is right here You are looking at the core software the actual software that was written that makes VS code work and run on your computer This is a big mindset shift from even I'm gonna say like you know ten years ago Open source software was less common it was starting to become more common
1:20It was starting to become more of the thing around I'm gonna say 2015 or so I mean just thinking I'm just thinking personally You know in my experience working with computers over a really long time There was you know I started with Windows 95 and it was really Windows 95 all the way through you probably Windows 8 is where I want to say When applications were designed to run on Windows they were only Designed to run on Windows it was uncommon to find an application that ran on both windows and a OS X which is now Mac OS like multiple operating systems Windows had their own programming languages primarily see sharp was a big one and C-sharp really belonged to a bigger family of how software was designed and laid out called the dot net framework The dot net framework was just that it was a framework It was basically a scaffolding an architecture and you could drop C-sharp code into it to make your application work
2:36but for the most part the dot net framework only worked on Windows computers and Importantly the dot net framework itself and the C-sharp language were closed source So you could learn how to write code in C-sharp and you could write Applications that worked on Windows, but you couldn't actually contribute to C- sharp at the same time So around I'm gonna say like I'm gonna stick to 2014 about 10 years ago at the time of this recording around 2014 There became this big shift in developers where they didn't want to write programs that only ran on one operating system anymore in Particular they didn't like it when the operating systems also had to be paid for and licensed They if they were writing an application they wanted that application to be able to run anywhere Which means the language that it was written in as well as the operating system That it runs on needed to be some form of free So they just became a huge cultural movement in software development Where developers started shifting away from things like the dot net framework
3:54I'm gonna say and I don't want to say like people stop developing for Windows obviously Windows is still an absolutely massive humongous operating system and applications are written for it to this day they just Forced the hand more or less for Microsoft to transition away from closed sourced application Programming to where if a developer wrote a program one time it should be able to run anywhere so developers started writing in programming languages like Java or Python and the big win for these is these programming languages can run everywhere and developers also fell in love around this time with Linux based operating systems because Linux based operating systems are usually small and they're almost always free So from their point of view a language that can run anywhere and an operating system that's free There's no barrier to entry to use their application So fast forward to today 2024 What happened around this time that made Windows forced that you know had Windows changed their position on open source software
5:10Well, they recognize this advent was happening right here that developers themselves were shifting away from the dot net framework and the C-sharp programming language because that would restrict their application to only being able to work on Windows which was also a paid operating system and In a truly global environment where not everybody has a laptop and can afford to pay for Windows or things like that Forcing this hand was actually a barrier to entry for software developers So recognizing that that's the case Windows actually started to transition from dot net framework to dot net core Which is now an open source software version of dot net and today that is now transitioned to just dot net so it went from dot net framework to dot net core to now dot net and C-sharp is now open source I can now run C-sharp written applications directly on my Mac OS operating system and along with that this whole advent of creating programming languages and applications that software developers like
6:26The ultimate tool VS code came out of that too As you've seen in the previous video VS code is now basically a de facto standard for software developers to work with because of its ability to be extensible Anyone can now see exactly where VS code comes from and because they have this ability they can now build their own extensions like we explored in the last video and add that extension to a marketplace Where anyone can come along pick the extension and choose to install it directly into VS code that might have been a subtle thing that You might have missed but if I flip back here and jump over to my extensions real quick and just grab an extension like this one We can actually see that this is a marketplace the rust extension pack what version it's on who created it How many times it's been downloaded and importantly ratings from the public of what they think about it Then you can also look at what does this actually do it can show you little snippets like it What what is this supposed to do or give you links to understand what it does?
7:38Just picking on another one like Azure tools that actually allows you to work with cloud compute something We'll talk more about later You can actually see that this Azure tools extension is an extension pack It comes with a bunch of additional extensions that you can install right here And if you scroll down and explore and let me get this terminal out of the way You can actually show you screenshots of what each of these extensions do and how you can work with them Importantly you can see who published this how many times it's been installed and again ratings for what they think of this extension so far So all of that is to say is that when you start working with software in general you Maybe coming from this mindset if you are at least have been around you know technology as long as I have for a long time applications could only work on one operating system and you know what maybe people still are making Applications that only work on one operating system you see that very frequently when you open up something like the Apple App Store It's very likely that that's only going to work on Apple But for the most part as a software developer who's getting started Freshen the game you're going to want to work with open source as much as
8:54possible Programming languages that are supported everywhere and that's why in the next video we're going to get started with Python So let's pick that up in the next video
Install Python
0:00So with our understanding of using open source software to begin learning some basic software development fundamentals, we're going to start by talking about one of the most popular first programming languages in the world. And that's Python. Python is very, very, very, very popular because it is, in my opinion, the most human readable programming language. As far as programming languages go, this is the one that reads the most like an organic human sentence.
0:34Other programming languages that are still really popular, like JavaScript, have a lot of special characters in it. You'll see the braces symbol a lot. You'll see semicolons a lot. These are symbols that don't show up a lot in human sentences. Whereas Python really is the most human readable programming language, which makes it a natural first step for people entering the programming language world. Beyond that, Python is very general purpose.
1:10And when I say general purpose, I really mean that you can kind of do a lot of different things with one single programming language. For instance, you might want to make websites and do web development. You can do that in Python. You might want to get into AI or machine learning in the same kind of vein. You have data processing and you can do that with Python. You might just be looking to automate monotonous tasks.
1:42One of the most popular programming and software development fundamental books ever written is called automate the boring stuff with Python. And it is actually the book that taught me Python. Because I wanted to do exactly what the name implied, automate boring monoton ous work. In particular, in my case, it was working with Excel files. I did not fully understand just the breadth of how much stuff you could actually do with Python. There was, but because it's such a popular programming language, it is also just like VS code.
2:18Extensible. Meaning we can take Python out of the box. And if it doesn't do exactly what we wanted to do out of the shelf, someone has likely built a drop in plugin. Something will explore towards the end of this skill and add functionality to it. We can extend its capabilities. So how do you get Python? Well, if you're working on a Macbook or a Mac OS machine or a Linux machine, you already have it. If you open up a terminal, you can simply type Python 3.
2:51That's all one word like this and press enter. And you see it launches the Python 3 interpreter. This prompt with the three dashes right here is how you know you're on the Python interpreter. Now, why is it called an interpreter? Well, because when we write Python code, it actually reads like a human language, but computers don't actually process human language. Computers process bits ones and zero zeros and ones like so.
3:24So what the Python interpreter does is it literally interprets our human readable language on the fly and translates it into what is known as machine code or byte code. Those are synonyms. So this terminal right here is really waiting for us to type in Python syntax or Python commands so that it can interpret it on the fly into byte code.
3:57Check this out. If you want to try it, I'll try. And if you if you have this already loaded up, don't worry if you're on Windows , we're going to show you what to do next. You can do print open parentheses, open double quotes. Hello world. Close double quotes close parentheses by type enter right here. It returns the word hello world that I typed right here back to me. The interpreter interpreted the Python command of print and did the actual processing right there.
4:29So now what I want to leave the Python interpreter, I'll type exit, open and close parentheses, and it returns to be back to my terminal. So this is just understanding that Mac OS and Linux machines come with the Python interpreter by default. Windows machines, however, don't. You still have to go out and get Python and Python can actually be a big installation for anyone working with Windows machines. So we'll go to Python.org to bring this up.
4:59And to download and install it, I'm going to hover over downloads and you see Python 3.12.3 right here. Your version may look different because of the time whenever you recorded this, they may come out with new versions later. We'll go ahead and click on Python 3.12.3 and it downloads the installer and then I'll open the installer to actually launch the installation. Now, here's what I recommend you do because right now what it wants to do is it wants to install this in my local profile environment.
5:29What I actually recommend you do is you install this in a path where any user can get to it. So let's do customize installation right here. We'll leave all of these things default. We're going to set this true to for all users though, right there. And this will require admin privileges to launch this, but we do want all users to be able to run our Python scripts. We'll click next and we're going to change the installation location here. I'm going to click browse and I'm going to move to my C drive.
6:02So let's go to this PC. We'll go to the C drive. I'll make a new folder right here and I'll call it pi 3.12.3 for Python version 3.12.3. And I'll kind of click on it. I've got it selected and I'll click OK. So that's where I want to install it. Let's go ahead and make sure we set install Python 3.12 for all users and add Python to environment variables as well. We'll click install and that should kick off the installation.
6:33It's really important that you don't miss any of those steps or those options. I just want to stress that. The installation finishes after one moment. There's one final thing that you can do here. It shows disable path length limit. It says this changes your machine to allow programs like Python to bypass the 260 character max path limitation. Go ahead and do that just in case it's something that you expect to need in case you do need to have a longer path character limit name when specifying paths to specific resources.
7:07Now, what can we do? Let's bring up the command prompt here. I'll type CMD. And what I'm going to do is I'm going to run this as administrator. The big reason I want to run this as administrator is because the Python installation just changed the path environment variable running it as administrator will effectively refresh the cache of what it has in the Python environment variable. So with the command prompt launch here, I can now type Python 3.
7:37Sure enough, it brings me into the interpreter and I can close that out. Look, just one other thing I want to point out. You don't have to go through that big installation as well. It's now baked into the Microsoft Store. So if you have access to the Microsoft Store because most enterprises do shut down access to the Microsoft Store, but if you're just working on your local computer at home and you can access it, search for Python 3 and download the Microsoft Store. And download, you know, whichever version of Python 3 you want, 3.12 is the most recent version.
8:08It'll do effectively the same thing. So this is how you go about getting Python 3. At this point with Python 3 installed and VS code set up, you're ready to work.
Work with Python Scripts
0:00So now we're going to walk through is actually setting up a workspace and creating our first Python script and running our first Python script from VS code. Here's what I want you to do. I want you to bring up a terminal or file explorer, whichever operating system you're working on. If you're working on Windows, bring up file explorer. If you're working on Mac OS or Linux, you can bring up terminal. Either way is really easy. So from whatever folder you want to begin with, maybe it's your C drive, in my case, in Mac OS, it's my home folder.
0:33What I want you to do is I want you to make a folder, let's call it make their and call it like work demos, something like that. You can just right click, do new folder and make a folder called make them work demos. I'll press enter and then I'm going to change into work demos. Then from here, I'm going to make another folder, call it first demo like so. I'll press enter and I'll change into first demo. At this point, you can stop.
1:03If you've created these two folders, you're good to go. You can close your terminal. You can close your file explorer. We can pick up the rest and do the rest from our ID or interactive development environment, in this case, VS code. I'm going to launch VS code, fresh new launch. In my folder section over here, you know where my little extensions are, you see it looks a little bit different. That's because the last time I opened it up, you saw all of those extra buttons , because I had files already open.
1:36When those files were already open, it triggered some extensions to pop up. In fact, as I was sitting here, they just started to pop up on their own as they just got loaded into the program. At the very top here, we see our file and folder explorer. What I want you to do is I want you to click on open folder. I want you to make your way to that folder. I'll go to work demos and then first demo. Then with first demo clicked right here, I'm just going to click open. Now, over here, I'm looking at the contents of first demo. I'll say yes, I trust the authors, because I am the authors.
2:11Right here, I'm looking at the contents of first demo. I can right click in here and choose to create a new file. We're going to call this my demo.py. Python scripts have the file extension.py or py. Immediately, I notice down here that VS Code interprets this as a Python file. I now have my demo.py opened right here on my screen.
2:41I'm free to begin typing effectively whatever Python code I want. We can do the same thing we already did with print. I'll do open and close parentheses. I'll do double quotes. I'll say hello world . I see the little white dot right here, kind of where my mouse is, a little bit to the left of my mouse. That means that I haven't saved this file. That means whatever I've typed here hasn't actually been committed to disk right now. So as far as the disk knows, it's just an empty text file. But if I do command S or control S, I save the file and then it goes away.
3:20I can then go onto a new line and start typing some more stuff. We can type print. How are you today? If I do command S one more time, it saves it. That's fantastic. So what the print statement does, this is important. It feels kind of silly right now. But what the print statement does is it takes anything input, any value that we give it, and it retipes it in the terminal.
3:53You might be thinking to yourself, well, what good is that? Why do I care about that? What developers actually end up using this for is they'll do something really, really, really complex in code. They'll take a bit of data in and then they'll change it as this code progresses. And as it goes from line one to line two to line three to line four, they might forget how it gets changed along the way. And what they want to do is they want to put print statements in the middle of their code as it's progressing along the way to see how everything is changing.
4:36So print is actually a really useful debugging tool, where as data is coming in , and we want to see what is the application doing with this data at each step along the way, we actually use print to print out what it's doing along the way . Let's tinker with that a little bit, shall we? Let's actually say, I want to start out by holding just the number zero somewhere. What I might do is I might actually create something called starter as just the name of some item that we want to save.
5:13Then what I might do is I might say starter is going to be changed to be starter plus one. Then I might say starter becomes starter plus 400,000, nine, 410,000 nine hundred and seven let's just make something up like that. Now, at what point, what is starter at this point right here, that becomes the question. So you can see, we started out by creating what's known as a variable. This is just something that we just give it an arbitrary name any name we want to give it, and we store data inside of it.
5:55So we changed the value of starter to be whatever starter was plus one. Then we took whatever that was and added 410,000, nine hundred seven. So I could quickly do some math and see that's 410,000, nine hundred eight. But if you're not paying close attention, you might just want to be like, Hey, what is starter at this point in my code and that's what print does. Now the question is, how did I have this Python script, how do I actually execute it, how do I run it. There's a couple different ways. We can go back to our terminal.
6:29We can go into our working demos directory and then our first demo. If I type LS I see here's my demo.py and I can run the script with Python three, we say Python three, and then just the name of the script. And boom, there we go. That's the first way to run your script. You can do it directly from the terminal. This is usually done when we're done working with it. This is usually done when we're like, Okay, the script is done. I don't need to edit it anymore. I don't need to look at the code anymore. I just want to run it. This is when we usually go to the terminal to do it. If we 're still in the middle of debugging and working with it.
7:08This is when I might still fire up my terminal right here. I could do the exact same thing from the seat when I do terminal right here. It automatically launches me into the folder that I had open in my explorer. So if I type LS I could do the exact same thing. I can say Python three, my demo.py and it gives me the same results. I could also go here to run and say start debugging. And it looks like my Python extension is disabled. Let's go ahead and enable that real quick.
7:39I'll go into extensions with the little blocks. I'll click the dot dot dot and I'll say enable all extensions. Now that that's enabled, I should be able to go to run and start debugging. It says use the Python debugger, which is what I want to do. I'll click that. It's a Python file. I'll click that. And right here. Look, see, it's running it. There we go. So this is typically how we end up working with software. Whenever we start actually writing and interacting with software, and this is how we're going to go about running Python scripts. Now in the next video, we're going to really ratchet this skill up a notch when we start adding extensions and actually watching it work on the fly.
8:22So until then, now we've actually got a workspace set up where we can see how to add files. We can see what it's like to write some code into a script, and then what it's like to execute a script from within an IDE, as well as just to stand alone terminal.
Importing Python Packages
0:00So in the last video we started to actually explore how to work with Python scripts, run Python scripts, and develop Python scripts. But this isn't really useful, is it? Just being able to print arbitrary text and arbitrary math out to the terminal isn't that great. Let's start thinking a little bigger. Let's think for a second about what we might want our software to actually do. A very common thing that software does is log. Log data.
0:30Log information. Now in order to implement an actual logging ability, it's going to require a lot of steps, a lot of understanding of programming languages and how Python works. Going to start out with something really, really basic though. A common concept that's implemented in just about every piece of software today . And that's logging and writing data to a file. Very frequently, what we do when we write data to a file is as events or things are happening inside of our application.
1:06Our application is at the same time writing this to a file. I receive this data. Here's the data. I process the data in this way. I changed this thing. I made this decision. It's basically an audit trail of everything the application is done. Now it's up to you, the software developer, to figure out what it is that you want to write to this file in the first place. Maybe you want to write every single tiny little thing down.
1:39Or maybe you only want to know what happened when something went wrong. That's up to you. But the thing is, is these log files get big, really, really fast. So one of the common things that we do is when we write data to a log file, we actually end up writing them to a bunch of different files. One of the more common ways that we do this is every day, we create a new file.
2:09So I could look at the events that happened on day one, the events that happened on day two, and the events that happened on day three. And after so many days of past, I may go back and say, "Okay, I don't care about day one events anymore, and I'll just delete that file to free up that space." So far so good understanding that we have what we call log rotation, a big software development concept you're learning right off the bat.
2:39We write events to a file, and then whenever a new day starts, we'll write those events to a different file. And after so many days of past, we'll delete the stale files. Well, one of the things that we may want to do is we may want to create this file in our code. And we may want to use today's date as the name of the file. It could be something like 2024411.txt is the name of the file.
3:16So if I'm thinking about a file structure, I'll have something like my application. And then in that, I'll have a folder called logs. And then in that, I'll see this file. And then tomorrow, it'll be 2024412.txt, and so on and so on and so on. So our first mission is going to be how do we dynamically create this file? Well, the big challenge that we have is we have to dynamically get today's date .
3:51And Python can't do that out of the box, believe it or not. We have to import what we call a module, or basically helper code, or basically a plugin into our Python script that has the ability to do it. Here, what I'm going to do is I'm going to create a new file, and I'll call it mylogger.py. See, there's no Python code that I can write this very second that tells me what today it is.
4:21What is today's date? Instead, I have to actually import that ability into my Python script. And we do that by saying import date time. Date time is the module. It is the thing in Python that has the functionality to work with the operating system and understanding this computer's date and time. The reason why we don't have this by default is if I were to, let's pretend this script have the ability to work with date and time by default.
4:59Under the hood, that would actually consume more memory from my computer just to load all of those processes and background checkers and all of those things that make that work. It would consume all of those background resources needed to get date and time. My script here doesn't need date and time. See, there's no call to date and time here at any point in this code. So there's no reason to eat up that overhead on my computer.
5:29But my longer script, I am for sure going to need today's date and time. So I'm okay importing that functionality. It's very lightweight. It's not going to slow my computer down, but we just don't want to import unnecessary packages, unnecessary libraries, unnecessary modules into our code if we don't need to. So in this case, I do need to get today's date and time. So the first thing I'm going to do is I'm going to say, let's get today's date and store it in a variable.
6:02So I'll create a variable called today's date. It's today underscore date. And I'll say using that date, time module. I want to find a date. Specifically, I want to know today's date. It's kind of a weird syntax the first time you see it. We haven't talked about classes or methods yet. We will. What this structure actually means will make more sense as we progress along. But just for now, I want you to focus in on the key takeaway here.
6:36In order to get additional functionality out of our Python code, we have to import this particular package called date time. So now at this point, today's date is stored right here in this variable called today date. How can I check to make sure it's the correct today's date? Of course, we can use print. So I'll say print today date. Now down here in my terminal, I can say Python three, my logger.py.
7:09And sure enough, there is today's date 2024, 411. But let's say, hmm, I'm not so sure about that format. Even if year, month, day, maybe I want the more, you know, I guess the more Americanized way of doing it, we could do month, day, year. How can I readjust that? Well, we can actually reformat the date format that comes back to us using a specific method. That's what this is called. So after we get today by saying today, I'll tack on one more thing that I wanted to do.
7:46I'll say dot S T R. That's string. That's what that's short for. F, that's format, time, then you can kind of see the helper text that my computer is getting me right here. It says if you want your month, day, use percent year percent M percent D. In my case, I wanted month, day, year. So I'll say open parentheses, double quotes percent M, hyphen percent D for hyp hen percent capital Y.
8:22It's important that that's capital. And then take a look at this. So in this case, I'm now using the date time module to get a date, specifically today's date. And then I'm reformatting the string to be month, day, year. When I print this, we'll just rerun the command right here. Now I've got month, day, year. So at this point, this is where we're going to pause in this part of the journey. I know it's kind of like, well, we didn't actually write the file.
8:54The big thing that I wanted you to understand was really about importing packages that scripts by default can't do absolutely everything under the sun. Lots of times we have to go out and get packages and add that functionality to our script by importing those packages. But once I imported the date time package, I could then dynamically figure out things like today's date and then even reformat the structure of today's date.
9:24Now that I have today's date, I can create a file with today's date in the name of it. The reason why this is a big deal is because every programming language just about in existence has this construct to it that by default, it can't do everything under the sun. You have to add functionality to it. And it's almost always the very first thing that you declare at the top of your script. I'm adding these functions, these resources into my script and into my code so that I can use them just a few lines down.
10:03So whether it's JavaScript, Python, Go, Rust, Java, C#, it doesn't matter. They all start with some type of import or using, use, add, whatever the statement is, they're adding functionality to their code. And now you've kind of seen it firsthand in action using a Python script. So you've come a long way in this journey. You started from nothing.
10:34Now you've actually got a full blown development environment with Python code being imported and being run locally in the IDE. I hope this has been informative for you and I'd like to thank you for viewing.
CHALLENGE
0:00So your mission was to create a new file with NVS code and then basically do whatever you want to print anything you want to do it but importantly make sure you're printing out the date time somewhere using the date time module to get today's date. Now I'll show you one little additional tip that could make this a little fun as part of it. Let's start by creating a new file. We'll call this challenge.py. Like so of course I'm going to import date time into it and then I'm going to get today's date and that of course comes from date time, date today.
0:40Now one of the cool things that you can do is you can actually do kind of what it's showing you right here how to concatenate string together. What does that mean? Concatenate means combine effectively and string is just a string of text characters. We haven't talked about primitive data types yet. We're going to in the next set of videos but one of the very first things I'm going to give you a preview into is that there is the concept that text in programming languages are very frequently referred to as string and we can combine two strings together with concatenation.
1:18Now Python has like 20 different ways to do it. The later versions of Python use something called string formatting or string interpolation. So check this out. What I can do is I can type print and then instead of typing quotes like you see here on the screen what I'm actually going to do is I'm just going to type a lower case f. Now what the lowercase f tells Python to do is it's basically saying I'm about to give you a bunch of string but in the middle of it we're actually going to insert Python variables or Python codes that you need to interpolate into string.
1:59Watch how this works. This will make a lot more sense when you see it. We'll just say double quotes and we'll say today is and then I'll say double braces and you see this today date variable right here. I'll put that right here like this. So take a moment to digest what this is doing. This is going to print today is and then it's going to print out the contents of that variable as part of this big whole string.
2:31This is what that f does right there. That f says we can actually use these braces to drop in Python code Python variables and you'll be able to pull the string out of it that you need. So now when I say Python three challenge.py look at that. See today is and the full thing right there. This is really just to get you acclimated to working with VS code.
3:04This really wasn't about the code at this point. It was more just about creating files, interactively editing those files and then running those files all within one application. And now we've done that. I hope this has been informative for you and I'd like to thank you for viewing.
Frequently asked questions
What does the Learn to Use an IDE lesson cover?
This 58-minute lesson walks a team member through installing and setting up VS Code, understanding what open source really means, installing Python, working with Python scripts, and importing Python packages, followed by a hands-on challenge. The focus is on getting a working development environment in place and running basic software, rather than on theory.
Why does the lesson use VS Code and Python instead of other IDEs or languages?
The trainer notes there are many IDEs, some language-specific like PyCharm, and chooses VS Code because it is free, runs on macOS, Windows, and Linux (including Apple Silicon), and can be extended with extensions. Python is introduced as a highly human-readable first language, which makes later transitions to other languages in the course easier.
Does a team member need prior programming experience to take this lesson?
No prior coding background is assumed; the lesson is the starting point of a beginner course and begins by installing the tools from scratch. It is a practical fit for IT Directors and Training Managers onboarding junior software engineers and early-career IT staff who need a consistent baseline.
What can a team member do after completing the Learn to Use an IDE lesson?
They can set up a VS Code workspace, add files, write code into a Python script, and run it both from within the IDE and from a standalone terminal, including using the Python debugger. They also see how print statements support debugging and how importing Python packages extends functionality, such as implementing basic logging to a file.
How does this lesson fit into the ISACA Software Development Fundamentals (ITCA) course and certification?
It is the first skill in a course of about 6 hours 50 minutes per learner that goes on to cover variables, functions, data, functional code, Bash, JavaScript sync/async concepts, backend datastores, and SDLC fundamentals. The course fits teams preparing for the software development portion of the ISACA ITCA certification.
How can a Training Manager use this lesson when onboarding a cohort of junior developers?
Because the lesson establishes a working environment every learner shares, Team Leads can assign it first and pair it with internal coding standards so learners connect fundamentals to how the organization ships software. Team reporting provides per-learner progress and completion, cohort and group views, and completion exports for audit evidence.
Team training path
Turn this skill into assignable team training
This free skill is a preview of the courses your team can assign, track, and report on with CBT Nuggets.
Free training library
More free lessons in ISACA
ISACA
Organizational Governance
Free lesson from ISACA CRISC – Certified in Risk and Information Systems Control · 53m
ISACA
Information Systems Operations
Free lesson from ISACA CISA – Certified Information Systems Auditor · 58m
ISACA
Creating An Information Security Program
Free lesson from ISACA CISM – Certified Information Security Manager · 1h 1m
ISACA
Defining Security and its Roles
Free lesson from ISACA Cybersecurity Fundamentals (ITCA) · 53m
ISACA
Explore Data Science Foundational Concepts
Free lesson from ISACA Data Science Fundamentals (ITCA) · 44m
ISACA
Numbers in the Computing World
Free lesson from ISACA Computing Fundamentals (ITCA) · 50m
$59
seat / mo, billed annually
