Data types in python
In python, there are different data types that we must understand to be able to write code efficiently. In all the examples, I will be writing my codes like this → my_(whatever is in the example)_var. Here they are:
Get Aaradhana Abbaraboina’s stories in your inbox
Join Medium for free to get updates from this writer.
Integer- A whole number, no decimals, such as the numbers 8 or 11
my_integer_var = 4
print("Integer:" , my_integer_var)
Integer: 4Float- A decimal, such as 6.34 or 5.5
my_float_var = 3.14
print("Float:" , my_float_var)
Float: 3.14String- A sentence or phrase placed inside quotation marks, like “Hello”
my_string_var = "Coding is fun!"
print("String:" , my_string_var)
String: Coding is fun!Boolean- This type whether something is true or false, written as either True or False
my_boolean_var = True
print("Boolean:" , my_boolean_var)
Boolean: TrueSet- An unordered collection of numerous things enclosed in curly brackets, such as {“apple”, 5, 0.64}. It doesn’t keep its contents in the same order as it was given.
my_set_var = {17,"blueberries", 20.89}
print("Set:" , my_set_var)
Set: {20.89,"blueberries", 17}Dictionary- A collection of pairs also enclosed in curly brackets, such as {name = Jofia, age = 27}
my_dictionary_var = {name = Jofia, age = 27}
print("Dictionary:" , my_dictionary_var)
{name = Jofia, age = 27}Tuple- A collection of ordered elements, enclosed in regular parenthesis, like this: (apple, banana, 34). Unlike in sets, this data type gives back information in the order in which it was given.
my_tuple_var = (soccer, 4, pink)
print("Tuple:" , my_tuple_var)
Tuple: (soccer, 4, pink)Range- A list of numbers mainly used to create loops, such as range(9)
my_range_var = range(9)
print("Range:" , my_range_var)
Range: range(0,9)List- An ordered collection that supports different kinds of data types, such as [“hello”, 4, 8.6]
my_list_var = ["hello", 4, 8.6]
print("List:" , my_list_var)
List: hello, 4, 8.6None- A value that represents that absence of a different value
my_none_var = none
print("None:" , my_none_var)
None: noneThese are the most common ones that someone will use while coding. Thankfully, they’re amongst the easiest things in python to understand.









