Python Built-In Data Types
   1 min read

Resources: See W3 Schools Tutorials for further information.

Common Data Types

Data typeConversion functionNotes
Textstr()
Integerint()
Floatfloat()use e to derive a float to the power of 10 e.g. 12e2 (float is 1200.0)
Complexcomplex()use j for imaginary unit
Listlist(())
Tupletuple(())
Setset(())
Dictionarydict(element1=value1, element2=value2...)
Booleanbool()evaluate expressions, values, variables, or strings and return True or False. (Returns false for empty strings, lists, tuples, or dictionaries, and also for numbers equal to 0)
NoneTypeassign the keyword None to a variable

Determine Data Type

type()

Example:

name = "Ali"
print(type(name))

<class 'str'>

Example:

number = 101.2
print(type(number))

<class 'float'>

Example:

memberList = ["Ali", 17639, True] #contains string, integer, Boolean elements.
print(type(memberList))

<class 'list'>