THE PYTHON LANGUAGE

THE PYTHON LANGUAGE INTRODUCTION

INTRODUCTION Before addressing the topic "The Python language introduction" let's make a brief description of what the language is. Python is a multi-paradigm language that has among its main objectives: dynamism, simplicity and flexibility. It supports the object oriented paradigm, structured programming, and many functional and reflection programming features. The most immediately recognizable features of Python are the untyped variables and the use of indentation for specification syntax, in place of the more common parentheses. Other distinctive features are the overloading of operators and functions through delegates, the presence of a rich assortment of basic types and functions and [...]

By |2022-10-24T15:30:20+02:0025 September 2021|0 Comments

PYTHON RUNTIME ENVIRONMENT

INTRODUCTION Before talking about the topic " Python runtime environment " let's make a very brief introduction. Let's see in this article how the runtime manages the execution of programs. Let's take a closer look at how Python executes programs through its runtime. This will be useful to us as we continue the course. Let's first ask ourselves if Python is a compiled, interpreted language or is it also based like C# and Java on Virtual Machine? COMPILED LANGUAGES PYTHON RUNTIME ENVIRONMENT - INTERPRETED LANGUAGES PYHTON RUNTIME ENVIRONMENT - LANGUAGES THAT USE BYTECODE [...]

By |2024-08-09T16:06:27+02:0028 September 2021|0 Comments

VARIABLES AND ATTRIBUTES IN PYTHON

OBJECTS IN PYTHON Let's start by talking about the topic "Objects variables and attributes in Python". The most important concept to learn to understand the architecture of the entire Python programming language is that in this language everything is an object. The programs that we for example write in the schell as a series of instructions are also objects. It is essential to understand that Python assigns to all these entities, when the program is executed, data structures that are called objects. Objects in Python as already mentioned are data structures that at least contain: An identifier assigned by [...]

By |2024-08-09T19:33:12+02:001 October 2021|0 Comments

BASIC DATA TYPES IN PYTHON

TYPES OF DATA IN PYTHON NUMERICAL TYPES Let's start talking about Basic Data Types in Python by introducing the numeric types which are divided into: Integer Floating-Point Boolean It is important to know that all numeric types in Python are immutable, once a number is created and therefore an object it cannot change. For example, I can create a variable a that first points to an object worth 3 then to an object worth 4. What you can't do is change the value of the object, the number 3 is always the number 3. type=int int is the integer [...]

By |2022-10-18T18:23:30+02:008 October 2021|0 Comments

THE LISTS IN PYTHON

DATA STRUCTURES Before talking about the topic Lists in Python let's make a brief introduction to the data structures in Python which are composed of: Lists Tuple Dictionaries Set They allow you to keep not a single value as in Basic Data Types but a set of values called elements. Lists and tuples can contain elements of any type. Lists are mutable Tuples are immutable For example, a list can contain different elements, integers, strings, other lists. However, it is better to avoid non-heterogeneous elements, this to improve the readability of the program. The lists are [...]

By |2021-11-17T10:33:59+01:0012 October 2021|0 Comments

TUPLE, DICTIONARIES AND SETS IN PYTHON

THE TUPLE Let's start talking about the topic "Tuple dictionaries and sets in Python". We have four types of objects, tuples and lists which are simple assorted items, dictionaries which are key-value pairs, and sets which resemble the classic sets we know from mathematics. Let's see them in detail. type = tuple Tuples are a sequence like lists, but unlike lists, a tuple is immutable. This means that once the values that may be heterogeneous have been entered and initialized, they are no longer editable. All tuples are instances of a predefined type which is called a tuple. From [...]

By |2024-08-10T14:22:57+02:0015 October 2021|0 Comments

CONDITIONAL STRUCTURES, CYCLES AND RANGE IN PYTHON

CODE STRUCTURES LINES OF CODE Before we talk about "loop and range conditional structures in Python", let's look at code structures. The physical line is the line of code we write. The logical line is the one that Python assembles from a certain number of physical lines and then generates a single instruction. Let's see an example. The simple program shown here makes use of two lines of code and a comment that is not part of them. When Python runs the program it transforms the two lines of code into two [...]

By |2022-10-24T15:41:20+02:0017 October 2021|0 Comments

THE FUNCTIONS IN PYTHON

Before analyzing the functions in Python let's talk about another important aspect of the language, namely the List Comprehensions, the Dict Comprehensions and the Set Comprehensions. LIST COMPREHENSION It is a mechanism that starting from a list or any iterable object produces another in a single instruction by performing sophisticated processing starting from the source list. The central part of this statement should be familiar, it is a for in loop that iterates through the collection placed in iterable and each extracted element places it in the variable item. To the right appears a conditional structure if [...]

By |2024-08-11T02:57:10+02:0021 October 2021|0 Comments

FUNCTION OBJECTS AND NAMESPACE IN PYTHON

USE OBJECTS FUNCTION Before addressing the topic "Namespaces in Python" let's have a few more thoughts on functions. If we use the round brackets after the function it means that we are calling the function, if we use only the name of the function in the program it means that we are referring to the function as an object whose instance belongs to the function class. This means that functions are objects and are instances of the function class. Let's see what the main features are in using functions as objects. Nested functions Let's [...]

By |2024-08-11T05:10:55+02:0023 October 2021|0 Comments

CLASSES IN PYTHON

CLASSES AND INSTANCES Class objects generally provide the default behavior, they contain a series of attributes which are then data and functions that in the OOP context are called methods. The instances are created, instantiated, starting from the classes and carry out the activities within the programs that we write in Python. THE STATEMENT CLASS The class statement is a compound statement that serves to define and create a class object by assigning a name to it. When Python finds the keyword class within a source, which obviously has a header and a suite of instructions, it executes it [...]

By |2024-08-12T01:55:35+02:0024 October 2021|0 Comments
Go to Top