I want a code in python, to convert binary to decimal
however i want the user the choose which way to convert the number(i.e, binary to decimal or decimal to binary)

thank you

We cannot simply give you code; that would be cheating. However, I can offer you the algorithm which you can use; I'm a bit short on time right now, but I should be able to get back to you in a couple of hours.

Take a look at the 'struct' module.

bin standard function might also be usefull as well as looking to the Code Snippets of certain active members.