Basic types.

--Originally published at Hackerman's house

In this post we’ll se the basic types that exist in python. In python exists something called variables that are just reserved memory locations that store values, there are many types of data that can be stored.

Numbers: These can be in different forms such as integers (1), flood (1.1), and complex (1j)

Strings: These are basically words.

Lists: A list that can be made of both strings and numbers.

Tuple: Lists that cannot be modified.

Dictionary: This can be a list or a single value, these come in pairs, just like a definition and a word in real dictionary.

types

One thing to note is that this are used to store data that then will be used with other functions that are part of python. Such as mathematic operations or just print the data.

Check this page that really helped me understand this topic.

https://www.tutorialspoint.com//python3/python_variable_types.htm


Python’s Types of Data

--Originally published at Py(t)hon

Python has five standard types of data:

  • Numbers
  • Strings
  • Lists
  • Tuples
  • Dictionary

The number type data is used to store numerical values, this are created when you assign a value to the object.

var1 = 5

var2= 15

Pythons support four different numerical types:

  • int ( signed integers )
  • long ( long integers, they can also be represented in octal and hexadecimal)
  • float ( floating point real values)
  • complex (complex numbers)

Some examples, for a clearer view:

int long float complex
10 51924361L 0.0 3.14j
100 -0x19323L 15.20 45.j
-786 0122L -21.9 9.322e-36j
080 0xDEFABCECBDAECBFBAEl 32.3+e18 .876j
-0490 535633629843L -90. -.6545+0J
-0x260 -052318172735L -32.54e100 3e+26J
0x69 -4721885298529L 70.2-E12 4.53e-7j

In the other hand we have the String which are a set of values represented inside a quotation mark.  Python allows either pairs of single or double. Subsets of the string can be made by a slice operator ([] and [:]). Every set starts at 0 to -1. You can include the sing (+) to add something else and the (*) to repeat that string a number of times. Here is an example for a better understanding:

string1

The next type is the list, where you will find items separated by commas and inside brackets, you can access to this list like the string but the difference is that it will appear the complete list of the place you chose, not only a letter or a value; also like the previous you can add something with the (+) and repeat the list with the (*) and example:

list1

The tuples are very similar to the lists, but the main difference is that the tuples are enclosed between parenthesis and not brackets as the list, and another main point is that

tuple 1
dictionarie1
Continue reading "Python’s Types of Data"