Why am I getting a TypeError with unary in my Python program