2023-10-28 14:39, Laimis rašė:
Visi jo operandai python'e gali būti tik expression'ai, bet ne
statement'ai (kuo assignment ir yra):
https://peps.python.org/pep-0308/
su visai jo priblūdais, Python man pradeda patikti.
before: 's1': [2, 8, 15, 16]
before: 's2': [16, 17, 18]
before: 's3': [18, 19, 20]
before: 's4': [2, 19, 20, 21, 22, 23, 24]
before: 's5': [8, 22, 23, 24, 25, 26, 27, 28]
before: 's6': [8, 15, 26, 27, 28, 29, 30, 31]
before: 'optional': [28, 29, 30, 31, 32, 33, 34, 35]
after: 's1': [2, 8, 15, 16]
after: 's2': [17, 18]
after: 's3': [19, 20]
after: 's4': [24, 21, 22, 23]
after: 's5': [25, 26, 27, 28]
after: 's6': [29, 30, 31]
after: 'optional': [32, 33, 34, 35]
def __remove_repetitions(list_of_lists: list) -> list:
return_list = []
while len(list_of_lists) > 1:
importantier = list_of_lists[0]
list_of_lists.pop(0)
for i, k in enumerate(list_of_lists):
list_of_lists[i] = list(set(k) - set(importantier))
return_list += [importantier]
return_list.append(list_of_lists[0])
return return_list
--
Grzegorz
Chrząszczyrzewoszyce, powiat Łękołody