# Is the string uppercase?

## Task

```if-not:haskell,csharp,javascript,coffeescript,elixir,forth,go,dart,julia,cpp,reason,typescript,racket,ruby
Create a method `is_uppercase()` to see whether the string is ALL CAPS. For example:
```
```if:haskell,reason,typescript
Create a method `isUpperCase` to see whether the string is ALL CAPS. For example:
```
```if:csharp
Create an extension method `IsUpperCase` to see whether the string is ALL CAPS. For example:
```
```if:julia
Create a function `isupper` to see whether the string is ALL CAPS. For example:
```
```if:cpp
Create a function `is_uppercase()` to see whether the string is ALL CAPS. For example:
```
```if:javascript,coffeescript
Add the `isUpperCase` method to `String` to see whether the string is ALL CAPS. For example:
```
```if:elixir
Create a method `upper_case?` to see whether the string is ALL CAPS. For example:
```
```if:forth,factor
Create a word `uppercase?` to check whether a string is ALL CAPS. For example:
```
```if:go
Create a method `IsUpperCase` to see whether the string is ALL CAPS. For example:
```
```if:racket
Create a method `upcase?` to see whether the string is ALL CAPS. For example:
```
```if:ruby
Create a method `is_upcase?` to see whether the string is ALL CAPS. For example:
```

