- Created "My 2023 Coding Edition" post detailing projects and experiences in Rust and game development. - Added "My 2024 and 2025 roadmap" outlining goals and projects for the upcoming years. - Introduced "Python Tutorial - Introduction" and "Python - Variables" posts to teach Python programming basics. - Published "ROADMAP for 2023" to outline initial goals for the year. - Added "My Rust little adventure" post summarizing various Rust projects undertaken. - Released "Spanish Inquisition - 3.0.1 UPDATE" detailing the latest game update and features. - Added multiple background images in AVIF format for website use. - Removed unused SVG files to clean up the public directory.
42 lines
1.6 KiB
Plaintext
42 lines
1.6 KiB
Plaintext
---
|
|
title: "Python Tutorial - Introduction"
|
|
description: "Introduction to Python programming language"
|
|
date: "2021-04-25"
|
|
---
|
|
|
|
# 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](https://www.python.org/) 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](https://code.visualstudio.com/) , 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.
|
|
|
|
```python
|
|
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 variable<sup>1</sup> 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.
|