Given an n-bit binary number and two bit indices
j, where the
0thindex is the least significant bit, and
nis the most significant bit.
Write a function that swaps the input's bits
jand returns the resulting number.
For example, given the following inputs:
num = 12 # binary: 1100i = 1j = 3
Your function should return
6, or the binary number
Use the decimal-to-binary converter below and run through additional examples.