In this post, you’ll be introduced to Visual Studio Code, Python, and Jupyter Notebooks. You’ll learn how to install all the software and packages you’ll need to begin writing code.
- A Windows, Mac, or Linux computer
- Knowledge of how to download programs from the Internet
Lines of code are instructions that humans give to computers to make them do things. While you may hear about how smart and amazing computers are, on their own, they are only good at one thing: following explicit instructions.
Visual Studio Code (often referred to as VS Code) is a free, open-source, extensible, code editor. We can break this description down a little further to get a better understanding:
Code editor: A code editor is made specifically for writing, running, and debugging code. Code editors can be compared to an application like Microsoft Word, but having additional functionality such as autocomplete of code functions and the ability to execute, or run, code.
Open-source: Open Source Software (OSS) has its code available for anyone to explore, modify, and enhance. The main takeaway from this is that anyone, even you, can build a new feature in software such as Visual Studio Code and contribute it back to the source code for others to use. You can find the open-source Visual Studio project on GitHub
Extensible: Extensible means that something can be extended and expanded. In the context of Visual Studio Code, being extensible means that you can download, or even create, extensions to make Visual Studio Code exactly right for your work style. Think mods in a game or customizations. If the color scheme is hurting your eyes or an obscure programming language isn’t supported, you can customize Visual Studio Code to add new colors or support for the language. You can find the Visual Studio Code extensions on the marketplace or discover how to build your extension in the Visual Studio Code documentation.
Click on the extension tab in Visual Studio Code to access all the Python open-source tools that’ll be helpful for this learning path. The extension tab looks like three blocks in the shape of an “L” with another block floating to the right.
If you want to, you can explore the extensions marketplace and install any extensions you’d like to have, but for this tutorial, we’ll install the Python extension. When you’re in the extension marketplace, go to the search bar and type “Python”. Look for the extension named solely Python and published by Microsoft – it should be the first result. Click on the extension and then click “install”.
While you’re in the extensions tab, go back to the search bar and type in “intellicode”. Select the specified box. It should be the first result. Select Install. IntelliCode will recommend code when you’re writing programs, which is a great tool for beginners who might not know the exact syntax.
Visual Studio Code Jupyter Notebooks has good documentation about how to use the environment. In Jupyter notebooks, you write code in cells. Click on the plus button to the left of a cell to create a new cell below the current cell. Click on the garbage can to the right to delete the selected cell and use the arrow buttons to move the cell up or down in relation to the cells around it.
Use the green play button in each cell to run that cell. After you run a cell, a number will appear, surrounded by square brackets. This number is to help you keep track of which cells you run. This is important because, as you’ll remember, you can re-run cells within a Jupyter Notebook, which might change variables or program state.
If you look at the top of the file, you will see that you can run all cells above or below the current cell by using the play button. Finally, you can click the red pause button to force stop the program at any time.
The Jupyter notebooks have been widely adopted by the data science community of practitioners to hypothesize and visualize data in a format that enables rapid prototyping of their applications.