Given the following problem,
Input
lis = ['0-10,000, 10,001-11,000, 11,001-12,000']
Output:
['0-10,000','10,001-11,000', '11,001-12,000']
Create a function such that, it should avoid if there's a single range in the list but split the ranges if there are multiple ranges in the list.
Can anybody help me with this problem, I can't even think of any method.
First build a string from the list of elements, then split the string with the specified ", ".
lis = ['0-10,000, 10,001-11,000, 11,001-12,000']
print(''.join(lis).split(", "))