Python Tutorial - Introduction
Your first program!
Hello, today I’ll teach you how to code! Seems interesting, doesn’t it? Okay, let’s start.
Set up
Firstly you’ll need to install Python. You can do so by clicking this link which will redirect you to the Python official website. Having installed this, you can download and install any code editor you’d like. I prefer Visual Studio Code , so I’ll go with it. Now, we can finally start writing our first program!
Writing code
Create a new file and name it hello.py
and open it with your editor of choice. Now write this piece of code.
print('Hello world')
Running code
To run code, simply type in Terminal/Console python hello.py
Explanation
Okay, so what does this code exactly do? Well, it prints text into the console or some other output device. In our case, the text is Hello world . But why is the text in double-quotes? It is this way because otherwise, Python wouldn’t know what does it mean. Is it a text or a variable1 or something else. What would happen if we changed the text into something different, let’s say Hello, Darrien! I’ll give you a moment to think about it.
…
Well, yes you’ve guessed it. It would print out Hello, Darien!
to the console.
Homework
Write a program that will greet your family members.
1 - Don’t worry if you didn’t understand what I meant, I’ll explain it, in the next tutorial.