The [Ones' Complement](https://en.wikipedia.org/wiki/Ones%27_complement) of a binary number is the number obtained by swapping all the 0s for 1s and all the 1s for 0s. For example:

```
onesComplement(1001) = 0110
onesComplement(1001) = 0110
```

For any given binary number,formatted as a string, return the Ones' Complement of that number.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def ones_complement(binary_number):
	

Solutions:
def ones_complement(n):
	return n.translate(str.maketrans('01', '10'))


def ones_complement(binary_number):
	return binary_number.translate(str.maketrans('01', '10'))


def ones_complement(binary_number):
	return ''.join(['1' if binary_number[x] == '0' else '0' for x in range(0, len(binary_number))])


ones_complement = lambda s: s.translate({48: 49, 49: 48})


def ones_complement(binary_number):
	return ''.join(('0' if int(n) else '1' for n in binary_number))


def ones_complement(s):
	return ''.join(({'0': '1'}.get(c, '0') for c in s))


def ones_complement(b):
	b = b.replace('0', '*')
	b = b.replace('1', '0')
	return b.replace('*', '1')


def ones_complement(binary):
	return ''.join(('01'[b == '0'] for b in binary))