Get data type in Python

Contrary to other programming languages, such as C++ or Java, you don’t specify the data type when defining a variable in Python, but it doesn’t mean that the variable doesn’t have a type.

You can check the variable type using the type function that returns the type of data.

Continue reading

sys.maxint in Python

sys.maxint is the maximum value for the int variable in Python 2.

Python 3 doesn’t use this property because the int type in Python 3 has no limit. For Python 3, you can use sys.maxsize to check the maximum size lists, strings, dicts, and many other containers can have.

Continue reading

Append to array in Python

In Python, lists can be used as arrays, because the language doesn’t have built-in support. An array is one chunk of memory that usually consists of multiple elements, where a list is a list of objects where one element points to another and it doesn’t have to be inside one block of memory.

Continue reading