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.
More O(1) challenges
- The nearest tenPython · JavaScript · operations · division
- The percentage you got rightPython · JavaScript · operations · division · decimals
- The seats still freePython · JavaScript · operations · division
- The shortened textPython · JavaScript · strings · conditionals
- The sign of a numberPython · JavaScript · conditionals · comparisons
- The song in secondsPython · JavaScript · strings · operations