8 kyu
8kyu interpreters: HQ9+
3,624 of 11,882Voile
Description:
You task is to implement an simple interpreter for the notorious esoteric language HQ9+ that will work for a single character input:
- If the input is
'H'
, return'Hello World!'
- If the input is
'Q'
, return the input - If the input is
'9'
, return the full lyrics of 99 Bottles of Beer. It should be formatted like this:
99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 98 bottles of beer on the wall.
98 bottles of beer on the wall, 98 bottles of beer.
Take one down and pass it around, 97 bottles of beer on the wall.
97 bottles of beer on the wall, 97 bottles of beer.
Take one down and pass it around, 96 bottles of beer on the wall.
...
...
...
2 bottles of beer on the wall, 2 bottles of beer.
Take one down and pass it around, 1 bottle of beer on the wall.
1 bottle of beer on the wall, 1 bottle of beer.
Take one down and pass it around, no more bottles of beer on the wall.
No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.
- For everything else, don't return anything (return
null
in C#,None
in Rust, and""
in Haskell).
(+
has no visible effects so we can safely ignore it.)
Fundamentals
Similar Kata:
Stats:
Created | May 12, 2017 |
Published | May 12, 2017 |
Warriors Trained | 21619 |
Total Skips | 1057 |
Total Code Submissions | 42400 |
Total Times Completed | 11882 |
JavaScript Completions | 3845 |
Python Completions | 3624 |
Ruby Completions | 317 |
Crystal Completions | 22 |
C# Completions | 1029 |
PHP Completions | 687 |
Rust Completions | 558 |
Java Completions | 2007 |
Haskell Completions | 178 |
R Completions | 102 |
Lua Completions | 16 |
Total Stars | 184 |
% of votes with a positive feedback rating | 66% of 2123 |
Total "Very Satisfied" Votes | 1173 |
Total "Somewhat Satisfied" Votes | 442 |
Total "Not Satisfied" Votes | 508 |
Total Rank Assessments | 69 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |