fb pixel

join()

If split() divides the string into elements, join() unites list elements together and creates a string from them:
l = ['Hi', 'I', 'am', 'Python', '3', '10']
print('.'.join(l))    # Hi.I.am.Python.3.10
print(' '.join(l))    # Hi I am Python 3 10
print('*-*'.join(l))  # Hi*-*I*-*am*-*Python*-*3*-*10
print('\n'.join(l))   # Hi
                      # I
                      # am
                      # Python
                      # 3
                      # 10

Challenge

Given 5 names in the input, print them separated by a -->.
The input contains 5 names each on a separate line.
The output should contain a single line - all 5 names separated by -->.
Input
Anna
Simon
Lily
Bob
David

Output
Anna-->Simon-->Lily-->Bob-->David
 
To check your solution you need to sign in
Sign in to continue