<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Python Programming on Antonio Montemurro</title><link>https://antoniomontemurro.com/en/tags/python-programming/</link><description>Recent content in Python Programming on Antonio Montemurro</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Sat, 26 Jul 2025 11:22:11 +0000</lastBuildDate><atom:link href="https://antoniomontemurro.com/en/tags/python-programming/index.xml" rel="self" type="application/rss+xml"/><item><title>Detecting and Counting People with YOLOv8</title><link>https://antoniomontemurro.com/en/posts/yolo-opencv-python-count-people/</link><pubDate>Sat, 26 Jul 2025 11:22:11 +0000</pubDate><guid>https://antoniomontemurro.com/en/posts/yolo-opencv-python-count-people/</guid><description>&lt;p&gt;In this article, you’ll discover what YOLO is and how to use it to analyze a video and detect and count people within it.&lt;br&gt;
We’ll walk through a simple Python script that lets you configure basic parameters and choose the most appropriate video source for your needs.&lt;/p&gt;
&lt;h3 id="what-is-yolo"&gt;What is YOLO?&lt;/h3&gt;
&lt;p&gt;YOLO (You Only Look Once) is a &lt;strong&gt;real-time object detection&lt;/strong&gt; algorithm based on neural networks.&lt;br&gt;
Put simply, YOLO analyzes each video frame (whether from a file or a webcam/IP stream) to identify objects such as people, vehicles, animals, and more.&lt;/p&gt;</description></item><item><title>Function Definition in Python</title><link>https://antoniomontemurro.com/en/posts/function-in-python/</link><pubDate>Sun, 20 Jul 2025 08:46:08 +0000</pubDate><guid>https://antoniomontemurro.com/en/posts/function-in-python/</guid><description>&lt;p&gt;In all programming languages, one of the most important aspects is code organization and readability. In Python, as in many other languages, this goal is also achieved through the use of &lt;strong&gt;functions&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;By convention, all the code we write is executed within a main function, often called &lt;code&gt;main&lt;/code&gt;. However, we can—and should—split our code into multiple functions to simplify maintenance and encourage reuse.&lt;/p&gt;
&lt;h2 id="what-are-functions-in-python"&gt;What are functions in Python?&lt;/h2&gt;
&lt;p&gt;The function definition in Python is done using the def keyword, followed by the function name and parentheses. There are two main types of functions:&lt;/p&gt;</description></item><item><title>Control Flow and Loops in Python</title><link>https://antoniomontemurro.com/en/posts/control-flow-loops-python/</link><pubDate>Fri, 27 Dec 2024 12:30:51 +0000</pubDate><guid>https://antoniomontemurro.com/en/posts/control-flow-loops-python/</guid><description>&lt;p&gt;In all modern programming languages, conditional statements and loops are essential for two primary purposes:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Making decisions based on given or computed values.&lt;/li&gt;
&lt;li&gt;Automating repetitive tasks to avoid rewriting the same code.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="ifelse"&gt;&lt;strong&gt;If…else&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;if...else&lt;/code&gt; statement allows you to change the normal flow of code execution by evaluating a specific condition.&lt;/p&gt;
&lt;p&gt;Here is an example&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-wp-block-code" data-lang="wp-block-code"&gt;x = int(input(&amp;#34;Insert a number:&amp;#34;))
if x % 2 == 0:
print(&amp;#34;Your number is even&amp;#34;)
else:
print(&amp;#34;Your number is odd&amp;#34;)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This code will print a different message depending on whether the value entered by the user is an even or an odd number.&lt;/p&gt;</description></item><item><title>Operators in Python: Arithmetic, Comparison, and Logical</title><link>https://antoniomontemurro.com/en/posts/operators-python-arithmetic-comparison-logical/</link><pubDate>Sat, 26 Oct 2024 09:38:49 +0000</pubDate><guid>https://antoniomontemurro.com/en/posts/operators-python-arithmetic-comparison-logical/</guid><description>&lt;p&gt;In Python, as in every programming language, there are various operators for manipulating numbers, logical values, and comparing objects.&lt;/p&gt;
&lt;h2 id="arithmetic-operators"&gt;Arithmetic Operators&lt;/h2&gt;
&lt;p&gt;The most familiar ones are the mathematical operators.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-wp-block-code" data-lang="wp-block-code"&gt;Sum: +
Subtraction: -
Multiplication: *
Division: / or //
Exponentiation: **
Modulus: %
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Let’s see an example for each operator:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-wp-block-code" data-lang="wp-block-code"&gt;print(10 + 3) # Addition: 13
print(10 - 3) # Subtraction: 7
print(10 * 3) # Multiplication: 30
print(10 / 3) # Division: 3.3333...
print(10 // 3) # Floor Division: 3
print(10 ** 3) # Exponentiation: 1000
print(10 % 3) # Modulus: 1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Of these, the one worth a quick note is the &lt;code&gt;//&lt;/code&gt; operator, also known as “Floor Division.” This operator simply rounds down the division result to the nearest integer.&lt;/p&gt;</description></item><item><title>Python – Data Types</title><link>https://antoniomontemurro.com/en/posts/data-types/</link><pubDate>Sun, 29 Sep 2024 09:10:05 +0000</pubDate><guid>https://antoniomontemurro.com/en/posts/data-types/</guid><description>&lt;p&gt;As mentioned in &lt;a href="https://antoniomontemurro.com/en/posts/python-basic-syntax/"&gt;this article&lt;/a&gt;, Python is a dynamically-typed language, meaning the type of a variable is determined during program execution and cannot be changed afterward. However, this does not mean that there are no distinctions between the various variable types.&lt;/p&gt;
&lt;p&gt;Let’s take a look at the data types natively present in Python:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Strings&lt;/strong&gt;: &lt;code&gt;str&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Numbers&lt;/strong&gt;: &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;float&lt;/code&gt;, &lt;code&gt;complex&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sequences&lt;/strong&gt;: &lt;code&gt;list&lt;/code&gt;, &lt;code&gt;tuple&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mappings&lt;/strong&gt;: &lt;code&gt;dict&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sets&lt;/strong&gt;: &lt;code&gt;set&lt;/code&gt;, &lt;code&gt;frozenset&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Boolean&lt;/strong&gt;: &lt;code&gt;bool&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Binary&lt;/strong&gt;: &lt;code&gt;bytes&lt;/code&gt;, &lt;code&gt;bytearray&lt;/code&gt;, &lt;code&gt;memoryview&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In Python, it is not necessary to specify the type of a variable when declaring it. This allows a variable to hold any of the types listed above. Moreover, dynamic typing means that a variable’s type can change at any time during code execution.&lt;/p&gt;</description></item><item><title>Python – Basic Syntax</title><link>https://antoniomontemurro.com/en/posts/python-basic-syntax/</link><pubDate>Sat, 14 Sep 2024 09:28:24 +0000</pubDate><guid>https://antoniomontemurro.com/en/posts/python-basic-syntax/</guid><description>&lt;h2 id="indentation"&gt;&lt;strong&gt;Indentation&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;In Python, code blocks are identified through the use of indentation. Indentation involves leaving a specific number of spaces before starting to write code. As the number of spaces changes, so does the block to which the code belongs.&lt;/p&gt;
&lt;p&gt;&lt;img alt="comments.jpg" loading="lazy" src="https://antoniomontemurro.com/img/python-basic-syntax/comments.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Python doesn’t enforce a fixed number of spaces, but it does require consistency in your choice: once you decide on a certain number of spaces for indentation, you must maintain that throughout the file.&lt;/p&gt;</description></item><item><title>Python Setup and Choosing an IDE</title><link>https://antoniomontemurro.com/en/posts/python-setup-and-choosing-an-ide/</link><pubDate>Mon, 09 Sep 2024 10:00:00 +0000</pubDate><guid>https://antoniomontemurro.com/en/posts/python-setup-and-choosing-an-ide/</guid><description>&lt;p&gt;If you’re reading this article, it’s probably your first experience with Python and, in general, with programming. In this article, we’ll go over how to install Python, choose an IDE, and write a simple program to make sure everything is working correctly.&lt;/p&gt;
&lt;p&gt;After &lt;a href="https://antoniomontemurro.com/en/posts/why-learn-python/"&gt;discussing why Python can be a great choice&lt;/a&gt; for both beginners and experienced programmers, let’s now look at how to set up Python and choose the right IDE.&lt;/p&gt;</description></item><item><title>Python: What it is and Why Use it</title><link>https://antoniomontemurro.com/en/posts/why-learn-python/</link><pubDate>Sat, 07 Sep 2024 11:30:38 +0000</pubDate><guid>https://antoniomontemurro.com/en/posts/why-learn-python/</guid><description>&lt;p&gt;&lt;img alt="Logo-della-Python-1024x576.png" loading="lazy" src="https://antoniomontemurro.com/img/why-learn-python/Logo-della-Python-1024x576.png"&gt;&lt;/p&gt;
&lt;p&gt;Python is a high-level programming language, created by mathematician and computer scientist Guido Van Rossum in 1991. According to Van Rossum, Python was designed to be simple, easy to understand, and easy for anyone to learn.&lt;/p&gt;
&lt;p&gt;These aspects have allowed Python to become one of the most popular programming languages in the world, especially thanks to its applications in modern fields like artificial intelligence.&lt;/p&gt;
&lt;h2 id="advantages-and-features"&gt;&lt;strong&gt;Advantages and Features&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;The main features of Python are:&lt;/p&gt;</description></item></channel></rss>