1Lesson 1 of 5

Python Setup & Your First Programs

Get started with Python by setting up your development environment and writing your first lines of code.

Welcome to your first Python lesson! In this lesson, you will install Python, set up your coding environment, and write your very first Python programs. By the end, you will be comfortable running Python code and understanding the basics of how programs work.

Installing Python

Python can be downloaded for free from python.org. We recommend downloading the latest stable version (Python 3.12 or higher). During installation on Windows, make sure to check 'Add Python to PATH' - this makes it easy to run Python from anywhere on your computer.

Choosing a Code Editor

While you can write Python in any text editor, we recommend Visual Studio Code (VS Code) for beginners. It's free, powerful, and has excellent Python support. Install the Python extension in VS Code to get features like syntax highlighting, code completion, and debugging.

Your First Python Program

The traditional first program in any language is 'Hello, World!'. In Python, this is incredibly simple. Create a file called hello.py and write: print('Hello, World!'). Run it from your terminal with python hello.py and you should see the message displayed.

Understanding print()

The print() function is one of the most used functions in Python. It displays text or values on the screen. You can print strings (text in quotes), numbers, or even the results of calculations. For example: print(2 + 2) will display 4.

Key Takeaways

  • Python is installed and ready to use on your computer
  • You have a code editor set up for Python development
  • You can write and run basic Python programs
  • You understand how to use the print() function