Day 1: Setup & Introduction
Today’s focus is on getting your Python environment ready and running a simple “Hello, World!”
program.
Step 1: Install Python
1. Download Python:
o Visit the official Python downloads page.
o Download the latest stable release
2. Install Python:
o Run the installer.
o Important: On the first installation screen, check the box that says “Add Python to
PATH”. This ensures you can run Python from your terminal.
o Complete the installation process.
3. Verify Installation:
o Open your terminal (Command Prompt on Windows, Terminal on macOS/Linux).
o Type:
python --version
You should see the Python version printed.
o Optionally, launch the Python interactive shell by typing:
python
and then try entering a simple command like:
print("Hello, World!")
Exit the shell by typing exit() and pressing Enter.
Step 2: Set Up a Code Editor
1. Choose an Editor:
o Visual Studio Code (VS Code) is a popular choice.
o Download VS Code from its official website.
2. Install VS Code:
o Follow the installation instructions for your operating system.
o Once installed, open VS Code.
3. (Optional) Install the Python Extension:
o In VS Code, go to the Extensions view (you can press Ctrl+Shift+X or Cmd+Shift+X).
o Search for “Python” by Microsoft and install it. This extension provides features like
IntelliSense, debugging, and more.
Step 3: Write Your First Python Program
1. Create a New File:
o In VS Code (or your chosen editor), create a new file and save it as hello.py.
2. Write Code:
o Type the following code into hello.py:
o print("Hello, World!")
3. Run Your Program:
o Using the Terminal:
▪ Open the terminal in VS Code (View > Terminal).
▪ Navigate to the directory where hello.py is saved.
▪ Run:
python hello.py
▪ You should see the output:
Hello, World!
o Using VS Code’s Run Feature:
▪ With the Python extension installed, you might see a “Run” button at the top
right of the editor. Click it to execute your script.
Step 4: Explore the Python Interactive Shell
1. Launch the REPL:
o Open your terminal and type:
o python
This opens the Python interactive shell.
2. Experiment:
o Try simple commands such as:
2+2
o name = "Python Learner"
print("Welcome,", name)
o Practice a few basic commands to get comfortable with the shell.
3. Exit the Shell:
o Type:
exit()
and press Enter.
Official Python Getting Started Guide:
o Check out the official Python tutorial, focusing on the initial sections to familiarize
yourself with Python’s philosophy and usage.