Python Programming Language: Your First Steps

Naweed Ahmadi
6 min readMay 24, 2021

--

Python is an easy to learn programming language created by Guido Van Rossum in 1989 and released in 1991. There are plenty of ways to learn Python, and once you learn, there’s a lot you can do with it. The goal of this article is to help you setup your development environment and to write your first Python program.

If you’re more of a visual learner, check out my YouTube tutorial for this!

Why Learn Python Programming?

There are many reasons to learn Python, but in this article, we will discuss four major reasons.

1. Python is easy to read, write, and learn

The Python programming language has an easy to learn structure comparing to other object-oriented programming languages like C, Java, and PHP. For example, if you refer to below code blocks, you can see the amount of code required for different programming languages to print a simple string or a single line of text. If you have to print “Python is easy to learn.”, you have to write three lines of code in Java or four lines of code in C language whereas in Python, just one line is sufficient to print “Python is easy to learn.” Considering this example, it means in Python you don’t have to deal with complex syntax, and this could help anyone to learn coding in Python in a couple of hours or days.

2. Python is a general-purpose language

Just to name a few of its most common uses, Python is used in machine learning, internet of things, data science, web development, game development, network programming, mobile apps, artificial intelligence, business application, and the list goes on. Python is a cross-platform language, a Python program written on a Linux system will run on a Mac computer and vice versa. Python has a huge number of tools and libraries that address a large number of programming scenarios.

3. Python is free and has a supportive community

Python is completely free, even for commercial use. Its open source, where anyone can contribute to its development. It has an active and supportive community backed by the countless Python conferences, online groups, chat rooms, and GitHub projects that give Python developers a place to connect with others.

4. Python developers are in demand

According to TIOBE Index for May 2021, Python is ranked as the world’s 2nd most popular programming language among professional software developers. According to Indeed.com, an American employment website for job listings, the average Python programmer salary in the United States is over $110,000 per year, which makes Python the second best-paid programming language.

I hope you have acquired some information about Python Applications and what sets Python apart from other programming languages.

Python and PyCharm Installation

Python programs can run on a Windows computer, if the Windows machine has the Python interpreter installed (most other operating systems, such as Mac and Linux, come with Python pre-installed). To install Python on a Windows system, visit Python website, download the latest version on your machines, and run the installer.

After Installation, to make sure that Python is properly installed and configured on your computer, open a terminal Window and type Python or PY. And refer to below image you can see that this machine is using Python 3.9.5, you should also get a result that looks like this.

PyCharm IDE (Integrated Development Environment) is one of the most widely used IDEs for Python programming. To install PyCharm IDE on your machine, visit PyCharm website, click the download button and it will redirect you to a separate download page where you will notice two download buttons, one for professional version and one for community version which is free and open source. If you’re just beginning to write your first Python program, I suggest that you download the PyCharm community version and run the installer.

Writing Your First Python Program

An initial skill you need to learn as a Python developer is to setup your development environment and be able to run Python scripts and code. Here you will learn to run your Python scripts both via terminal and an IDE.

1. The command-line or Terminal

To run Python scripts via command-line or terminal, you need to open a command-line and type in the word python, or python3 if you’re on a Mac or Linux. When you run code in terminal, every statement you type in is evaluated and executed immediately, just like this:

In command-line or terminal you can write many lines of code, but once you close the terminal, you lose everything you’ve written. That’s why developers use plain text files with .py extension for writing Python programs.

2. The IDE or Text Editor

When developing larger or more complex applications, it is recommended that you use an IDE or an advanced text editor. Python code files can be created with any plain text editor. If you are new to Python programming, you can try PyCharm IDE, which is a powerful and easy-to-use, but you can use any IDE or editor you like.

Creating First Program

Step 1) Open PyCharm IDE. You can see the introductory window for PyCharm. To create a new project, click on “New Project”.

Step 2) You can select the location where you want the project to be created or change the project name. If you don’t want to change the location or name of the project than keep it as it is, and Click the “Create” Button.

Step 3) Now right click on “Project” and select “New”. Next, select “Python File”. A new pop up will appear, type the name of the file you want and hit “OK”.

Step 4) Now type a simple program and go up to the “Run” menu and select “Run” to run your program.

Step 5) You can see the output of your program at the bottom of the screen.

I hope you enjoyed reading this article and found it informative. By now, you must have acquired a sound understanding of how to setup your development environment and how to write your first Python program.

--

--

Naweed Ahmadi
Naweed Ahmadi

Written by Naweed Ahmadi

Self-motivated and extremely proactive IT Professional with over 10 years of experience in the IT industry.

No responses yet