Blog Posts
-
Deepening Your Knowledge by Reimplementing Existing Functions and Methods
dr. Dobreff Csaba 19th aug 2026Just as developing real proficiency in a natural language requires regular active practice, the same is true when learning a programming language. It is not enough to read about the...
-
How to Replace Specified Characters in a String
dr. Dobreff Csaba 7th aug 2026There are several ways to solve this problem. The first approach that may come to mind is to iterate over the characters in the string one by one and check...
-
How to Remove Multiple Consecutive Spaces from a String
dr. Dobreff Csaba 22nd júl 2026Sometimes a string contains multiple consecutive spaces, which may be undesirable for further processing. Our goal is therefore to transform the string so that every sequence of two or more...
-
Battleship Game
dr. Dobreff Csaba 3rd júl 2026Battleship is one of the best-known board games and has long been adapted into numerous digital versions that let players compete against a computer-controlled opponent. This article presents a Python...
-
Checking Brackets Without if–elif
dr. Dobreff Csaba 24th jún 2026Let’s write a function that checks whether, in a given text, every opening parenthesis has a matching closing parenthesis, and whether no closing parenthesis appears before its corresponding opening parenthesis....
-
Why Is It Useful for Objects to Have a Truth Value?
dr. Dobreff Csaba 12th jún 2026In Python, every object has a logical truth value. This means that any object can be evaluated in a Boolean context. You can directly check an object’s truth value (also...
-
How to Prevent Naming Collisions When Inheriting Classes?
dr. Dobreff Csaba 29th máj 2026Let’s assume that we have a prebuilt, imported class named Account that models a bank account. We know only its documentation and public attributes, but we do not know anything...
-
How Can We Reduce Execution Time by Using Additional Memory?
dr. Dobreff Csaba 13th máj 2026Suppose our program needs to perform an operation that significantly increases execution time, and moreover, this operation must be performed repeatedly. If the operation is deterministic — meaning that for...
-
Why are the statements in a class body executed before any instances of the class are created?
dr. Dobreff Csaba 5th máj 2026Objects bundle together logically related data (which describe the state of the object) and callable objects that operate on that data, namely methods. This is known as “encapsulation”. For objects...
-
Can multiple closure functions access the same enclosed local variable?
dr. Dobreff Csaba 24th ápr 2026The short answer is yes. The real question is how. The reason why this topic is interesting is that when we talk about closures, we usually think of a single...