Python Fundamentals

Starting the Python REPL

Python Fundamentals

Check out a free preview of the full Python Fundamentals course

The "Starting the Python REPL" Lesson is part of the full, Python Fundamentals course featured in this preview video. Here's what you'd learn in this lesson:

Nina demonstrates how to start Python's read evaluate print loop.


Transcript from the "Starting the Python REPL" Lesson

>> Nina Zakharenko: So once you have the Python extension, a really nice thing that VS Code does is, it automatically selects the correct interpreter. And you'll see that in the blue bar, here at the bottom. It'll say the correct version of Python that we're using, which is Python 3.7.2, and our virtual environment, venv.

If you get a pop-up that says your linter, pylint, is not installed, go ahead and install that now.
>> Nina Zakharenko: Now, the REPL, which stands for the read-evaluate-print loop, this is gonna be how we're interacting with Python for most of the day. It allows us to interact with the Python interpreter, so I'm just running a file in the, containing Python code.

The REPL allows you to type in commands, and instantly see the output printed out. For those of you who use JavaScript, you've probably seen a REPL already, right, you're familiar with the concept. You can also use the REPL to print out help and look at variables, list out what methods are available, etc.

So to open up the REPL, all you need to do is type python in here, and then select Start REPL, yes?
>> Student: What is a REPL?
>> Nina Zakharenko: It's a read-evaluate-print loop, so it allows us to type Python instructions into it, and instantly see the results. It will make more sense in a second, once we open it up.

Okay, does everyone see the Start REPL?
>> Nina Zakharenko: Someone asked, why do we use virtual environments? They'll make a little bit more sense when we start working with external libraries. They're basically a self-contained Python installation of the Python version in the libraries. So once you start working on bigger projects, you'll want to have a virtual environment per project.

But for the time being, it's just an easy way for the instructions for Windows and for Mac to be the same, so that we're typing in the same things.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now