Esempio n. 1
0
 def generate(self, linked_list, pos, amount):
     rez = Iterator(int(amount))
     to_return = LinkedList()
     for num in rez:
         to_return.add_tail(num)
     # print("\n to_return strategy 1",) # тут правильний ліст
     # to_return.print()
     print()
     return super().generate(linked_list, pos, to_return)
Esempio n. 2
0
 def generate(self, linked_list, pos, file_name):
     f = open(file_name)
     to_ints = f.read()
     to_ints = to_ints.split(", ")
     res = LinkedList()
     for i in range(len(to_ints)):
         if represents_int(to_ints[i]):
             to_ints[i] = int(to_ints[i])
             res.add_tail(to_ints[i])
         else:
             print("Element ", to_ints[i],
                   "in file is not int. Its position is ", i + 1)
     return super().generate(linked_list, pos, res)