Coder Social home page Coder Social logo

fcoagz / code-binary-system Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 2 KB

Es un algoritmo que te permite convertir números decimales a binarios y viceversa.

Home Page: https://pypi.org/project/binary-system

Python 100.00%
binary binary-system python

code-binary-system's Introduction

code-binary-system

Esto lo he hecho con fines educativo cuando estaba en clases de Arquitectura del Computador y quise realizar mi propio algoritmo.

Te permite convertir números decimales a binarios y viceversa.

Instalación

pip install binary_system

Uso

Para convertir un número decimal a binario, se puede llamar a la función number_to_binary() y proporcionar el número como argumento. La función devolverá una cadena de texto que representa el número en su forma binaria.

from binary_system import Binary

binary = Binary()
result = binary.number_to_binary(10) # Convierte el número 10 a binario
print(result) # Imprime "1010"

Para convertir un número binario a decimal, se puede llamar a la función binary_to_number() y proporcionar la cadena de texto binaria como argumento. La función devolverá el número decimal correspondiente.

from binary_system import Binary

binary = Binary()
result = binary.binary_to_number('1010') # Convierte la cadena de texto "1010" a decimal
print(result) # Imprime "10"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.