Basically, I am trying to join together the entries in a set in order to output one string. I am trying to use syntax similar to the join function for lists. Here is my atte
', '.join(set_3)
The join is a string method, not a set method.
Sets don't have a join method but you can use str.join instead.
', '.join(set_3)
The str.join method will work on any iterable object including lists and sets.
Note: be careful about using this on sets containing integers; you will need to convert the integers to strings before the call to join. For example
set_4 = {1, 2}
', '.join(str(s) for s in set_4)
The join is called on the string:
print ", ".join(set_3)
You have the join statement backwards try:
print ', '.join(set_3)
I think you just have it backwards.
print ", ".join(set_3)
Nor the set nor the list has such method join, string has it:
','.join(set(['a','b','c']))
By the way you should not use name list for your variables. Give it a list_, my_list or some other name because list is very often used python function.