```python
is_uppercase("c") == False
is_uppercase("C") == True
is_uppercase("hello I AM DONALD") == False
is_uppercase("HELLO I AM DONALD") == True
is_uppercase("ACSKLDFJSgSKLDFJSKLDFJ") == False
is_uppercase("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.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def is_uppercase(inp):
	

Solutions:
def is_uppercase(inp):
	return inp.isupper()


def is_uppercase(inp):
	return inp.upper() == inp


is_uppercase = str.isupper


def is_uppercase(inp):
	if inp.isupper():
		return True
	else:
		return False


def is_uppercase(inf):
	return str.isupper(inf)


def is_uppercase(inp):
	from re import search
	if search('[a-z]', inp):
		return False
	return True


is_uppercase = lambda x: x.isupper()


def is_uppercase(inp):
	for c in inp:
		if c.isalpha() and ord(c) >= 97:
			return False
	return True


def is_uppercase(inp):
	if inp == inp.upper() or len(inp) == 0:
		return True
	else:
		return False


def is_uppercase(stg):
	return not any((c.islower() for c in stg))


def is_uppercase(inp):
	for s in inp:
		if s.isalpha() and (not s.isupper()):
			return False
	return True


is_uppercase = lambda s: s.isupper()


def is_uppercase(inp):
	return not len(set(inp).intersection(set('abcdefghijklmnopqrstuvwxyz')))


class Word:

	def __init__(self, string=None):
		self.string = string

	def isup(self, string):
		if ord(string) - 96 > 0:
			if not string.isalpha():
				return True
			return False
		return True

	def is_upper(self):
		string = self.string
		for i in range(len(string)):
			if not self.isup(string[i]):
				return False
		return True

def is_uppercase(string):
	a = Word(string)
	return a.is_upper()


is_uppercase = lambda x: any((97 <= ord(i) <= 122 for i in x)) == False


def is_uppercase(inp):
	caps = inp.upper()
	if caps == inp:
		return True
	else:
		return False


def is_uppercase(inp):
	return not set(inp) & set('abcdefghijklmnopqrstuvwxyz')


is_uppercase = lambda inp: inp.isupper()


def is_uppercase(inp):
	for i in inp:
		if i in 'abcdefghijklmnopqrstuvwxyz':
			return False
	return True


def is_uppercase(inp):
	is_char = [c for c in inp if ord(c) >= 65 and ord(c) <= 90 or (ord(c) >= 97 and ord(c) <= 122)]
	return all([c.isupper() for c in is_char])


def is_uppercase(inp):
	tv = True
	for x in range(0, len(inp)):
		if inp[x] > 'a' and inp[x] < 'z':
			tv = False
	return tv


def is_uppercase(inp):
	count = 0
	letters = list(inp)
	for x in letters:
		if count < len(letters):
			if x.islower():
				return False
			if x.isupper():
				count += 1
				if x.islower():
					return False
	return True


def is_uppercase(inp):
	for I in inp:
		if ord(I) >= 97 and ord(I) <= 122:
			return False
	return True


def is_uppercase(inp):
	return inp.lower() == inp.swapcase()


def is_uppercase(inp):
	for c in inp:
		if c.isalpha() and c == c.lower():
			return False
	return True


def is_uppercase(inp):
	return True if sum([ord(x) > 96 for x in inp if x.isalpha()]) == 0 else False


def is_uppercase(inp):
	for x in inp:
		if x in 'abcdefghijklmnopqrstuvwxyz':
			return False
	return True


def is_uppercase(inp):
	return False if isinstance(inp, int) else inp.isupper()


def is_uppercase(inp: str) -> bool:
	for i in inp.split():
		if i.isupper():
			return True
		return False


def is_uppercase(inp):
	new_inp = ''
	for char in inp:
		if char == char.upper():
			new_inp += char
	if len(inp) == len(new_inp):
		return True
	else:
		return False


def is_uppercase(inp):
	compare = inp.upper()
	if compare == inp:
		return True
	else:
		return False


import re

def is_uppercase(inp):
	pat = '[^a-z]'
	if all((re.match(pat, str) for str in inp)):
		return True
	else:
		return False


import string as str

def is_uppercase(inp):
	res = str.ascii_uppercase + ' '
	ret = ' '
	for i in inp:
		if i in res or i in str.punctuation or i in str.digits:
			ret = True
		else:
			ret = False
			break
	return ret


def is_uppercase(inp):
	strn = ''
	if inp == inp.upper():
		strn = True
	else:
		strn = False
	return strn


def is_uppercase(inp):
	for i in inp:
		if i.islower():
			return False
	return True
print(is_uppercase('LD'))


def is_uppercase(inp):
	for letter in inp:
		if letter.isupper() == False and letter.isalpha() == True:
			return False
		else:
			continue
	return True


def is_uppercase(inp):
	if '@' in inp:
		newstr = inp.replace('@', '')
	return inp.isupper()


def is_uppercase(inp):
	for elem in inp:
		if elem in 'abcdefghijklmnopqrstuvwxyz':
			return False
	return True


def is_uppercase(inp):
	uppers = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
	lowers = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
	x = 0
	for case in lowers:
		if case in inp:
			x += 1
	if x != 0:
		return False
	else:
		return True


def is_uppercase(inp):
	return True if inp.isupper() and type(inp) is str else False


import copy

def is_uppercase(inp):
	return inp == copy.copy(inp).upper()


def is_uppercase(inp):
	return False if any([x.islower() for x in inp]) else True


def is_uppercase(inp):
	ans = ''
	for x in inp:
		if x.isalpha() == True:
			ans = ans + x
	return ans.isupper()


def is_uppercase(inp):
	try:
		return inp.isupper()
	except not inp.isalpha():
		return True


def is_uppercase(inp):
	return not any((True for c in inp if c.isalpha() and (not c.isupper())))


from re import search

def is_uppercase(inp):
	return not search('[a-z]', inp)


def is_uppercase(s):
	return all((c == c.upper() for c in s))


def is_uppercase(inp):
	a = [c for c in inp if c.islower()]
	return False if a else True


def is_uppercase(inp):
	if inp.isupper() or len(inp) == 0:
		return True
	return False


def is_uppercase(inp):
	return all([i == i.upper() for i in inp])


def is_uppercase(inp):
	for i in inp:
		if i.isupper() == False and i.isalpha() == True:
			return False
	return True


def is_uppercase(inp):
	inp = str(inp)
	if inp.isupper() == True:
		return True
	if inp.isupper() == False:
		return False


def is_uppercase(inp):
	for i in range(len(inp)):
		ascii = ord(inp[i])
		if 97 <= ascii <= 122:
			return False
	return True


def is_uppercase(inp):
	upper = inp.upper()
	if upper == inp:
		return True
	return False


def is_uppercase(inp):
	inp = list(map(str, inp.split()))
	for element in inp:
		if not element.isupper():
			return False
	return True


import string

def is_uppercase(inp):
	for c in inp:
		return inp.isupper()


def is_uppercase(inp):
	if inp == '?' or inp == '+':
		return True
	return inp.isupper()


def is_uppercase(inp):
	for e in inp:
		if e.isalpha():
			if e.islower():
				return False
	return True


def is_uppercase(inp):
	return all((i.isupper() for i in ''.join(inp).split()))


def is_uppercase(inp):
	r = True
	for c in inp:
		if c.islower():
			r = False
			break
	return r


def is_uppercase(inp):
	print(inp)
	return str(inp).isupper()


def is_uppercase(inp):
	for i in inp:
		if inp != inp.upper():
			return False
	else:
		return True


def is_uppercase(inp):
	for c in inp:
		if c.isalpha() and c.islower():
			return False
	else:
		return True


def is_uppercase(inp):
	return True if len(list(filter(lambda char: char.islower(), inp))) == 0 else False


def is_uppercase(inp):
	count = 0
	my_inp = inp.replace(' ', '')
	for i in my_inp:
		if i.isupper() and i.isalpha():
			count += 1
		elif not i.isalpha():
			count += 1
	if count == len(my_inp):
		return True
	return False


def is_uppercase(inp):
	return all((i == True for i in inp.replace(' ', '') if i == i.lower() and i.isalpha()))


def is_uppercase(inp):
	return not [char for char in inp if char.islower()]


def is_uppercase(inp):
	inp = inp.replace(' ', '')
	inp = ''.join(filter(str.isalpha, inp))
	sum1 = sum((1 for c in inp if c.isupper()))
	if sum1 == len(inp):
		return True
	else:
		return False


def is_uppercase(inp):
	if inp.isupper():
		return True
	else:
		return False
print(is_uppercase(inp='AMOR'))


def is_uppercase(inp):
	if len(inp) > 0:
		return inp.isupper()
	else:
		return True


def is_uppercase(inp):
	inp_1 = inp
	return inp == inp_1.upper()


def is_uppercase(inp):
	return inp.isupper() if any((i.isalpha() for i in inp)) else True


def is_uppercase(inp):
	return sum([not i.isupper() for i in inp if i.isalpha()]) == 0


def is_uppercase(inp):
	for i in range(len(inp)):
		if inp[i].islower() == True:
			return False
	return True


from operator import methodcaller

def is_uppercase(inp):
	upper = methodcaller('isupper')
	return upper(inp)


def is_uppercase(inp):
	if inp.isupper():
		return True
	print(inp)
	return False


def is_uppercase(inp):
	return all((i.isupper() for i in inp.replace(' ', '') if i.isalpha()))


import string

def is_uppercase(inp):
	return inp.isupper() and inp not in string.punctuation or inp.isnumeric()


def is_uppercase(inp):
	if inp.isupper() or inp == int():
		return True
	else:
		return False


def is_uppercase(inp):
	return inp.isupper() if len(inp) > 0 else False


def is_uppercase(inp):
	result = []
	for i in inp:
		if i.isalpha() == True and i.isupper() != True:
			return False
		else:
			result.append(True)
	return bool(result)


def is_uppercase(inp):
	count_lower = 0
	for i in inp:
		if i.islower():
			count_lower += 1
	if count_lower > 0:
		return False
	else:
		return True


def is_uppercase(inp):
	for i in inp:
		if i in 'qwertyuiopasdfghjklzxcvbnm':
			return False
	return True


def is_uppercase(inp):
	a = inp.upper()
	return a == inp


def is_uppercase(inp):
	return all((i.isupper() for i in inp if i != ' ' and (not i.isdigit()) and i.isalpha()))