Odwróć specyficzny Python

# To flip the kth bit of x, XOR it with 1 leftshifted k times 
x = x ^ (1 << k)
Sore Stag