Befunge-98Befunge-98*, 19 bytes
&:39*\`'`\j;+39*\`'@\j;+,@;-.@
Because the question said you'll receive a 1-26
or an aA-zZ
I assumed this meant the number 26 or the character aA-zZ. Most interprets struggle with entering alt-codes, so it is easier to use &
and enter values like 126 for 26 or 9790 for 'a' instead of with ~'Z', as opposed to ~
.
Pseudo-code
varint c = get stdin
push the value of `'`27
bool is_number = 27 > c
push the value of `@` (9664)
if 27is_number >== c1
jump to adding 9664 to c //putting it the ASCII range
print as ASCII
end
else
jump to subtracting 9664 from c //putting it in the numerical range
print as number
end
Test it out (on Windows) here!
*This is technically Unefunge-98 because it only uses 1 dimension, but that name might be unfamiliar.