Every value is an object with a type, and the type decides which operations are legal. Plus: when type casting works and when it doesn't.
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
Find out what type Python assigns to the value 9.0 by asking Python directly, with the built-in introduced in the video.
Assign the type object Python reports to value_type.
A type fixes the legal operations on an object
State that every object carries a type, and contrast the arithmetic available on 30 with the length and character access available on "Ana", which cannot be divided.
The four scalar types and type()
Define int, float, bool and NoneType with how many values each admits, record type(9.0) as float, and note type(true) raising a NameError while True is accepted.
Casting builds a new object
Write float(3) giving 3.0, int(5.2) and int(5.9) both giving 5 by truncation, and round(5.9) giving 6, noting the original object stays in memory unchanged.