TYPE()
The type() function is used to determine the data type of a given value or object. It returns the class type of the object passed as an argument, such as int, float, str, list, tuple, dict, set, or any user-defined class. The type() function is often used for debugging, validation, and conditional operations where behavior depends on the type of the data. It can also be used to dynamically check and enforce types in functions or when processing inputs, making it a versatile tool for understanding and controlling how Python interprets and manipulates data.
#!/usr/bin/env python3
def main() -> None:
variableInt = 3;
variableFloat = 5.8;
variableString = 'hello';
variableBool = True;
print(type(variableInt));
print(type(variableFloat));
print(type(variableString));
print(type(variableBool));
if __name__ == "__main__":
main();Last updated