Answers for "list class in python"

0

list class in python

class MyClass:
    def __init__(self, signature):
        self.signature = signature

    def __repr__(self) -> str:
        return str(self.signature)

class_list = []

for i in range(10):

    class_list.append(MyClass(i))

print (class_list) # outputs [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Posted by: Guest on June-02-2021

Python Answers by Framework

Browse Popular Code Answers by Language