You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Code golf is a type of recreational computer programming competition in which participants strive to achieve the shortest possible source code that solves a certain problem. Code golf challenges and tournaments may also be named with the programming language used. --- [Wikipedia](https://en.wikipedia.org/wiki/Code_golf)
4
+
5
+
# Rules
6
+
7
+
1. Submit code you wrote. Don't reuse someone else's code.
8
+
2.**NO AI**
9
+
3. Don't Google/Bing/DDG/Kagi for answers.
10
+
4. All pull requests must be opened before Aug 14 2025 11:30 AM EDT.
11
+
12
+
13
+
The shortest _correct_ program wins. In the event no submissions fully pass the test suite winners will be selected by number of passing test cases and code brevity.
14
+
15
+
## Supported Languages
16
+
17
+
* C#
18
+
* Python
19
+
* Go
20
+
* Typescript/Javascript
21
+
22
+
# The Problem
23
+
24
+
Convert numbers written with Arabic numerals into Roman numerals.
25
+
26
+
| Arabic | Roman |
27
+
| -----: | ----: |
28
+
| 1 | I |
29
+
| 2 | II |
30
+
| 3 | III |
31
+
| 4 | IV |
32
+
| 5 | V |
33
+
| 10 | X |
34
+
| 20 | XX |
35
+
| 25 | XXV |
36
+
| 30 | XXX |
37
+
| 40 | XL |
38
+
| 50 | L |
39
+
| 100 | C |
40
+
| 200 | CC |
41
+
| 400 | CD |
42
+
| 500 | D |
43
+
| 1000 | M |
44
+
45
+
## Example Conversions
46
+
47
+
`27`→`XXVII`
48
+
49
+
`238`→`CCXXXVIII`
50
+
51
+
`2019`→`MMXIX`
52
+
53
+
# Submission Requirements
54
+
55
+
All submissions should expect to be invoked from the command line with a single argument, the path to a text file. This file will contain 5 numbers written using Arabic numerals. Numbers are separated by a newline (`\n`). Submissions are expected to iterate over the numbers printing the Roman numeral translation for each to the console/stdout.
56
+
57
+
## Example
58
+
59
+
```python
60
+
import sys
61
+
62
+
63
+
defmain():
64
+
# Exit with error status if no filename provided
65
+
iflen(sys.argv) <1:
66
+
print("Filename missing!")
67
+
sys.exit(1)
68
+
69
+
print(f"Input file: {sys.argv[0]}")
70
+
# Open the file for reading
71
+
withopen(sys.argv[1], "r") as fd:
72
+
line = fd.readline().strip()
73
+
while line !="":
74
+
# Convert line to Roman numeral
75
+
print(line)
76
+
line = fd.readline().strip()
77
+
78
+
79
+
if__name__=="__main__":
80
+
main()
81
+
```
82
+
83
+
This repo contains a [sample file](https://github.com/kevsmith/code_golf/blob/main/input.txt) you can use for development.
0 commit comments