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

Recommended Answers

All 3 Replies

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.