please be aware, im new to python: i'm trying to create a defined function that can convert a list into a string, and allows me to put a separator in. The separator has to be ', '. My current thought process is to add each item from a list to an empty string variable, and then I'm trying to make use of the range function to add a separator in. I'm only wanting to use str() and range().
def list2Str(lisConv, sep = ', '):
var = ''
for i in lisConv:
var = var + str(i)
#test line
print(var, "test line")
var1 = int(var)
for a in range(var1):
print(str(var1)[a], sep = ', ')
list1 = [2,0,1,6]
result = list2Str(list1, ', ')
print(result)