The name, written right
- O(1) · Trivial
- Free
- Python
- JavaScript
- strings
Problem
People type their name however it comes out: aNN, PETER, lucy. Write a function that takes a name (at least one letter) and returns it with the first letter uppercase and everything else lowercase:
with "aNN" you return "Ann".
If the name is a single letter, you return that letter in uppercase.
Examples
"aNN" → "Ann"
"PETER" → "Peter"
"lucy" → "Lucy"
Already written right
"Grace" → "Grace"
Besides these, the challenge has hidden tests that are revealed when you submit your solution.
You start with this
Python
def name_case(name):
passJavaScript
function nameCase(name) {
}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.