finding out complementary/opposite color of a given color
<p>I am trying to find out the complementary color of a given color using Python. here is my code. the code returns error message telling "AttributeError: 'list' object has no attribute 'join'" I need a hint. In addition, there  might be a more robust code which calculates the opposite/complementary color, which I am basically looking for. your suggestions will be helpful.</p>

<pre><code>from PIL import Image  

def complementaryColor(hex):
    """Returns complementary RGB color

    Example:
    &gt;&gt;&gt;complementaryColor('FFFFFF')
    '000000'
    """
    if hex[0] == '#':
        hex = hex[1:]
    rgb = (hex[0:2], hex[2:4], hex[4:6])
    comp = ['02%X' % (255 - int(a, 16)) for a in rgb]
    return comp.join()
</code></pre>

<p><strong><em>another similar function</em></strong></p>

<pre><code>def blackwhite(my_hex):
    """Returns complementary RGB color

    Example:
    &gt;&gt;&gt;complementaryColor('FFFFFF')
    '000000'
    """
    if my_hex[0] == '#':
        my_hex = my_hex[1:]
    rgb = (my_hex[0:2], my_hex[2:4], my_hex[4:6])
    comp = ['%X' % (0 if (15 - int(a, 16)) &lt;= 7 else 15) for a in rgb]
    return ''.join(comp)


print blackwhite('#36190D')
</code></pre>