Sobes.tech
Intern — Senior

How to get the number of elements in different types of Python collections

livecode

Task condition

What will the program output when running the following code:

x = [i for i in range(10)]
y = {i for i in range(10)}
z = (i for i in range(10))


print(len(x))
print(len(y))
print(len(z))