Python Beginner's Guide: Installation and First Program | Episode - 3

Python Beginner's Guide: Installation and First Program

Python Beginner's Guide: Installation and First Program


How to Install Python

Most modern PCs and Macs come with Python pre-installed, but if you’re unsure, you can easily check by following these steps:

Read more about What is Python.

For Windows:

  1. Open the Command Prompt (cmd.exe).
  2. Type the following command and press Enter:
    C:\Users\Your Name>python --version

    This will show you the Python version installed on your system.

For macOS or Linux:

  1. Open the Terminal.
  2. Type this command and hit Enter:
    $ python --version

If Python is not installed on your computer, don't worry! You can download it for free from the official website: Python.org.

                                                                                OR

Download it from our official Website : Click Here to Download

During the installation, make sure to add PIP to path and install it with admin priveleges.

python setup screenshot latest


Python Quickstart: Your First Program

Python is an interpreted language, meaning you write Python code in a text file (with a .py extension), and then execute it through the Python interpreter.

Here’s how to run your Python file:

  1. Open the Command Prompt (Windows) or Terminal (macOS/Linux).
  2. Navigate to the folder where your Python file is saved.
  3. Type the following command:
    C:\Users\Your Name>python helloworld.py

Let’s write a simple Python program, Hello, World!, in a new file called helloworld.py. You can use any text editor (like Notepad, Sublime Text, or Visual Studio Code) to create this file.

Example: Hello, World! Program

  1. Open your text editor and type the following Python code:
  2. helloworld.py
    print("Hello, World!")
    
  3. Save the file as helloworld.py.

Running Your First Python Program

Now, go back to your Command Prompt or Terminal. Navigate to the folder where you saved helloworld.py. Then run:

C:\Users\Your Name>python helloworld.py

You should see the following output:

Hello, World!

Congratulations!

You’ve just written and executed your very first Python program. You're officially on your way to mastering Python programming. Keep practicing and exploring more Python features!

Post a Comment

0 Comments