Python
jupyter notebook
vs-code
A VS Code Notebook is a special type of file (.ipynb
) that allows you to run code in cells, similar to Jupyter Notebook or Google Colab. The main difference is that everything runs on your own computer, meaning you have full control over resources and execution time.
✅ Advantages of using notebooks in VS Code:
To use notebooks in VS Code, you need to install some tools:
Install VS Code. Download it from https://code.visualstudio.com/
Install the Python Extension
If you don't have it installed, open a terminal in VS Code and run:
1pip install jupyter
Open VS Code.
Go to File > New File and save the file with the .ipynb extension.
You will see an environment similar to Jupyter with code cells.
Write code in a cell and run it with the ▶️ button or by pressing Shift + Enter.
Cell 1: Import Libraries
1import math
Cell 2: Use the imported library
1print(math.sqrt(36)) # Output: 6.0
Feature | VS Code Notebooks 🖥 | Google Colab ☁️ |
---|---|---|
Location | Local computer | Google Cloud |
Resources | Unlimited, depends on your PC | Limited |
Internet Connection | Not necessary | Necessary |
GPU Access | If you have a GPU, you can use it with CUDA | Depends on availability |
Execution Time | Unlimited | Can disconnect |
VS Code Notebooks give you more control over your resources and do not have the limitations of the cloud. If you work on large projects or need more power, it is a better option than Google Colab.