Sep 6, 2025
This lecture introduces Python's built-in data types, how to determine an object's data type, and how to assign or specify types using assignment and constructors.
str, int, float, complex, list, tuple, range, dict, set, frozenset, bool, bytes, bytearray, memoryview, and NoneType.str), Numeric (int, float, complex), Sequence (list, tuple, range), Mapping (dict), Set (set, frozenset), Boolean (bool), Binary (bytes, bytearray, memoryview), None (NoneType).type() function to get the data type of any object.type(x) returns the type of variable x.x = "Hello World" sets x as str.x = 20 sets x as int.x = 20.5 sets x as float.x = 1j sets x as complex.x = ["apple", "banana", "cherry"] is a list.x = ("apple", "banana", "cherry") is a tuple.x = range(6) is a range.x = {"name" : "John", "age" : 36} is a dict.x = {"apple", "banana", "cherry"} is a set.x = frozenset({"apple", "banana", "cherry"}) is a frozenset.x = True is a bool.x = b"Hello" is bytes.x = bytearray(5) is a bytearray.x = memoryview(bytes(5)) is a memoryview.x = None is NoneType.x = str("Hello World").int(20), float(20.5), complex(1j), list(("apple", "banana")), tuple(("apple", "banana")), dict(name="John", age=36), set(("apple", "banana")), frozenset(("apple", "banana")), bool(5), bytes(5), bytearray(5), memoryview(bytes(5)).int(), list(), etc., used to create objects of a specific type.type() to check the types of your variables.