Data Types - Coding Basics #10 [EN/ES]

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@jesalmofficial·
0.000 HBD
Data Types - Coding Basics #10 [EN/ES]
<div class="text-justify">

<center><h1>string article = "Press Upvote"</h1></center>

<center>
![Basic-Data-Types-in-Python_Watermarked.webp](https://files.peakd.com/file/peakd-hive/jesalmofficial/23xL9AWXKFCVqxZNForc6ZfWQvyMNDGevWtCGGmitbkyFXamQSPGDCef5fNAoXXJ3AHwE.webp)
<br>[Shoutout to Real Python](https://realpython.com/python-data-types/)</center>

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

<center><h3>In this article you'll find:</h3></center>
* <b>Introduction</b>
* <b>What is a Data Type?</b>
* <b>What are the most common Data Types?</b>
* <b>A little exercise</b>

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

Before moving on to the next phase of Coding Basics, where we will see more advanced concepts, we must take the biggest step back and teach the basics: Datatypes.

You see, what if I told you that the first step to being a master programmer is to understand this?

Datatypes are found in all code, without exception. This because it is by means of these that we define our variables and the type of data that we will introduce in these.

Not only this, but they allow us to store information in a convenient way, information that can be used by the rest of the program.

Do you want to know the magic behind each variable and be able to work with any of them without any problem? Well, you'll just have to keep reading.

<center>Let's get started!</center>

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

<center><h2>What is a Data Type?</h2></center>

<center>
![DataFlair.jpg](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoH2pcBTCL12Ra5GsMgs1326pbqoMMZw87DbBory8csWaAV9QGzmcTiDzysqpwyhHkf.jpg)
<br>[Shoutout to DataFlair](https://data-flair.training/blogs/python-variables-and-data-types/)</center>

A Data Type is a classification (class) of data that tells the compiler or IDE how we intend to use the data. That is to say, with these we dedicate the type of value that we will assign to the variables.

For example, if we want to indicate that we will introduce to a variable a series of characters, we use the DataType string. If we want to enter integers, we use int. And so on with many others.

Depending on the programming language, the definition of Datatypes will be mandatory or not. In the case of Python or Javascript, this is not necessary. We just define our variable (with var or const if it is Javascript) and then we assign the values corresponding to the type.

```
var_string = 'Hello'
int_var = 4
```

That said, what are the most used Data Types?

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

<center><h2>What are the most common Data Types?</h2></center>

<center>
![ComputerHope.webp](https://files.peakd.com/file/peakd-hive/jesalmofficial/23yJdRHABXCJufkK8U1Nj9KiiADW39Khq9numhnXzKKQKUE1FkMMGbk3Hrqd8iqzKkYvE.webp)
<br>[Shoutout to Computer Hope](https://www.computerhope.com/jargon/d/datatype.htm)</center>

Before knowing which are the most used Data Types, we must take into account that according to the language, the structure of these may vary. While Java-based languages separate Data Types into primitive and non-primitive, C into primary, derived and user-defined, the simplest representation can be seen in Python.

<center>
![GeeksForGeeks.jpg](https://files.peakd.com/file/peakd-hive/jesalmofficial/23tcNnhLWPSTA7wahCzwFPmU49kkW8RZXHSGqKkd4Ptr9SXSYEhw1FWXr3hEfwoq2aqWj.jpg)
<br>[Shoutout to Geeks For Geeks](https://www.geeksforgeeks.org/python-data-types/)</center>

For Python, data is divided into numeric, comprising of:
* Integers
* Floats
* Complex numbers.

Similarly, we have Booleans, dictionaries, sets and sequence type, which we have already seen in previous articles, comprised of:

* Strings
* Tuples
* Lists

However, as the most common we will always see integers, strings and booleans. The strings are all those variables where we will introduce character strings.

```
string character = 'Hello'
```

The integers are all the integer whole number values that we say to enter. In case we want to work with decimal values, we use the Data Type Float and if we want to work with really high numbers, in some languages we must use the Data Type Long.

```
int var1 = 20
float var2 = 34.5
long var3  = 65965666569
```

And finally, the Booleans. These are very often used in conditional statements, since they only have two states: True and False. Thus, by changing the value of these, we can indicate that something changed in the program.

```
IsItTrue = True
```

As for sets, tuples, lists and dictionaries, you can see all about them in the [next article](https://hive.blog/hive-196387/@jesalmofficial/list-dictionaries-sets-and-tuples-listas-diccionarios-sets-y-tuplas-coding-basics-5-enes)

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

<center><h2>A little exercise</h2></center>

<center>
![TechDoge.JPG](https://files.peakd.com/file/peakd-hive/jesalmofficial/23t8B2nr3W7EXqcV3seSjDigWyLEtZEJgsJiYM61SnrobsFjGw4Ez5K2KuhpsPfxT1KBR.JPG)
<br>[Shoutout to TechDoge](https://www.techdoge.in/2017/10/c-programming-what-are-data-type-in-c-with-examples-and-interview-questions.html)</center>

As a little test for your knowledge about Datatypes, I have decided to leave a series of exercises that you can answer. For this, you just have to look at the following image and connect each variable to its respective Datatype:

![image.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/23t8DBnQFDCACJBBBA5Lumd34zzXdtP2NwCAXkbRxo9Tm3ucBVavK6fririLKS7TkwMqh.png)

Was it easy? Then it's time for a challenge. With the knowledge of Datatypes in [the following article](https://hive.blog/hive-196387/@jesalmofficial/list-dictionaries-sets-and-tuples-lists-dictionaries-sets-and-tuples-coding-basics-5-enes), identify which Datatype corresponds to the following variables:

![image.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/23tHbr9ykyPRoN2znwYiZ2ZZ6yJJrJGaSMighDNAVaQWUUq61gEa5hqbL8LwU79PEPa3Z.png)

If you were able to answer both, congratulations, you now understand and master Datatypes. Now you can create variables and understand what kind of information is recorded in each one.

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

With this we have completed the basics of Coding Basics. Now it is time to go into more advanced topics such as operations with classes, decorators, modules and Regular Expressions.

All this in the following articles of Coding Basics. 

If you want to have an order of how to read the previous posts from simple to advanced. Here is a list:

1.- Data Types(This Post)
2.- [Conditional Statements](https://hive.blog/hive-196387/@jesalmofficial/conditional-statements-coding-basics-2)
3.- [Switch Statements](https://hive.blog/hive-196387/@jesalmofficial/switch-statements-switch-statements-coding-basics-8-enes)
4.- [Lists, Dictionaries, Sets and Tuples](https://hive.blog/hive-196387/@jesalmofficial/list-dictionaries-sets-and-tuples-lists-dictionaries-sets-and-tuples-coding-basics-5-enes) 
5.- [Operations with Lists](https://hive.blog/hive-196387/@jesalmofficial/list-operations-operations-operations-with-lists-coding-basics-7-enges)
6.- [For Loops](https://hive.blog/hive-196387/@jesalmofficial/for-loops-cycles-for-coding-basics-3-enges)
7.- [While Loops](https://hive.blog/hive-196387/@jesalmofficial/while-loops-cycles-while-coding-basics-4-enges)
8.- [Functions](https://hive.blog/hive-196387/@jesalmofficial/functions-functions-coding-basics-6-enes) 
9.- [Classes and Objects](https://hive.blog/hive-196387/@jesalmofficial/classes-and-objects-or-classes-and-objects-coding-basics-9-enes)
10.- [Differences between functions and methods](https://hive.blog/hive-196387/@jesalmofficial/classes-and-objects-or-classes-and-objects-coding-basics-9-enes)

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

<center>Thank you for your support and good luck!</center>

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

![@jesalmofficial.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/23uFM31KVmT4iWbMCQWto9Nnz5WENKeMFhkXX2X37NpFPEcUSW7vSx9AEF1rSAVaaAcXP.png)

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)
<center><h1>string article = "Presiona Upvote"</h1></center>

<center>
![Basic-Data-Types-in-Python_Watermarked.webp](https://files.peakd.com/file/peakd-hive/jesalmofficial/23xL9AWXKFCVqxZNForc6ZfWQvyMNDGevWtCGGmitbkyFXamQSPGDCef5fNAoXXJ3AHwE.webp)
<br>[Shoutout to Real Python](https://realpython.com/python-data-types/)</center>

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

<center><h3>En este artículo encontrarás:</h3></center>
* <b>Introducción</b>
* <b>¿Qué es un Data Type?</b>
* <b>¿Cuales son los Data Types más comunes?</b>
* <b>Un pequeño ejercicio</b>

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

Antes de pasar a la siguiente fase de Coding Basics, donde veremos conceptos mas avanzados, debemos de dar el mayor paso atrás y enseñar lo más básico: Los Datatypes.

Verás, ¿Que pasaría si te digo que el primer paso para ser un maestro programador es entender esto?

Los datatypes se encuentra en todo código, sin excepción. Esto debido a que son por medio de estos que definimos nuestras variables y el tipo de datos que introduciremos en estas.

No solo esto, sino que nos permiten almacenar información de manera conveniente, información que puede ser usada por el resto del programa.

¿Deseas conocer la magia detrás de cada variable y poder trabajar con cualquiera sin ningún problema? Bueno, solo tendrás que seguir leyendo.

<center>¡Comencemos!</center>

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

<center><h2>¿Qué es un Datatype?</h2></center>

<center>
![DataFlair.jpg](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoH2pcBTCL12Ra5GsMgs1326pbqoMMZw87DbBory8csWaAV9QGzmcTiDzysqpwyhHkf.jpg)
<br>[Shoutout to DataFlair](https://data-flair.training/blogs/python-variables-and-data-types/)</center>

Un Data Type es una clasificación (clase) de datos que le dice al compilador o IDE como pretendemos usar los datos. Es decir, con estas dedicamos el tipo de valor que asignaremos a las variables.

Por ejemplo, si queremos indicar que introduciremos a una variable una serie de caracters, utilizamos el DataType  string. Si queremos introducir números enteros, usamos int. Y así con muchas otras.

Dependiendo del lenguaje de programación, la definición de los Datatypes será obligatoria o no. En el caso de Python o Javascript, esto no es necesario. Solo definimos nuestra variable (con var o const si es Javascript) y luego le asignamos los valores correspondientes al tipo.

```
var_string = 'Hello'
int_var = 4
```

Dicho esto, ¿Cuales son los Data Types más usados?

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

<center><h2>¿Cuales son los Data Types más usados?</h2></center>

<center>
![ComputerHope.webp](https://files.peakd.com/file/peakd-hive/jesalmofficial/23yJdRHABXCJufkK8U1Nj9KiiADW39Khq9numhnXzKKQKUE1FkMMGbk3Hrqd8iqzKkYvE.webp)
<br>[Shoutout to Computer Hope](https://www.computerhope.com/jargon/d/datatype.htm)</center>

Antes de saber cuales son los Data Types más utilizados, debemos de tomar en cuenta que de acuerdo al lenguaje, la estructura de estos puede variar. Mientras que los lenguajes basados en Java separan a los Data Types en primitivos y no primitivos, C en primarios, derivados y definidos por el usuario, la representación más sencilla puede observarse en Python.

<center>
![GeeksForGeeks.jpg](https://files.peakd.com/file/peakd-hive/jesalmofficial/23tcNnhLWPSTA7wahCzwFPmU49kkW8RZXHSGqKkd4Ptr9SXSYEhw1FWXr3hEfwoq2aqWj.jpg)
<br>[Shoutout to Geeks For Geeks](https://www.geeksforgeeks.org/python-data-types/)</center>

Para Python, los datos se dividen en numéricos, que comprenden a:
* Enteros
* Flotantes
* Números Complejos.

De igual forma, tenemos a los booleanos, los diccionarios, los sets y los de tipo secuencia, que ya hemos visto en artículos anteriores, comprendidos por:

* Strings
* Tuplas
* Listas

Sin embargo, como los más comunes siempre veremos a los enteros, strings y booleanos. Los strings son todas aquellas variables donde introduciremos cadenas de caracteres.

```
string character = 'Hello'
```

Los enteros son todos los valores numéricos enteros que ingresamos. En caso de querer trabajar con valor decimales, usamos el Data Type Float y si deseamos trabajar con números realmente altos, en algunos lenguajes debemos de usar el Data Type Long.

```
int var1 = 20
float var2 = 34.5
long var3  = 65965666569
```

Y finalmente, los booleanos. Estos son utilizados con gran frecuencia en declaraciones condicionales, ya que solo tienen dos estados: Verdadero y Falso. Así, al cambiar el valor de estos, podemos indicar que algo cambió en el programa.

```
IsItTrue = True
```

En cuanto a los sets, tuplas, listas y diccionarios, puedes ver todo sobre ellos en el [siguiente artículo](https://hive.blog/hive-196387/@jesalmofficial/list-dictionaries-sets-and-tuples-listas-diccionarios-sets-y-tuplas-coding-basics-5-enes)

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

<center><h2>Un pequeño ejercicio</h2></center>

<center>
![TechDoge.JPG](https://files.peakd.com/file/peakd-hive/jesalmofficial/23t8B2nr3W7EXqcV3seSjDigWyLEtZEJgsJiYM61SnrobsFjGw4Ez5K2KuhpsPfxT1KBR.JPG)
<br>[Shoutout to TechDoge](https://www.techdoge.in/2017/10/c-programming-what-are-data-type-in-c-with-examples-and-interview-questions.html)</center>

Como un pequeño test para tu conocimiento sobre Datatypes, he decidido dejar una serie de ejercicios que puedes responder. Para esto, solo debes de observar la siguiente imagen y conectar cada variable a su Datatype respectivo:

![image.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/23t8DBnQFDCACJBBBA5Lumd34zzXdtP2NwCAXkbRxo9Tm3ucBVavK6fririLKS7TkwMqh.png)

¿Fue fácil? Entonces es tiempo de un reto. Con el conocimiento de los Datatypes en [el siguiente artículo](https://hive.blog/hive-196387/@jesalmofficial/list-dictionaries-sets-and-tuples-listas-diccionarios-sets-y-tuplas-coding-basics-5-enes), identifica que Datatype corresponde a las siguientes variables:

![image.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/23tHbr9ykyPRoN2znwYiZ2ZZ6yJJrJGaSMighDNAVaQWUUq61gEa5hqbL8LwU79PEPa3Z.png)

Si has podido responder ambos, ¡Felicitaciones!, ya entiendes y dominas los Datatypes. Ahora puedes crear variables y entender que tipo de información está grabada en cada una.

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

Con esto concretamos lo básico de Coding Basics. Ahora es tiempo de adentrarnos en temas más avanzados como lo son operaciones con clases, decoradores, módulos y Expresiones Regulares.

Todo esto en los siguientes artículos de Coding Basics. 

Si quieres tener un orden de como leer los posts previos desde lo más sencillo hasta lo más avanzado. He aquí una lista:

1.- Data Types(Este Post)
2.- [Declaraciones Condicionales](https://hive.blog/hive-196387/@jesalmofficial/conditional-statements-coding-basics-2)
3.- [Declaraciones Switch](https://hive.blog/hive-196387/@jesalmofficial/switch-statements-declaraciones-switch-coding-basics-8-enes)
4.- [Listas, Diccionarios, Sets y Tuplas](https://hive.blog/hive-196387/@jesalmofficial/list-dictionaries-sets-and-tuples-listas-diccionarios-sets-y-tuplas-coding-basics-5-enes)
5.- [Operaciones con Listas](https://hive.blog/hive-196387/@jesalmofficial/list-operations-operaciones-con-listas-coding-basics-7-enges)
6.- [Bucles For](https://hive.blog/hive-196387/@jesalmofficial/for-loops-ciclos-for-coding-basics-3-enes)
7.- [Bucles While](https://hive.blog/hive-196387/@jesalmofficial/while-loops-ciclos-while-coding-basics-4-enes)
8.- [Funciones](https://hive.blog/hive-196387/@jesalmofficial/functions-funciones-coding-basics-6-enes) 
9.- [Clases y Objetos](https://hive.blog/hive-196387/@jesalmofficial/classes-and-objects-or-clases-y-objetos-coding-basics-9-enes)
10.- [Diferencias entre funciones y métodos](https://hive.blog/hive-196387/@jesalmofficial/the-difference-between-a-method-and-a-function-coding-basics)

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)

<center>¡Gracias por tu apoyo y buena suerte!</center>

![HiveDivider.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/EoGvX4Va6X4ZfjnYkvBhFi2bqZsCrwoqpWhwgmGDPKVDS9eeZ4zF8foqAfcm44mn84d.png)


![@jesalmofficial.png](https://files.peakd.com/file/peakd-hive/jesalmofficial/23uFM31KVmT4iWbMCQWto9Nnz5WENKeMFhkXX2X37NpFPEcUSW7vSx9AEF1rSAVaaAcXP.png)
</div>
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,