0
Q:

python documentation __sizeof__

# declaring lists
w =[1, 2] 
x =[4, 5, 7, 9] 
y =[2, 8, 6, 56, 45, 89, 88] 
z =[54, 45, 12, 23, 24, 90, 20, 40] 
# printing output
print(w.__sizeof__())  # output --> 28
print(x.__sizeof__())  # output --> 36
print(y.__sizeof__())  # output --> 48
print(z.__sizeof__())  # output --> 52

# sizeof shows the byte taken by the list. It starts with 20 with 0 elements and then increments by
# 4 with every element added
0

New to Communities?

Join the community