Python Data Types Tutorials and Interview Questions and Answers
In this section we will cover Basic Introduction on Python Data Types in Python. This will helps to build basic block when constructing larger pieces of Python code. Let's discuss all of the possible data types available in Python.
Integers (int)
Whole numbers such as: 3 300 or 200
Floating Point (float)
Numbers with decimal point: 2.3 5.6 or 10.0
Strings (str)
Ordered sequence of characters: "hello" "world" '4000' "こんにちは"
Lists (list)
Orderred Sequence of objects: [10,"hello","world"]
Dictionaries (dict)
Unordered Key:Value pairs: {"name" : "Sam","company":"Eduzip"}
Tuples (tup)
Ordered immutable sequence of objects: (10,"hello",300.4)
Sets (set)
Unordered collection of unique objects: {"a","b"}
Booleans (bool)
Logical value indicating True or False
>>> [1, 2, 'stock', 4]
The following Python code is a
>>> colors = ('red', 'yellow', 'blue', 'black')
The following Python code
>>> {'stock': 'NVO', 'wikipedia': 'Novo_Nordisk'}
is a
The following Python code
>>> a = range(5)
>>> b = a
>>> a[3] = 77
results in
The following Python code
>>> 'Result: ' + 23
results in
What is the output of the following program?
language = ['P', 'y', 't', 'h', 'o', 'n']
print(language[:-4])
Comments: (Your feedback is valuable to us)