Python Programming

Hello world

Easy
30 min

Welcome to the course!

Now we are learning to program. And you will notice that learning the secrets of mystical coding is surprisingly easy and fun.

Coding is fun!

Someone enjoys tinkering with web applications and cybersecurity tools. For example, Teo. Others like to create games. The third person manipulates data and builds artificial intelligence models. The fourth person writes firmware for amusement park rides, airplanes, or nuclear power plant reactors. The fifth person develops mobile applications. There is something fun to code for everyone.

Coding is empowering

Even if you don't end up coding for a living, programming as a hobby alone develops your problem-solving skills and perseverance.

There are jobs for coders

When you know how to create websites, it is relatively easy to find freelance jobs or apply for a position at a software company, for example.

Hardcore hackers code.

First and foremost, in the context of Hakateam, understanding code is important so that you can find vulnerabilities in the code and advise the client on fixing them. An experienced ethical hacker can be identified by the fact that they not only list the vulnerabilities they find for the client, but also know how to fix them and avoid them in the future.

Some coding is always needed from time to time in cybersecurity testing. Often you need to automate some little thing for which there is no ready-made tool. Python is the most popular programming language for this purpose, and that is why this course is done with Python, among other reasons.

How does this course work

Each module has a task that is automatically checked. When you complete a task, the red ball next to the task turns green and you can proceed to the next module.

You will complete the tasks with the browser-based VSCode development environment. You will likely use the same development environment yourself when you try out what you have learned on your own computer. If you want, you can download it right away from here. You don't yet need an installed version for the tasks at the Academy, but you can manage well with the browser-based editor.

How to solve tasks

You usually have a Python file called "app.py" ready and the task is to modify the code in a certain way. Don't forget to save the file when you are done (Ctrl + S / Command + S).

You can try your code by clicking on the "Play" button (triangle) in the top right corner.

When the code starts running, a terminal appears below the editor, where the output of the code is displayed. Once you are satisfied that the code is functioning correctly, the ball should also turn green in the task.

First Task

The task is to modify the given program so that it outputs the Finnish "Hei, maailma!" instead of the English "Hello, world!"

The program looks like this.

print "Hello World!")

Doesn't look very scary, huh? However, it is a fully functional program, try running it (click the "Play" button in the top right corner).

Let's dissect this first program, as there are already important matters in it.

  • print is a function. Functions are reusable code and Python comes with a default function called print, which takes text as a parameter and then prints it to the console. The function behaves differently depending on the parameters it is given.
  • In Python and many other programming languages, the syntax for a function call is the function name followed by parentheses, which contain the function's parameters. If the function does not take any parameters, empty parentheses are used. This is referred to as calling a function.
  • Text is in Python and again, in practice in almost all other programming languages, within curly brackets or quotation marks. So "Text" or 'text'. In this way, the Python interpreter (which executes the Python code you write) can distinguish between what is code and what is text.

The content of the code is: Call the function print, giving it one parameter, whose type is text and whose value is "Hello, world!".

Then just perform the task! And be careful to do the task precisely, otherwise the automatic inspector may not approve it.

Exercises

Mission

Change the code so that the English "Hello, world!" instead, the program prints "Hello, world!"

hakatemia pro

Ready to become an ethical hacker?
Start today.

As a member of Hakatemia you get unlimited access to Hakatemia modules, exercises and tools, and you get access to the Hakatemia Discord channel where you can ask for help from both instructors and other Hakatemia members.