1>>> sentence = ['this','is','a','sentence']
2>>> '-'.join(sentence)
3'this-is-a-sentence'
1list = ['Add', 'Grepper', 'Answer']
2Inline
3> joined = " ".join(list)
4> Add Grepper Answer
5Variable
6> seperator = ", "
7> joined = seperator.join(list)
8> Add, Grepper, Answer
1# example of join() function in python
2
3numList = ['1', '2', '3', '4']
4separator = ', '
5print(separator.join(numList))
1first_list = ["1", "2"]
2second_list = ["3", "4"]
3
4# Multiple ways to do this:
5first_list += second_list
6first_list = first_list + second_list
7first_list.extend(second_list)
8
1# Joins all items in a list or tuple, using a specific separator
2lst = ['a', 'b', 'c']
3joinedLst = ', '.join(lst)
4print(x) # Prints 'a, b, c'