Hello World in Python
Many of you have probably heard of Python and wondered how to start programming in it. In this article, I will explain some basic Python concepts.
To begin, I will use the well-known “Hello World” program, which is the classic first program in all programming languages.

Before we start programming in Python, we need to install the required software.
To do this, just visit the Python website and download the application for your operating system.
If you use Linux/Unix, Python is usually pre-installed. Just open your terminal and type python
.
If you get an error, it means Python is not installed and you will need to follow the installation instructions for your system.
You can write Python programs in editors like Notepad++, but you won’t be able to run them unless Python is installed on your computer.
Now, let’s move on to the actual programming. Imagine you want the program to print something on the screen when executed. To do this, simply write the following in your program file:
print "Bom dia pessoal"
In the example above, there are two important things to note:
- print -> this command prints variables or text to the screen;
- “Good morning everyone” -> this is the string that will be printed; note that it must be enclosed in " “.
So far, Python is quite simple. Next, let’s make the code a bit more dynamic by reading user input. To do this, we use the following syntax:
nome = raw_input ("Qual é o seu nome?")
In this example, we declare a variable called “name”, which will store the value obtained from raw_input
.
The raw_input
function reads and stores the information that the user types in response to the prompt
(“What is your name?”).
Note that the variable name you use later must match the variable you initially declared. For example, if you say the variable x equals the raw input for question y, then question y must refer to x, otherwise the input will not be linked correctly.
Now let’s combine the two examples above to create a small script that asks for the user’s name and then prints a sentence including the entered name.
nome = raw_input ("Qual é o seu nome? : ")
print "Ola " + nome + " é um prazer conhece-lo."
You might wonder what the “+” signs do here — the “+” is a concatenation symbol that joins multiple strings to form a compound string. Also, note that in none of these examples do we explicitly declare variable types.