> For the complete documentation index, see [llms.txt](https://sh20raj.gitbook.io/python-extra/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sh20raj.gitbook.io/python-extra/python-getting-started.md).

# Python Getting Started

### Python Installation

Most modern PCs and Macs come with Python pre-installed. To verify if Python is already installed on your system, follow these steps:

#### On Windows:

1. Open the start menu.
2. Search for "Python."
3. In the Command Line (cmd.exe), run the following command:

   ```shell
   C:\Users\Your Name>python --version
   ```

#### On Linux or Mac:

1. Open the command line (Terminal for Mac).
2. Run the following command:

   ```shell
   python --version
   ```

If you discover that Python is not installed on your computer, you can easily obtain it for free from the official website: [Python.org](http://Python.org).

### Python Quickstart

Python is an interpreted programming language, which means that you create Python (.py) files using a text editor and then execute these files in the Python interpreter.

To run a Python file from the command line, use the following syntax:

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

In this example, "[helloworld.py](http://helloworld.py)" is the name of your Python file.

Let's create our first Python file, named "[helloworld.py](http://helloworld.py)." You can use any text editor to do this.

[**helloworld.py**](http://helloworld.py)

```python
print("Hello, World!")
```

It's as simple as that. Save your file, open your command line, navigate to the directory where you saved the file, and execute the following command:

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

The output should display:

```plaintext
Hello, World!
```

Congratulations, you've successfully written and executed your first Python program!

### The Python Command Line

Sometimes, when testing a small piece of Python code, it's quicker and easier to run it directly from the command line. Python allows you to do this by opening an interactive Python session.

To start the Python command line, enter the following on the Windows, Mac, or Linux command line:

```shell
C:\Users\Your Name>python
```

If the "python" command doesn't work, you can try "py" instead:

```shell
C:\Users\Your Name>py
```

From the Python command line, you can run Python code interactively, as shown earlier with our "Hello, World!" example:

```shell
C:\Users\Your Name>python
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright," "credits," or "license" for more information.
>>> print("Hello, World!")
```

This will display "Hello, World!" in the command line.

To exit the Python command line interface when you're done, simply type:

```shell
exit()
```

With this knowledge, you're ready to embark on your Python programming journey. Happy coding!
