Position in the Alphabet

Published by Joshua Señoron in

Given a number between 1-26, return what letter is at that position in the alphabet. Return "invalid" if the number given is not within that range, or isn't an integer.

Examples

letter_at_position(1) ➞ "a"

letter_at_position(26.0) ➞ "z"

letter_at_position(0) ➞ "invalid"

letter_at_position(4.5) ➞ "invalid"

Notes

  • Return a lowercase letter.
  • Numbers that end with ".0" are valid.
Watch a quick demo on how Edabit works.