Why is it string.join(list) instead of list.join(string)?

The join() method is a string method, so it is called on a string object and takes a list of strings as its argument. This makes sense when you consider that the join() method is used to create a single string from a list of strings by concatenating all the strings in the list, using the string on which the join() method is called as a separator.

For example, if you have a list of strings:

words = ['cat', 'dog', 'fish']

Watch a course Python - The Practical Guide

You can use the join() method to create a single string from the list, like this:

words = ['cat', 'dog', 'fish']
sentence = ' '.join(words)
print(sentence)

The resulting string sentence would be: "cat dog fish"

The join() method is often used to create a single string from a list of strings because it is a convenient and efficient way to do this. It is much faster than concatenating the strings manually using a for loop, for example.

I hope this helps! Let me know if you have any other questions.