Python Fundamental Series From Data Science &; Data Analysis Path MySkill.id Source: List Fundamental in Python. Python Fundamental Series From Data... | by My Skill | Medium

Introduction Data Types In Python

In the Python programming language, one of the basic fundamentals in learning it is understanding and writing data types. Data Types in Python (generally applies also to other programming languages) is a way to classify and group one or several different sets of values so that they can be processed and manipulated correctly in the use of program code with the desired purpose (such as application creation, data processing, and so on) by utilizing a programming language (Python). This data type also defines the properties and behavior of each value that exists and is owned by each variable or object in the programming language (Python).

Data Type Example
Boolean True or False
String “Let’s learn Python.”
Integer 25 or 0.99
Hexadecimal 9a or 1d3
Complex 1 + 5j
List ['xyz', 786, 2.23
Tuple ('xyz', 768, 2.23)
Dictionary {'name': 'adi', ''id:2}

Data types in programming languages, especially in Python, can help to understand how these values should be interpreted and used in certain types of operations and which are appropriate for their use.

Basic Data Types and Collection Data Types

Python has a dynamic system of data types, a Python user does not need to declare data types explicitly when creating a variable. Python will automatically or directly determine the data type of the value assigned to the variable that has been declassified. In Python fundamentals, there are 2 types of grouping data types that are often used and of course it is familiar to those of us who have studied the world of information technology, especially about programming languages (especially python), namely grouping basic data types and collection data types. Here are some explanations and differences between basic data types and collection data types.

Basic IPE data

Collection Data Type.

In its application, the choice of use between the basic data type and the collection data type depends on the needs of the program created. Basic data types are used when we only need to store one single value, while collection data types are used when we want to manage a more complex set of values or data. Both types of data types have an important role in the development and use of a program code (Python).

Collection data type (List) in Python programming language

In accordance with the above, the types of data types in Python can be grouped into several main categories based on their nature and use. A list is one type of several types of data collection (or container) used to store a set of elements in a specific order. List is a very common data type and is often used in Python programming. Here are some functions and uses of List, especially in the Pythom programming language

  1. List is usually used to store various types of elements in one variable owned.
  2. Each element in the list has an index starting from 0 (first index), 1 (second index), and so on. This is similar to the concept of indexes on arrays.
  3. Lists can store elements with different data types, including mixed data types such as strings, integers, and other objects.

We can create a list using square brackets and separate each element using commas. Example of creating a list in Python, my_list = [a, b, c, d]. We can also access every element in the list that has been created using its index. For example: elemen_pertama = my_list[2], eating will produce an output of the value of c (based on the list made earlier). In addition, we can also change each list element by assigning a new value to a specific index. For example: my_list[0] = z, eating will change the index 0 or the first element to the letter 'z'.