going-flying.com gemini git repository
fdd7555a0f71e86e65f6a238c31cd5c07ef4286f - Matthew Ernisse - 1612579870
why not have a little fun
diff --git a/cgi-bin/converter b/cgi-bin/converter index a56513d..ef680bf 100755 --- a/cgi-bin/converter +++ b/cgi-bin/converter @@ -107,6 +107,18 @@ Display a number in binary, decimal and hexadecimal. If your input cannot be re ''') +def ender(i): + s = { + 42: 'Life, The Universe, and Everything', + 69: 'Nice', + 420: 'Nice', + 1701: 'The Final Frontier', + 2257: 'The dawn of the third age', + } + + return f' ({s[i]})\n\n' if i in s.keys() else '\n\n' + + def pretty_binary(i): j = bin(i)[2:] out = [] @@ -128,7 +140,7 @@ def result_table(cgi, input, b, d, h): output = f'# Input\n{input}\n\n' output += f'## Binary Representation\n{b}\n\n' - output += f'## Decimal Representation\n{d}\n\n' + output += f'## Decimal Representation\n{d}{ender(d)}' output += f'## Hexadecimal Representation\n0x{h}\n\n' output += f'=> {BACK_LINK} Back\n' output += f'=> / Home'