Sitemap
Dimterion

Dimterion

Hi. I’m Dmitrii. I'm interested in programming and new technologies and write about it every Friday.

Python Basics

4 min readNov 6, 2026

--

Title: Python Basics.

Let’s talk about the Python programming language, its initial setup, and basic commands and features.

Context: I was recently exploring some data analytics fundamentals through Google’s Data Analytics course and, when it reached the Python section, decided to write down some notes about it (as it’s my favorite way to learn). So, the answer to the obvious questions — like why bother learning something in the days of AI, or why write about something widely available everywhere — is simply that I like writing about the things I learn and how I approach them. And if you stumble upon this text and decide to read further, well, you may find something useful. Every little bit stacks, regardless of how you learned it. With disclaimers out of the way, let’s continue.

Setup

First, let’s set everything up to run some basic things in Python. I’m using VS Code on Windows, so these are the initial steps for that particular case.

If you used the famous JavaScript/HTML/CSS trio before, you probably have Node.js and Bash installed, but for Python you’ll need a couple of other things.

You can try to first create a Python file (for example, test.py) and open it in VS Code right away. It will suggest installing the Python extension, which lets you manage Python environments and packages, activate Python in the terminal, and also handles linting, running, and debugging the code.

You also need to install Python (can be downloaded from python.org). Without it, you may see a message “Select Python Interpreter” at the bottom of your code editor.

Get Dimterion’s stories in your inbox

Join Medium for free to get updates from this writer.

Once that is done, you can try running your file with a simple line of code like:

print("test")

To run it you can use a play button in the top-right corner of the editor (another option is to right-click anywhere in the editor and select Run Python). The result should appear in the terminal. The following terminal command should also run your file:

py test.py

Let’s now explore some Python basics.

Python Basics

Here are some basic actions in Python:

Note: The “#” sign is used for comments.

  • Print to the console.
# Print a string
print("Print this message to the console.")
# Output
# Print this message to the console.

# Print a number
print(8)
# Output
# 8
  • Simple math.
# Calculation
(5 + 10) / 3

# To show result
print((5 + 10) / 3)
# Output
# 5.0
  • Assign variables.
# Assign variables
title = "Python basics"
year = 2026

# Print variables to the console
print(title)
print(year)
# Output
# Python basics
# 2026
  • Evaluations (True or False).

Note: The double equals sign is used to check equality; the single equals sign is reserved for assignment statements.

# Evaluation
# 10 to the power of 2 equals 100 => true
10 ** 2 == 100
# 10 to the power of 3 equals 10000 => false
10 ** 3 == 10000

# Print evaluation results to the console
print(10 ** 2 == 100)
print(10 ** 3 == 10000)
# Output
# True
# False

# Cannot use a single equals sign
10 * 2 = 20
# Will result in a SyntaxError
# Correct syntax
# 10 multiplied by 2 equals 20 => true
10 * 2 == 20
print(10 * 2 == 20)
# Output
# True

year = 2026
next_year = year + 1
print(year == next_year)
# Output
# False
  • Conditional statements.
# Assigning a variable
age = 18

# Conditional statement
# Age is greater than or equal to 18
if age >= 18:
print("Adult")
else:
print("Minor")
# Output
# Adult
  • Loops.
# Creating a loop to print each number from a list divided by 2
for number in [2, 4, 6]:
print(number / 2)

# Output
# 1.0
# 2.0
# 3.0

# Another loop example
to_do_list = ["Exercise", "Hydrate", "Work"]

for task in to_do_list:
print(task)

# Output
# Exercise
# Hydrate
# Work
  • Functions (creating new ones from scratch and using built-in Python functions).
# Creating a function
def is_adult(age):
if age >= 18:
print("Adult")
else:
print("Minor")

# Calling the function
is_adult(10)
# Output
# Minor
is_adult(19)
# Output
# Adult

# Using Python's built-in function sorted()
unsorted_list = [2, 4, 3, 5, 1]
sorted_list = sorted(unsorted_list)

print(sorted_list)
# Output
# [1, 2, 3, 4, 5]

These were some of the basic operations in Python, including the initial setup, printing values to the console, defining variables, doing simple math, evaluations, and writing conditional statements, loops, and functions.

This was more of a comparison for those who already have some experience with other programming languages (like JavaScript), but hopefully it also explains some of the basic syntax and actions.

Thank you for reading.

--

--

Dimterion
Dimterion

Hi. I’m Dmitrii. I'm interested in programming and new technologies and write about it every Friday.