Learning a new language: Python

It is very rare for developers to learn and use only one language. Depending on the task, one language might be more suited than another. In this post, I share what I learned while learning the python language, which is popular in machine learning.

What is python?

Python is a high-level programming language, meaning that it is closer to natural languages than zeroes and ones. It is an interpreted language, thus it is not compiled for execution and the code can be seen.

Python actually emphasizes on code readability, thus it has some features that I have yet to find in another language..

How is python different?

As mentioned above, python has some features which improves its readability.

One of the most notable aspects of python is that indentation is part of the syntax.

There is no need to use semicolon (;) or curly bracket ({ and }). To write another statement, simply change to the next line. And if you want a block of statements, just use the same indentation for the statements.

This makes python easier for new programmers but might be quite strange to whose who are used to other languages.

Hello World in python

One of the first programs that a person builds when learning a new language is the Hello World program. It consists of using the language’s print function to print the phrase “Hello World” to the screen.

In python, the print function is simply print. Thus the code is as follows:

As I am using python 3, I need to use brackets, this was not the case in previous versions of python.

Console input in python

To enable interaction with the program, the user must be able to input values. Console applications typically prompts the user for an input and accepts the string typed by the user.

In python, user input is handle using input. Thus the code is as follows:

This code will assign the next string entered by the user to str1. However, the user might not know that they need to input a value. That will have to have done using a separate print function.

This code will assign the next string entered by the user to str2. By using this approach, the user will be prompt with “Value: ” and thus they will know that they have to input a value.


I think that Python is a very interesting language, not only because of its syntax but also because of how simpler things are. I was amazed when I noticed that the prompt text could be passed as an argument to a simple input function. This task is more complex in other languages, for example java.