Thank you so much for pointing out all those errors, and thank you for the hints!
I've figured out some of them later, sorry, I'm still a beginner.
I've thought about splitting the string, then turning it into a list of integers through a for cycle.
(Also, I don't know how much convenient could it be, but maybe sorting the list, and including the range of the index from to the number of the input, could save time for the loops).
I've figured out some of them later, sorry, I'm still a beginner.
I've thought about splitting the string, then turning it into a list of integers through a for cycle.
(Also, I don't know how much convenient could it be, but maybe sorting the list, and including the range of the index from to the number of the input, could save time for the loops).
string.split(',') for x in string.split(','): d=int(x) s.append(d)Anyway, after looking if the number is already in the list, and using the while method pointing j as the len(new_list) in the while method, the sum should be calculated between all the numbers of the list.The index j should get j+=-1 everytime until i and j won't encounter eachother.