python class for create a list from user code example
Example 1: how to get user input of list of lists in python
lst = [ ]
n = int(input("Enter number of elements : "))
for i in range(0, n):
ele = [input(), int(input())]
lst.append(ele)
print(lst)
Example 2: python list of objects
# Create a new class
class MyClass(object):
def __init__(self, number):
self.number = number
# Create a array to store your objects
my_objects = []
# Add 100 objects to array
for i in range(100):
my_objects.append(MyClass(i))