Junior — Middle
Can you list the main data types used in Python?
sobes.tech AI
Answer from AI
The main data types in Python include:
- int — integers
- float — floating-point numbers
- str — strings
- bool — boolean values (True/False)
- list — lists, ordered mutable collections
- tuple — tuples, ordered immutable collections
- dict — dictionaries, key-value pair collections
- set — sets, unordered unique elements
Example:
x = 10 # int
pi = 3.14 # float
name = "Anna" # str
flag = True # bool
items = [1, 2, 3] # list
coords = (10, 20) # tuple
user = {"id": 1, "name": "Bob"} # dict
unique = {1, 2, 3} # set