Getting Started With Python

October 10, 2024 | By Shifanth Jasim

Python is one of the best and most popular programming languages in the world. It’s very easy to learn and widely used in many different fields, making it a top choice for both beginners and professionals.

Python is well-known for web development, data science, and automation. It’s also extensively used in Artificial Intelligence (AI) development! Its simplicity, vast library ecosystem, and strong community support make it the go-to language for many projects.

In this guide, I’ll take you through the basics of Python, covering everything from installation to writing your first lines of code, so you can get started with ease.

Blog Image

Why should you learn Python?

Before we dive into the coding part, let's take a moment to talk about why Python is one of the best languages out there.

  • Easy to Learn: Python's syntax is simple and intuitive, making it beginner-friendly.
  • Strong and Active Community Network: Python has a very active community that provides tutorials, resources, and support.
  • Dynamic Typing: Python uses dynamic typing, which means variables can change type, allowing for greater flexibility in coding.
  • Supports Multiple Programming Paradigms: Python supports object-oriented, procedural, and functional programming, making it versatile for different coding styles.
  • Great for Data Analysis: Python is widely used in data science and analysis, thanks to libraries like Pandas and NumPy.
  • Rich Ecosystem of Frameworks: Popular frameworks like Django and Flask make web development faster and easier with Python.
  • Strong Integration Capabilities: Python can easily integrate with other languages and technologies, enhancing its usability in various projects.

Installing Python

Step 1: Downloading Python

Download and install Python from the official website (https://www.python.org)

Click on the "Downloads" tab

The site will recommend the best version for your OS

Step 2: Install Python
For Windows:

Run the downloaded installer

"IMPORTANT:" Check the box that says "Add Python to PATH"

Follow the on-screen instructions

To verify the installation, open cmd (Command Prompt)

To check the Python version, use python --version or python3 --version

If everything is good, the Command Prompt will display the version that you installed

Writing Your First Python Code

Now for the exciting part: writing your first Python program!

Open up your text editor. It can be simple like Notepad, or you can use VS Code (Visual Studio Code), which is my favorite.

Type the following code:

print("Hello, World")

Save the file with a .py extension. For example, save it as hello.py

Open up your cmd (Command Prompt) or terminal, depending on what OS you're using, and navigate to the folder where you saved the file.

Here's a quick example of how to navigate to your file from the terminal or Command Prompt, assuming you saved the file in the Documents folder:

Windows: cd D:\users\yourUsername\Documents
Mac/Linux: cd ~/Documents

Now that you have successfully navigated to your folder, type the following code to run your program:

python hello.py. If the first command doesn't work, try python3 hello.py instead.

This should execute your Python script, and you will see the output in the terminal or Command Prompt. Congratulations! You have successfully installed Python and run your first Python program. Now that you know how to print a line using Python, play around with it and get a feel for the language. There are tons of resources and tutorials online, so use them to learn more about Python. Remember, the key to success is consistency. Keep practicing and try to build apps and programs that interest you.