The last character
- O(1) · Trivial
- Free
- Python
- JavaScript
- strings
Problem
Write a function that takes a text (with at least one character) and returns its last character.
Examples
"hello" → "o"
"x" → "x"
"Python" → "n"
Besides these, the challenge has hidden tests that are revealed when you submit your solution.
You start with this
Python
def last_char(text):
passJavaScript
function lastChar(text) {
}Solve this challenge
It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.