Python – convert a set into string in python

pythonset

let say I got a set call x

x = set(['x','c','v','x','w','g'])

print(', '.join(x)

I get

x,c,v,x,w,g

How can modify my code to get

x,c,v,x,w or g

change the last , to a or?

Best Solution

try

print(', '.join(x[:-1]) + " or " + x[-1])