Nice, but I think there are a few edge cases you might consider handling:
Empty inputs return 0 (I guess that could work).
Inputs that don't actually miss a letter will return the ASCII code of the last element.
One element inputs return the ASCII code of the only letter (just a special case of the previous point really).
In other words, is returning the character representation of last really a sensible default if the input does not have a missing letter, either due to length or contents?
Meaning, slice is always valid, always has length of at least 2, always has exactly one character missing, and all the characters will be of the same case.
My solution includes no consideration for these edge cases since within the context of this challenge, those edge cases don't exist.
Sure, was just trying to have a discussion. Generally the problems in these challenges are not particularly interesting by themselves, but that doesn't mean one can't turn them into a learning experience by e.g. doing more than what was specified.
Nice, but I think there are a few edge cases you might consider handling:
In other words, is returning the character representation of
last
really a sensible default if the input does not have a missing letter, either due to length or contents?Its not but I didn't really have much time for this at the time. So I implemented it within the context of the challenge as specified
Meaning, slice is always valid, always has length of at least 2, always has exactly one character missing, and all the characters will be of the same case.
My solution includes no consideration for these edge cases since within the context of this challenge, those edge cases don't exist.
Sure, was just trying to have a discussion. Generally the problems in these challenges are not particularly interesting by themselves, but that doesn't mean one can't turn them into a learning experience by e.g. doing more than what was specified.
Oh no of course, you are right and I agree with all the points you made.