Saturday, June 15, 2024

Learn Programming, Introduction to Python Programming Language

Probably all the visitors of our blog are wondering, what is this now; but you are C# programmers; why are you suddenly interested in the Python programming language? It seems that in the business world, knowing just one programming language has long been insufficient. If you look at the authors of many IT books, you will notice that they have knowledge of many programming languages. It all started with our interest in Visual Studio Code and .NET Core, but that awakened some pleasant memories of when we were involved in hacking and Linux operating systems. That's why we wiped the entire hard drive of our new laptop, which had Windows 10 Professional installed, and instead installed Kali Linux. Then, a whole new world of curiosity and new possibilities opened up to us.

Of course, this doesn't mean that we are abandoning the C# programming language; there is still much to learn and do on this blog, but it's time to turn to other programming languages as well. But why the Python programming language specifically? We will also deal with other programming languages; but we stumbled upon Python while looking for a language that is most commonly used on Linux operating systems. Then we discovered something we hadn't even dreamed of. The syntax and ease of learning the Python programming language, even compared to C#, is incredible.

A Professor Teaches a Student Python

A Professor Teaches a Student Python

The Python programming language is taught the most in many American as well as our schools, it is often declared the favorite programming language of the year, and it is used by many world companies like Facebook, Samsung, Google, YouTube, Yahoo, and others. With the Python programming language, you can easily automate many tasks, it is used for both desktop and Internet applications, and you can even program AI - Artificial Intelligence with it or use it together with other programming languages. Unlike the C# programming language, Python is a high-level interpreted language. This means it is not converted into machine code and therefore runs somewhat slower and does not hide your code.

However, there are tools that can compile your Python program into binaries and eliminate these drawbacks if necessary. The author of this language is Guido van Rossum from the Netherlands, who created it back in the late 80s. Python supports imperative and object-oriented programming styles and comes with an interpreter and a very developed standard library of modules. It supports almost all operating systems; it comes pre-installed on most Linux systems, so you can start programming in the terminal immediately, and the current version is 3.12.

There is a significant difference and incompatibility between versions 3.12 and 2.7, for example, so make sure to always have the latest 3.x version installed. To learn Python, you can use many programming environments as it is exceptionally well-supported, and you can write your programs in any text editor. The choice is entirely up to you. The name Python for this programming language does not come from the name of the snake, but from the Monty Python group, the actors of the British comedy series of the same name. That is why Python programmers are often called Pythonistas.

Setting Up the Environment: What Do You Need to Program in Python?

First of all, congratulations if you have made the decision to start learning the Python programming language. If you can, it would be best to use a Linux operating system; however, if you do not intend to deal with the Linux operating system, then installing the Python programming language for the Windows operating system is somewhat simpler. If you want to type in the Linux operating system; but you wonder who is going to change the entire operating system now; you can easily install a virtual machine. No matter what operating system you use, check which version of the Python programming language you have installed on your operating system. Then visit and check if there is a newer version out on the Python official site. If you have it, install it. Don't worry about anything breaking; you can simply have several different versions installed on your computer and the one you call will work. Watch the video on how to install the latest version of Python for the Windows operating system.

Windows - 5. How to install new version of Python? 

Or see how to install for the Linux operating system, e.g. in Ubuntu.

Linux - 6. How to install new version of Python?

Now that you are sure that you have the latest version of the Python programming language installed; you can switch to an IDE - Integrated Development Environment or some Text Editor. What you will use to learn the Python programming language is your choice. But if you ask us; the best recommendation is to use PyCharm Community. It's the free version. See in the video how it is installed.

Windows - 6. How to install PyCharm Community? 

If you use or intend to use the Linux operating system, then watch the following video.

Linux - 7. How to install PyCharm Community?

Can Developers Effectively Use VS or VSCode to Develop Python Applications?

