https://www.codewars.com/kata/56cd44e1aa4ac7879200010b
DESCRIPTION:
Is the string uppercase?
Task
Create a method to see whether the string is ALL CAPS.
Examples (input -> output)
"c" -> False
"C" -> True
"hello I AM DONALD" -> False
"HELLO I AM DONALD" -> True
"ACSKLDFJSgSKLDFJSKLDFJ" -> False
"ACSKLDFJSGSKLDFJSKLDFJ" -> True
In this Kata, a string is said to be in ALL CAPS whenever it does not contain any lowercase letter so any string containing no letters at all is trivially considered to be in ALL CAPS.
코드
JavaScript
String.prototype.isUpperCase = function() {
return this.toString() === this.toUpperCase();
}
Python
def is_uppercase(inp):
return inp == inp.upper()
'알고리즘 > Codewars' 카테고리의 다른 글
[Codewars] Form The Minimum (7 kyu) / JavaScript (0) | 2023.03.23 |
---|---|
[Codewars] Grasshopper - Terminal game combat function (8 kyu) / JavaScript (0) | 2023.03.22 |
[Codewars] Vowel remover (8 kyu) / JavaScript (0) | 2023.03.20 |
[Codewars] Find the position! (8 kyu) / JavaScript (0) | 2023.03.19 |
[Codewars] Training JS #2: Basic data types--Number (8 kyu) / JavaScript (0) | 2023.03.18 |
댓글