Git Product home page Git Product logo

roman-numerals-challenge's Introduction

General Assembly Logo

Roman Numeral Challenge

Write code to convert back and forth between Arabic numerals (e.g. 23) and strings representing Roman numerals (e.g. "XXIII").

Prerequisites

  • Python

Instructions

  1. Fork and clone this repository.
  2. Change into the new directory.
  3. Install dependencies.
  4. Create and checkout a new branch to work on.
  5. Fulfill the listed requirements.

For reference:

Language Install Dependencies Run Linter Run Tests
JavaScript npm install grunt nag grunt test
Ruby bundle install rubocop rspec spec
Python pip install -r ... pep8 mamba

JavaScript, Ruby, and Python starter code is available in lib/challenge.js, lib/challenge.rb, and lib/challenge.py, respectively. A pull request is not required, but it is necessary if you want a code review.

You may wish to refer to FAQs related to forking, cloning.

Requirements

In either Ruby or JavaScript, implement arabic_to_roman (arabicToRoman in JavaScript), a method/function that converts arabic numbers to strings of characters representing Roman numerals. It's worth noting that in Roman numerals, there is no way to represent either zero, negative numbers, or fractions, so if the input is any of these (or any other obviously invalid input), arabic_to_roman should return null/nil.

Once you've successfully met all requirements in your language of choice, implement that same solution in Python.

You should be running the appropriate linter before diagnosing any bugs, since linters find some of the most common sources of errors. After your linter passes, you should run the corresponding test command to run the included tests. Tests will tell you whether or not you've met these requirements.

You're welcome to view and work on the original challenge on CodeWars.

Bonus

Once you've implemented arabic_to_roman, implement the inverse method, roman_to_arabic, in either Ruby or JavaScript. As with arabic_to_roman, you'll need to do some input validation -- if you receive any strings that don't follow the rules of Roman numerals (e.g. no more than three of the same character in a row) or are otherwise obviously invalid, return null/nil. Also: be sure to set xdescribe to describe in your test file, so that the tests for roman_to_arabic will also run.

Finally, do this process again in Python, un-hiding the appropriate tests in challenge_spec.py.

  1. All content is licensed under a CC­BY­NC­SA 4.0 license.
  2. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].

roman-numerals-challenge's People

Contributors

ga-meb avatar bengitscode avatar bernardlee avatar jrhorn424 avatar laurenfazah avatar

Watchers

James Cloos 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.