Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

roman-numerals/solution.go: 4 prints IIII and 1994 prints MDCCCCLXXXXIIII (no subtractive forms)

Aberta
#25 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@tanujb03 já está trabalhando nisso.

Desde 10/10/2026.

  • #28 de @tanujb03 — aberto
  • #34 de @VatsalRaina01 — aberto

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
25/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
go, python
Domínio
cli

Direção de pesquisa

The bug is in problems/roman-numerals/solution.go, which emits additive forms like IIII and VIIII; problems/roman-numerals/solution.py already gives MCMXCIV for 1994 and is a reference. Add the subtractive inputs (3, 8, 2026, 1500, 3888) to cases.txt and run python3 run.py roman-numerals. Done means the Go output matches the README examples. Two open pull requests (#28, #34) already target this, so check them before starting.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

bug good first issue

What I did

  1. Fresh checkout of main, Go installed.
  2. Run the Go solution on the README's own examples:
echo 4    | go run problems/roman-numerals/solution.go
echo 9    | go run problems/roman-numerals/solution.go
echo 40   | go run problems/roman-numerals/solution.go
echo 1994 | go run problems/roman-numerals/solution.go
echo 3999 | go run problems/roman-numerals/solution.go
  1. For comparison, the Python solution on the same inputs:
echo 1994 | python3 problems/roman-numerals/solution.py

What I expected
The problem README says: "Use the subtractive forms: 4 is IV, 9 is IX, 40 is XL, 90 is XC, 400 is CD and 900 is CM. So 1994 is MCMXCIV." (problems/roman-numerals/README.md)

So IV, IX, XL, MCMXCIV and MMMCMXCIX.

What happened instead

4    -> IIII
9    -> VIIII
40   -> XXXX
1994 -> MDCCCCLXXXXIIII
3999 -> MMMDCCCCLXXXXVIIII

The Python solution prints MCMXCIV for 1994. The Go solution is wrong for 1952 of the numbers from 1 to 3999. python3 run.py roman-numerals passes today only because cases.txt does not include any input that needs a subtractive form (3, 8, 2026, 1500, 3888).

Environment
code-corner main @ 81bb5dc, Go 1.27, Windows 11.

I'd like to work on the fix for this, and add the failing inputs to cases.txt as the Contributing section asks.

Linguagem predominante
Python
Estrelas
1
Forks
6
Merge médio
12h 42min
PRs com merge (30d)
10

Preparar o ambiente

  • Sem Dockerfile nem arquivo Docker Compose
  • Tem um modelo de pull request
  • Sem guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de techcsispit/code-corner

Todas as issues de techcsispit/code-corner

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.