Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* @Coding-Cuddles/kata-maintainers
/.github/CODEOWNERS @Coding-Cuddles/kata-maintainers
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
[![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

Implement conversions between Arabic numerals and Roman numerals in Python 3.11
or later with pytest. Setup is complete when the existing starter test passes.

## Overview

This kata complements [Clean Code: Advanced TDD, Ep. 19](https://cleancoders.com/episode/clean-code-episode-19-p1).
Expand All @@ -13,8 +16,8 @@ test-driven development.

## Instructions

Roman numerals are a numeral system that was used by ancient Rome. Numbers in
this system use letters from the Latin alphabet. Currently, it uses seven symbols:
Roman numerals are a numeral system used in ancient Rome. Numbers in this
system use seven letters from the Latin alphabet:

| Symbol | Value |
|:-------|-------|
Expand All @@ -26,30 +29,29 @@ this system use letters from the Latin alphabet. Currently, it uses seven symbol
| D | 500 |
| M | 1000 |

Instead of writing the same letter four times, a rule for subtraction is used:
the letter is written once, then the next largest Roman numeral is written.
Instead of writing the same letter four times, a subtraction rule is used: the
letter is written once, followed by the next larger Roman numeral.
For example, 4 is not written as IIII, but instead as IV, because IV is V (5)
minus I (1).

In general, the values for 5, 50, and 500 are not subtracted.

### Exercise 1

The task at hand entails crafting a function `to_roman(number: int) -> str` to
convert regular Arabic numbers into Roman numerals, such as:
Implement `to_roman(number: int) -> str` to convert Arabic numerals into Roman
numerals, such as:

- 4 → IV
- 7 → VII
- 9 → IX

The lowest number you can write in Roman Numerals is number I (1). And the
largest numeral is MMMCMXCIX (3999).
The smallest supported number is 1 (`I`), and the largest is 3999
(`MMMCMXCIX`).

### Exercise 2

In this phase, the objective is to develop a function `from_roman(number: str)
-> int` that performs the reverse conversion, transforming Roman numerals into
their corresponding Arabic digits.
Implement `from_roman(number: str) -> int` to perform the reverse conversion
from Roman numerals to Arabic numerals.

## Guiding principles

Expand Down