GithubHelp home page GithubHelp logo

angeldollface / groucho Goto Github PK

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

Convert between numbers of different bases. :guitar: :snake:

Home Page: https://github.com/angeldollface/groucho

License: MIT License

Python 100.00%
base-10 base-16 base-2 marx mit-license python-3 python-lib python-library

groucho's Introduction

GROUCHO ๐ŸŽธ ๐Ÿ

GitHub CI

Convert between numbers of different bases. ๐ŸŽธ ๐Ÿ

ABOUT ๐Ÿ“š

Roughly a year ago, I set myself the challenge of implementing a set of functions that could convert between numbers of different bases. I implemented this in Dart and Javascript.I then decided to re-write this implementation in Python 3. The Dart implementation can be found here and the Javascript implementation here. The bases this library handles are: base 10, base 2, and base 16.

USAGE ๐Ÿ”จ

REQUIREMENTS

You should have the following tools installed and available from the command line:

INSTALLING GROUCHO ON YOUR SYSTEM

To use Groucho on your own system with your own projects, run the following command:

python -m pip install git+https://github.com/angeldollface/groucho

IMPORTING GROUCHO

To import Groucho's functions into your Python code, add this line to the top of your code:

from groucho import *

API

  • reverse_array(array): Reverses the order of an array and returns the reversed array.
  • letter_index(letter): Gets the index of a letter in the alphabet. Returns zero if the letter isn't in the alphabet.
  • get_letter_from_index(index): Gets the letter from a supplied index. Returns an empty string if a letter cannot be found.
  • bin_to_dec(binaryNumber): Converts a base 2 number as a string to a base 10 number as an integer.
  • dec_to_bin(decimalNumber): Converts a base 10 number as an integer to a base 2 number as a string.
  • hex_to_dec(hexNumber): Converts a base 16 number as a string to a base 10 number as an integer.
  • is_bin(expr): Checks whether the supplied number string is a binary number and returns a boolean based on this.
  • is_int(expr): A function to check whether a string is an integer. Returns a boolean.

TEST THE EXAMPLE

To test the included example in the folder example, execute the following steps:

  • 1.) Clone this repository to your machine:
git clone https://github.com/angeldollface/groucho
  • 2.) Change directory into the repository's root:
cd groucho
  • 3.) Change directory into the example folder:
cd example
  • 4.) Install the example's dependencies:
python -m pip install -r requirements.txt
  • 5.) Run the example:
python main.py

CHANGELOG โœ’๏ธ

Version 1.0.0

  • Initial release.
  • Upload to GitHub.
  • Getting re-acquainted with the Python eco system.

NOTE ๐Ÿ“œ

  • Groucho ๐ŸŽธ ๐Ÿ by Alexander Abraham ๐Ÿ–ค a.k.a. "Angel Dollface" ๐ŸŽŽ ๐ŸŽ€
  • Licensed under the MIT license.

groucho's People

Contributors

angeldollface avatar

Watchers

 avatar

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.