For example, if you're a C# developer, it's understandable that you're tied to the Microsoft Visual Studio .Net programming environment. It's hard for us to even imagine someone else. But our desire for change and curiosity makes PyCharm and the Linux operating system a very interesting environment for Python programming. Of course, it's easiest to set up Python for the Microsoft Visual Studio .Net programming environment. Simply, open the Control Panel, then Programs and Features, right-click on Microsoft Visual Studio Community 2022; or whatever edition you own.

Click on the Change drop-down menu and start the Visual Studio Installer. In order for it to start, it will ask you to do an Update. Click the Update button; check Python development and on your right select the options you want to include in the Python programming language. Click the Modify button and wait for everything to install and you can use Microsoft Visual Studio .Net to program in the Python programming language. When creating Python applications, Microsoft Visual Studio .Net will provide you with many Python templates.

Installing Python in the Microsoft Visual Studio .Net Environment

Installing Python in the Microsoft Visual Studio .Net Environment

As for Visual Studio Code, the installation is a little different and depends on which operating system you are installing it on. After installation, it is necessary to click on the Extensions button on the left side of Visual Studio Code and install the Python extensions you want. Otherwise, VSCode is often used to develop Python applications. Watch the video on how to install Visual Studio Code.

Windows - 1. How to install Visual Studio Code & .Net Core?

Linux - 2. How to install Visual Studio Code and .NET Core?

How to start programming in Python: Our first program

If you have made a decision in which programming environment you will learn the Python programming language and if you have installed and configured everything you need for programming, we can begin. Note that we are using PyCharm and an Ubuntu distribution and we hope it will adapt to a different environment than yours, although we'd like you to use the same. Overall, the code is the same. You can immediately write and execute Python commands in the terminal or Command Prompt, for example: 

Microsoft Windows [Version 10.0.19045.2604]

(c) Microsoft Corporation. All rights reserved.



Python 3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.

>>> print("Hello World")

Hello World

>>> exit()



However, we want you to save your programs, so that you can always recall an example when you need it, or simply find this blog post when your examples are not at hand. So, create a new file with existence *.py and name it It is common practice when building Python programs to write the name of your program, the author, and the date you started the project. Sometimes developers also leave their email address in case the author needs to be contacted. That's why we start our program with a multi-line comment.


    Hello World
    Manuel Radovanovic


Of course, your first and last name should be here, especially pay attention to use the letters of the month in the date to avoid confusion. This date 08/05/18 could confuse the developers who will maintain your application after you because it is not known whether this is May 8, 2018 or August 5, 2018. You can often see that developers write dates more and more like this 2018-08-05. You can also view your file when it was created and by whom and what it is called in the terminal, as well as you can automate that this kind of comment is always printed by itself when creating each new *.py file. But there's really no need for that, just follow the practice. Write the following multi-line comment:


    This is multi-line comment
    Python developers use rarely it
    Python always ignore space and the comments


Based on this comment, you can conclude that multi-line comments are made with three quotes " " " and end with the same. In any case, Python ignores comments as well as all empty space between commands. You can also write one-line comments like this:

'You can use this for the one-line comment but I do not recommend to do it'


"You can use this for the one-line comment but I do not recommend to do it"

In any case, we don't recommend this because even though Python will ignore such a line, commenting in this way will definitely confuse programmers because they associate it with a string value. You might think, well, it's just a small, irrelevant program, but you need to learn discipline from the beginning because you can have big complications when you're dealing with thousands of lines of code. Acquiring great habits is a big proposition for success. This is the proper way to write a comment, and you'll see it most often:

# This is the most used way for the online comment

Now that you've learned how to write comments in the Python programming language, you can see how something is printed to the console or terminal. Type the following expression:

# Say hello to the world!

print('Hello World')
So, to print strings on the console or terminal, use the print command with brackets and semi quotes '. In earlier versions of the Python programming language, you didn't need small brackets, but now they are required. You can also use quotation marks to print strings to the console or terminal. You can run your program and see what the result looks like:

Hello World

You can also watch how this simple little program was created in the video.

Python - 1. How to start programming in Python?





No comments:

Post a Comment