Its definition reads as follows on Wikipedia:
Data structure is a data organization, management, and storage format that enables efficient access and modification.
More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.
Visitor's name | Visitor's phone number | Visitor's address | Entry time |
---|---|---|---|
Karen | 32 000 000 | Leuven | 8:30 AM |
The above information that you just provided is data. |
We see that the data entry in the previous slide has different varieties: |
Some are English letters,
Some are numerical digits, and
There are some special characters, dash (-) and colon ( : ).
In this example, our data is divided into 4 categories – name, phone number, address, and time.
This categorization of data, based on its characteristics & our needs, is called data types.
Some of the data types in python include:
Integer: whole numbers, positive or negative numbers. Eg: 100.
Float: Floating-point numbers are real numbers, rational or irrational. In most cases, this means numbers with decimal parts. Example: 123.45.
String: Strings are sequences of characters, or text, enclosed in quotes. Example: "any text", “karen”.
For further reading about operators and data types, visit: https://www.dummies.com/programming/python/python-all-in-one-for-dummies-cheat-sheet/
For practice and different data type examples, visit: https://www.w3schools.com/python/python_datatypes.asp
You can get the data type of any object by using the type( ) function: