Given a 32 bit unsigned integer num and an integer i. Perform following operations on the number - 
1. Get ith bit
2. Set ith bit
3. Clear ith bit
Note : For better understanding, we are starting bits from 1 instead 0. (1-based)
Example 1:
Input: 70 3
Output: 1 70 66
Explanation: Bit at the 3rd position from LSB is 1. (1 0 0 0 1 1 0)
The value of the given number after setting the 3rd bit is 70. 
The value of the given number after clearing 3rd bit is 66. (1 0 0 0 0 1 0)
Example 2:
Input: 8 1
Output: 0 9 8
Explanation: Bit at the first position from LSB is 0. (1 0 0 0)
The value of the given number after setting the 1st bit is 9. (1 0 0 1)
The value of the given number after clearing 1st bit is 8. (1 0 0 0)
 
Your Task:
Complete the function bitManipulation() which takes two integers num and i as input and prints the results after each operation separted by a space in the same line. You don't have to print any new lines after printing the output, that will be handled by driver code.
 
Constraints:
0<=num<=10^{9}
1<=i<=32

Difficulty: EASY

Starter code:
#User function Template for python3



class Solution:

    def bitManipulation(self, n, i):

        # Code here

Solutions:
class Solution:

	def bitManipulation(self, n, i):
		getBit = 1 if n & 1 << i - 1 else 0
		setBit = n | 1 << i - 1
		clearBit = n & ~(1 << i - 1)
		print(getBit, setBit, clearBit, end=' ')


class Solution:

	def bitManipulation(self, n, i):
		getbit = 1 if n & 1 << i - 1 else 0
		setbit = n | 1 << i - 1
		clearbit = n & ~(1 << i - 1)
		print(getbit, setbit, clearbit, end='')


class Solution:

	def bitManipulation(self, n, i):
		ith_bit = n >> i - 1 & 1
		print(str(ith_bit), end='')
		n |= 1 << i - 1
		print(' ' + str(n), end='')
		n &= ~(1 << i - 1)
		print(' ' + str(n), end='')


class Solution:

	def bitManipulation(self, n, i):
		res = []
		k = i
		m = n
		while k > 1:
			k -= 1
			m >>= 1
		res.append(m & 1)
		if res[-1] != 1:
			a = 1
			k = i
			while k > 1:
				k -= 1
				a <<= 1
			m = n
			res.append(m ^ a)
		else:
			res.append(n)
		if res[0] == 1:
			a = 1
			k = i
			while k > 1:
				k -= 1
				a <<= 1
			m = n
			res.append(m ^ a)
		else:
			res.append(n)
		for j in res:
			print(j, end=' ')


class Solution:

	def bitManipulation(self, n, i):
		i = i - 1
		ans = 1 << i
		if ans & n:
			getb = 1
		else:
			getb = 0
		setb = n | ans
		clrb = n & ~ans
		print(getb, setb, clrb, end='')


class Solution:

	def bitManipulation(self, num, i):
		mask = 1 << i - 1
		getBit = 1 if num & mask != 0 else 0
		setBit = num | mask
		clearBit = num & ~mask
		print(getBit, setBit, clearBit, end='')


class Solution:

	def bitManipulation(self, n, i):
		i = i - 1
		get1 = 1 if n & 1 << i else 0
		set1 = n | 1 << i
		clear1 = n & ~(1 << i)
		print(get1, set1, clear1, end=' ')


class Solution:

	def bitManipulation(self, n, i):
		i -= 1
		getbit = n >> i & 1
		setbit = n | 1 << i
		clearbit = n & ~(1 << i)
		print(getbit, setbit, clearbit, end='')


class Solution:

	def bitManipulation(self, n, i):
		m = 1 << i - 1
		print(' '.join([str(int(bool(n & m))), str(n | m), str(~m & n)]), end='')


class Solution:

	def bitManipulation(self, n, i):
		bit = n & 1 << i - 1
		if bit:
			print('1', end=' ')
		else:
			print('0', end=' ')
		print(n | 1 << i - 1, end=' ')
		print(n & ~(1 << i - 1), end=' ')


class Solution:

	def bitManipulation(self, n, i):
		binary = str(bin(n)).lstrip('0b')
		length = len(binary)
		if i <= length:
			bit = binary[-i]
			print(bit, end=' ')
		else:
			bit = '0'
			print('0', end=' ')
		if bit == '1':
			print(n, end=' ')
			print(n - 2 ** (i - 1), end=' ')
		else:
			print(n + 2 ** (i - 1), end=' ')
			print(n, end=' ')


class Solution:

	def bitManipulation(self, n, pos):
		m = ['0' for i in range(pos)]
		m = m + list(bin(n)[2:])
		print(m[-pos], end=' ')
		m[-pos] = '1'
		st = ''.join(m)
		print(int(st, 2), end=' ')
		m[-pos] = '0'
		reset = ''.join(m)
		print(int(reset, 2), end=' ')


class Solution:

	def bitManipulation(self, n, i):
		ith_bit = n >> i - 1 & 1
		print(ith_bit, end=' ')
		num_set = n | 1 << i - 1
		print(num_set, end=' ')
		num_clear = n & ~(1 << i - 1)
		print(num_clear, end=' ')


class Solution:

	def bitManipulation(self, n, i):
		l = []
		if n & 1 << i - 1 != 0:
			l.append(1)
		else:
			l.append(0)
		l.append(n | 1 << i - 1)
		l.append(n & ~(1 << i - 1))
		for i in l:
			print(i, end=' ')


class Solution:

	def bitManipulation(self, n, i):
		x = n >> i - 1 & 1
		y = n | 1 << i - 1
		z = n
		if x:
			z = n ^ 1 << i - 1
		print(x, end=' ')
		print(y, end=' ')
		print(z, end=' ')


class Solution:

	def bitManipulation(self, n, i):
		b = bin(n)
		b = b.replace('b', '')
		l = len(b)
		if i > l:
			a = i - l
			b = '0' * a + b
		l = len(b)
		print(b[-i], end=' ')
		if b[-i] == '1':
			print(n, end=' ')
			b = b[:l - i] + '0' + b[l - i + 1:]
			print(int(b, 2), end=' ')
		else:
			b = b[:l - i] + '1' + b[l - i + 1:]
			print(int(b, 2), end=' ')
			print(n, end=' ')


class Solution:

	def bitManipulation(self, n, i):
		mask = 1
		temp = n
		mask = mask << i - 1
		find = mask & temp
		if find != 0:
			print(1, end=' ')
		else:
			print(0, end=' ')
		temp = n
		find = mask | temp
		print(find, end=' ')
		mask = 1
		mask = ~(mask << i - 1)
		clear = mask & temp
		print(clear, end=' ')


class Solution:

	def bitManipulation(self, n, i):
		i -= 1
		temp = n >> i
		ans = [0, 0, 0]
		if temp & 1:
			ans[0] = 1
			ans[1] = n
			ans[2] = n - (1 << i)
		else:
			ans[0] = 0
			ans[1] = n + (1 << i)
			ans[2] = n
		for answer in ans:
			print(answer, end=' ')


class Solution:

	def bitManipulation(self, num, i):
		i = i - 1
		if num & 1 << i:
			print(1, end=' ')
		else:
			print(0, end=' ')
		if num & 1 << i:
			print(num, end=' ')
		else:
			print(num | 1 << i, end=' ')
		if num & 1 << i:
			print(num ^ 1 << i, end=' ')
		else:
			print(num, end=' ')


class Solution:

	def bitManipulation(self, n, i):
		a = ''
		c = []
		m = ~(1 << i - 1)
		d = n | 1 << i - 1
		e = n & m
		b = 0
		if n & 1 << i - 1 != 0:
			b = 1
		c.append(b)
		c.append(d)
		c.append(e)
		for j in c:
			print(j, end=' ')


class Solution:

	def bitManipulation(self, n, i):
		a = n & 2 ** (i - 1)
		b = n
		c = n
		if a > 0:
			a = 1
			c = c - 2 ** (i - 1)
		if a == 0:
			b = 2 ** (i - 1) + n
		print(a, end=' ')
		print(b, end=' ')
		print(c, end=' ')


class Solution:

	def bitManipulation(self, n, i):
		c = 0
		a = []
		while c < i - 1:
			a.append(n % 2)
			n = n >> 1
			c += 1
		print(n % 2, end=' ')
		a.reverse()
		b = c = (n >> 1) * 2
		b += 1
		for i in a:
			b = b << 1
			c = c << 1
			if i == 1:
				b += 1
				c += 1
		print(b, c, end='')


class Solution:

	def bitManipulation(self, n, i):
		i -= 1
		print(n >> i & 1, n | 1 << i, n & ~(1 << i), end=' ')


class Solution:

	def bitManipulation(self, n, i):
		s = bin(n)
		s = s[2:]
		l1 = list(s)
		while len(l1) < 32:
			l1.insert(0, '0')
		l = []
		c = 0
		d = 0
		l.append(int(l1[-i]))
		if l1[-i] == '0':
			l1[-i] = '1'
			y = ''.join(l1)
			d = int(y, 2)
			l.append(d)
		else:
			y = ''.join(l1)
			f = int(y, 2)
			l.append(f)
		if l1[-i] == '0':
			y = ''.join(l1)
			f = int(y, 2)
			l.append(f)
		else:
			l1[-i] = '0'
			y = ''.join(l1)
			f = int(y, 2)
			l.append(f)
		print(*l, end='')


class Solution:

	def bitManipulation(self, n, i):
		mask = 1 << i - 1
		res = n | mask
		if res == n:
			print(1, end=' ')
		else:
			print(0, end=' ')
		print(res, end=' ')
		mask2 = ~mask
		res2 = n & mask2
		print(res2, end=' ')


class Solution:

	def bitManipulation(self, n, i):
		x = n >> i - 1
		if x & 1 == 1:
			print(1, end=' ')
		else:
			print(0, end=' ')
		y = 1 << i - 1
		res = n | y
		print(res, end=' ')
		z = ~(1 << i - 1)
		res = n & z
		print(res, end=' ')


class Solution:

	def bitManipulation(self, n, i):
		mask = 1 << i - 1
		if mask & n == 0:
			print(0, end=' ')
			a = mask | n
			print(a, end=' ')
			print(n, end=' ')
		else:
			print(1, end=' ')
			print(n, end=' ')
			print(~mask & n, end=' ')


class Solution:

	def get(self, n, i):
		i = i - 1
		mask = 1 << i
		if n & mask:
			return 1
		return 0

	def set(self, n, i):
		i = i - 1
		mask = 1 << i
		if n & mask:
			return n
		return n ^ mask

	def clear(self, n, i):
		i = i - 1
		mask = 1 << i
		if n & mask:
			return n ^ mask
		return n

	def bitManipulation(self, n, i):
		res1 = self.get(n, i)
		res2 = self.set(n, i)
		res3 = self.clear(n, i)
		print(res1, end=' ')
		print(res2, end=' ')
		print(res3, end=' ')