Use type() function to check the data type of any value.
Data types define what type of value a variable stores. Python automatically identifies the data type.
Python supports different types of numbers.
age = 18 # Integer height = 5.3 # Float number = 2+3j # Complex
String stores text values.
name = "Roshni" print(name)
List stores multiple values and can be changed.
colors = ["Pink","Blue","Green"]
Tuple stores multiple values but cannot be changed.
numbers = (1,2,3)
Set stores unique values only.
items = {1,2,3}
Dictionary stores data in key-value pairs.
student = {
"name":"Roshni",
"age":18
}
Boolean stores True or False values.
is_student = True
x = 10 print(type(x))
name = "Roshni" age = 18 skills = ["Python","HTML","CSS"]
Python has many built-in data types like String, List, Tuple, Set, Dictionary and Numbers.
Yes, Python automatically detects the data type.
List, Tuple, Set and Dictionary store multiple values.