---
author:
- VSCode IDE, debugging, project management
date: "by [Eugeniy E. Mikhailov](http://physics.wm.edu/~evmik/) and
  [Greg Bentsen](https://physics.wm.edu/~gbentsen/)"
title: Introduction to Virtual Studio Code
---

## Logistics and Agenda

Homework 2 due Monday Sept 14 at 11:59pm

\

Agenda

-   This week:  VSCode IDE: editing, debugging, project management
-   Next week:  AI tools, data reduction & fitting

## Virtual Studio Code (VSCode)

VSCode is an IDE = "Integrated Development Environment"

This means it contains everything you need to:

-   write
-   run
-   debug
-   troubleshoot
-   manage

your Python projects all in a single interface.

It also natively incorporates AI tools. We will introduce these next
week.

## VSCode Orientation

Install Python extension (Microsoft)

\

Navigation

-   Main code window (center)
-   File explorer (left panel)
-   Terminal (bottom panel)
-   AI chat (right panel), ignore for now

## Debugging Tools

Use HW02 problem 6 as a testing ground

``` {.python .numberLines}
import numpy as np

def mymean(x):
    total = 0

    for val in x:
        total = total + val

    return total / len(x)

def mystd(x):
    total = 0

    mean = mymean(x)

    for val in x:
        total = total + (val - mean)**2

    return np.sqrt(total / (len(x)-1))


```

## Debugging Tools

Breakpoints

Debug controls (continue, step over, step into, step out, restart, stop)

Examine variables in code by mousing over

Debug panel (left)

-   Variables
-   Watch
-   Call stack
-   Breakpoints
