EthicsComputerCourses
Join training +91 90532 10052

Set Up: Browser, Python & VS Code

Intro to Programming · Lesson 6 of 25 Beginner 8 min read Updated

You do not need to install anything to begin. Every example in this course runs right here in your browser. But real programmers keep their programs as files on their own computer, so in this lesson you will also install Python and a free code editor called VS Code.

Do the browser part today. Do the installation part whenever you are ready, ideally before the lesson on Working with Files. It takes about twenty minutes.

Step 1: the Try-it editor on this site

Every example marked with a "Try it" button opens an editor. You can change the code and press "Run" as many times as you like. You cannot break anything: reloading the page brings the original example back.

Python examples run a real Python 3.14 inside your browser. JavaScript examples run in your browser's own JavaScript engine. Try both now:

PythonRun it yourself
print("Python is running in my browser")
print(365 * 24)
Output
Python is running in my browser
8760
JavaScriptRun it yourself
console.log("JavaScript is running in my browser");
console.log(365 * 24);
Output
JavaScript is running in my browser
8760

Both programs print a message and then the number of hours in a year. Change 365 to 366 for a leap year and run them again.

Step 2: the browser console

Every desktop browser has developer tools with a console, a place where you can type JavaScript and see the answer straight away. Press F12 (or Ctrl+Shift+I on Windows and Linux, Cmd+Option+I on a Mac) and click the Console tab. Type a line and press Enter:

Text
> 1299 * 3
3897
> "Pune".length
4

The console is great for quick experiments. It is also where JavaScript shows its error messages, so you will use it a lot later.

Step 3: install Python

First check whether Python is already there. Open a terminal: the text window where you type commands. On Windows, search the Start menu for "Terminal" or "PowerShell". On a Mac, open "Terminal" from Applications, then Utilities. Type:

Terminal
python --version
Output
Python 3.15.0

If you see a version number starting with 3., you are ready. On a Mac or Linux, try python3 --version instead. If you get "not recognized" or "command not found", install Python:

  • Windows: get the Python install manager from the Downloads page at python.org or from the Microsoft Store. It adds the py command. Run py install 3.15 to install the latest version, and py list to see what is installed.
  • macOS: download the macOS installer from python.org and run it. Then use python3 in the terminal.
  • Linux: Python 3 is almost always installed already; check with python3 --version.

Any recent Python 3 version is fine for this course. Close the terminal and open a new one after installing, so it can find the new command.

Step 4: install VS Code

A code editor is a text editor made for programmers. It colours your code, warns you about mistakes and runs programs with one click. Visual Studio Code (VS Code) is free and works on Windows, Mac and Linux.

  1. Download VS Code from code.visualstudio.com and install it.
  2. Make a folder for your practice, for example coding-practice in Documents.
  3. In VS Code, choose File, then Open Folder, and pick that folder.
  4. Open the Extensions view (Ctrl+Shift+X), search for "Python" and install the extension published by Microsoft.
  5. Create a new file named hello.py and type this program:
PythonRun it yourself
name = "Farhan"
print("Hello from", name)
print("My computer can run Python!")
Output
Hello from Farhan
My computer can run Python!

Save the file (Ctrl+S) and click the Run button (a triangle) at the top right. The output appears in the terminal panel at the bottom. You can also run it yourself in a terminal that is inside the same folder:

Terminal
python hello.py

Use py hello.py on Windows or python3 hello.py on a Mac or Linux if plain python does not work.

Step 5 (optional): Node.js for JavaScript files

In a browser, JavaScript lives inside web pages. To run a JavaScript file directly, like a Python file, install Node.js from nodejs.org (choose the version marked LTS, which means long-term support). Check it with node --version. Then create hello.js:

JavaScriptRun it yourself
const name = "Farhan";
console.log("Hello from", name);
console.log("My computer can run JavaScript!");
Output
Hello from Farhan
My computer can run JavaScript!

Run it in the terminal with:

Terminal
node hello.js

The terminal in two minutes

You only need a few commands to start:

CommandWhat it does
cd coding-practiceMove into the folder named coding-practice
cd ..Move up one folder
dir (Windows) or ls (Mac, Linux)List the files in the current folder
python hello.pyRun a Python file
node hello.jsRun a JavaScript file with Node.js

Common mistakes

  • "python is not recognized". Python is not installed, or the terminal was opened before you installed it. Close it, open a new one, and try py on Windows.
  • Typing commands inside Python. If you see >>>, you are inside Python's interactive mode, not the terminal. Type exit and press Enter, then run python hello.py.
  • Running from the wrong folder. "No such file" usually means the terminal is in a different folder. Use cd to move to the folder that contains your file.
  • Forgetting to save. If your change does not appear when you run, press Ctrl+S first.

Key points

  • You can learn the first part of this course entirely in the browser with the Try-it editor.
  • The browser console (F12) runs JavaScript one line at a time and shows errors.
  • Check Python with python --version; on Windows the Python install manager gives you the py command.
  • VS Code with Microsoft's Python extension is a free editor that runs your files with one click.
  • Node.js runs JavaScript files outside the browser with node file.js.

Exercise

If you can, install Python and VS Code. Create a folder named coding-practice with a file about.py that prints your name on the first line and your city on the second line. Run it from the VS Code Run button and then from the terminal. If you cannot install anything yet, write the same program in the Try-it editor, and also write it in JavaScript.

Show solution
Python
print("Isha")
print("Lucknow")
Terminal
cd coding-practice
python about.py
JavaScript
console.log("Isha");
console.log("Lucknow");

The terminal must be inside coding-practice, the folder that contains about.py, otherwise Python reports that it cannot find the file.

Quick Quiz

1. Do you need to install anything to run this course's examples?

2. Which command checks the installed Python version?

3. What does Node.js let you do?

4. You see >>> and type python hello.py, and get an error. Why?

Learn Intro to Programming with a mentor

Free lessons get you started. Our Python Programming training adds real projects and code reviews from working developers.

  • Project-based learning
  • Mentor code reviews
  • Free counselling call