Intern
What data types are available in Python?
sobes.tech AI
Answer from AI
Python has several basic data types:
- Numbers:
int(integers),float(floating-point numbers),complex(complex numbers). - Strings (
str): sequences of characters. - Boolean values (
bool):TrueandFalse. - Lists (
list): ordered mutable collections. - Tuples (
tuple): ordered immutable collections. - Sets (
set): unordered collections of unique elements. - Dictionaries (
dict): collections of key-value pairs. - NoneType: the type of the
Noneobject, which indicates the absence of a value.
Example usage:
x = 10 # int
pi = 3.14 # float
name = "Ivan" # str
flag = True # bool
lst = [1, 2, 3] # list
tpl = (4, 5) # tuple
st = {1, 2, 3} # set
d = {"a": 1} # dict
n = None # NoneType