Python has built-in string validation methods for basic data. It can check if a string is composed of alphabetical characters, alphanumeric characters, digits, etc.

str.isalnum() 

This method checks if all the characters of a string are alphanumeric (a-z, A-Z and 0-9).

>>> print 'ab123'.isalnum()
True
>>> print 'ab123#'.isalnum()
False

str.isalpha() 

This method checks if all the characters of a string are alphabetical (a-z and A-Z).

>>> print 'abcD'.isalpha()
True
>>> print 'abcd1'.isalpha()
False

str.isdigit() 

This method checks if all the characters of a string are digits (0-9).

>>> print '1234'.isdigit()
True
>>> print '123edsd'.isdigit()
False

str.islower() 

This method checks if all the characters of a string are lowercase characters (a-z).

>>> print 'abcd123#'.islower()
True
>>> print 'Abcd123#'.islower()
False

str.isupper() 

This method checks if all the characters of a string are uppercase characters (A-Z).

>>> print 'ABCD123#'.isupper()
True
>>> print 'Abcd123#'.isupper()
False

Task

You are given a string $\mbox{S}$. 

Your task is to find out if the string $\mbox{S}$ contains: alphanumeric characters, alphabetical characters, digits, lowercase and uppercase characters. 

Input Format

A single line containing a string $\mbox{S}$.

Constraints

$0<len(S)<1000$

Output Format

In the first line, print True if $\mbox{S}$ has any alphanumeric characters. Otherwise, print False. 

In the second line, print True if $\mbox{S}$ has any alphabetical characters. Otherwise, print False. 

In the third line, print True if $\mbox{S}$ has any digits. Otherwise, print False. 

In the fourth line, print True if $\mbox{S}$ has any lowercase characters. Otherwise, print False. 

In the fifth line, print True if $\mbox{S}$ has any uppercase characters. Otherwise, print False.  

Sample Input
qA2

Sample Output
True
True
True
True
True

Difficulty: EASY
Tags: String algorithms

Starter code:

Solutions:
string = input()
check_funcs = ['isalnum', 'isalpha', 'isdigit', 'islower', 'isupper']
for func in check_funcs:
	print(any((getattr(char, func)() for char in string)))


inp = input()
flag = 0
for x in inp:
	if x.isalnum():
		flag = 1
		break
if flag == 1:
	print(True)
else:
	print(False)
flag = 0
for x in inp:
	if x.isalpha():
		flag = 1
		break
if flag == 1:
	print(True)
else:
	print(False)
flag = 0
for x in inp:
	if x.isdigit():
		flag = 1
		break
if flag == 1:
	print(True)
else:
	print(False)
flag = 0
for x in inp:
	if x.islower():
		flag = 1
		break
if flag == 1:
	print(True)
else:
	print(False)
flag = 0
for x in inp:
	if x.isupper():
		flag = 1
		break
if flag == 1:
	print(True)
else:
	print(False)


def check(s, func):
	for c in s:
		if func(c):
			return True
	return False
s = input()
print(check(s, str.isalnum))
print(check(s, str.isalpha))
print(check(s, str.isdigit))
print(check(s, str.islower))
print(check(s, str.isupper))


s = input()
a = b = c = d = e = 0
for i in range(0, len(s)):
	if s[i].isalnum() == True:
		a = 1
	if s[i].isalpha() == True:
		b = 1
	if s[i].isdigit() == True:
		c = 1
	if s[i].islower() == True:
		d = 1
	if s[i].isupper() == True:
		e = 1
if a == 1:
	print('True')
else:
	print('False')
if b == 1:
	print('True')
else:
	print('False')
if c == 1:
	print('True')
else:
	print('False')
if d == 1:
	print('True')
else:
	print('False')
if e == 1:
	print('True')
else:
	print('False')


s = input()
print(any([x for x in s if x.isalnum()]))
print(any([x for x in s if x.isalpha()]))
print(any([x for x in s if x.isdigit()]))
print(any([x for x in s if x.islower()]))
print(any([x for x in s if x.isupper()]))


def __starting_point():
	s = input()
	print(any((char.isalnum() for char in s)))
	print(any((char.isalpha() for char in s)))
	print(any((char.isdigit() for char in s)))
	print(any((char.islower() for char in s)))
	print(any((char.isupper() for char in s)))
__starting_point()


def isfunc(string, func):
	for i in range(len(string)):
		if func(string[i]) == True:
			return True
	return False

def isalpha(s):
	return s.isalpha()

def isalnum(s):
	return s.isalnum()

def isdigit(s):
	return s.isdigit()

def islower(s):
	return s.islower()

def isupper(s):
	return s.isupper()
s = input()
print(isfunc(s, isalnum))
print(isfunc(s, isalpha))
print(isfunc(s, isdigit))
print(isfunc(s, islower))
print(isfunc(s, isupper))


text = input()
print(any([char.isalnum() for char in text]))
print(any([char.isalpha() for char in text]))
print(any([char.isdigit() for char in text]))
print(any([char.islower() for char in text]))
print(any([char.isupper() for char in text]))


def hasalnum(string):
	for character in string:
		if character.isalnum():
			return True
	return False

def hasalpha(string):
	for character in string:
		if character.isalpha():
			return True
	return False

def hasdigit(string):
	for character in string:
		if character.isdigit():
			return True
	return False

def haslower(string):
	for character in string:
		if character.islower():
			return True
	return False

def hasupper(string):
	for character in string:
		if character.isupper():
			return True
	return False
S = str(input())
print(hasalnum(S))
print(hasalpha(S))
print(hasdigit(S))
print(haslower(S))
print(hasupper(S))


inputStr = input()
hasAplhaNumeric = 'False'
hasAlpha = 'False'
hasDigit = 'False'
hasLower = 'False'
hasUpper = 'False'
for ch in inputStr:
	if ch.isalnum():
		hasAplhaNumeric = 'True'
	if ch.isalpha():
		hasAlpha = 'True'
	if ch.isdigit():
		hasDigit = 'True'
	if ch.islower():
		hasLower = 'True'
	if ch.isupper():
		hasUpper = 'True'
print(hasAplhaNumeric, hasAlpha, hasDigit, hasLower, hasUpper, sep='\n')


s = input()
flag1 = 0
flag2 = 0
flag3 = 0
flag4 = 0
flag5 = 0
for i in s:
	if i.isalnum():
		flag1 = 1
	if i.isalpha():
		flag2 = 1
	if i.isdigit():
		flag3 = 1
	if i.islower():
		flag4 = 1
	if i.isupper():
		flag5 = 1
if flag1 == 1:
	print('True')
else:
	print('False')
if flag2 == 1:
	print('True')
else:
	print('False')
if flag3 == 1:
	print('True')
else:
	print('False')
if flag4 == 1:
	print('True')
else:
	print('False')
if flag5 == 1:
	print('True')
else:
	print('False')


s = input()
results = [False] * 5
i = 0
while i < len(s):
	if results != [True] * 5:
		if s[i].isalpha():
			results[0] = True
			results[1] = True
			if s[i].isupper():
				results[4] = True
			elif s[i].islower():
				results[3] = True
		if s[i].isdigit():
			results[0] = True
			results[2] = True
		i += 1
	else:
		break
for x in results:
	print(str(x))


S = input()
has_alphanum = []
has_alphabet = []
has_digits = []
has_lowercase = []
has_uppercase = []
for letter in S:
	if letter.isalnum():
		has_alphanum.append('T')
	if letter.isalpha():
		has_alphabet.append('T')
	if letter.isdigit():
		has_digits.append('T')
	if letter.islower():
		has_lowercase.append('T')
	if letter.isupper():
		has_uppercase.append('T')
if len(has_alphanum) > 0:
	print('True')
else:
	print('False')
if len(has_alphabet) > 0:
	print('True')
else:
	print('False')
if len(has_digits) > 0:
	print('True')
else:
	print('False')
if len(has_lowercase) > 0:
	print('True')
else:
	print('False')
if len(has_uppercase) > 0:
	print('True')
else:
	print('False')


t = input()
if len(t) < 1000:
	(a1, a2, a3, a4, a5) = (False, False, False, False, False)
	for i in list(t):
		if i.isalnum():
			a1 = True
		if i.isalpha():
			a2 = True
		if i.isdigit():
			a3 = True
		if i.islower():
			a4 = True
		if i.isupper():
			a5 = True
print(a1)
print(a2)
print(a3)
print(a4)
print(a5)


S = input()
chAr = [False, False, False, False, False]
for s in S:
	if s.isalnum():
		chAr[0] = True
	if s.isalpha():
		chAr[1] = True
	if s.isdigit():
		chAr[2] = True
	if s.islower():
		chAr[3] = True
	if s.isupper():
		chAr[4] = True
for t in chAr:
	print(t)


string = input()
print(any((c.isalnum() for c in string)))
print(any((c.isalpha() for c in string)))
print(any((c.isdigit() for c in string)))
print(any((c.islower() for c in string)))
print(any((c.isupper() for c in string)))


s = input()
tests = {'alnum': False, 'alpha': False, 'digit': False, 'lower': False, 'upper': False}
for c in s:
	if c.isalnum():
		tests['alnum'] = True
	if c.isalpha():
		tests['alpha'] = True
	if c.isdigit():
		tests['digit'] = True
	if c.islower():
		tests['lower'] = True
	if c.isupper():
		tests['upper'] = True
print(tests['alnum'])
print(tests['alpha'])
print(tests['digit'])
print(tests['lower'])
print(tests['upper'])


s = input()
print(any(map(str.isalnum, s)))
print(any(map(str.isalpha, s)))
print(any(map(str.isdigit, s)))
print(any(map(str.islower, s)))
print(any(map(str.isupper, s)))


s = input()
c1 = False
c2 = False
c3 = False
c4 = False
c5 = False
for i in s:
	if i.isalnum():
		c1 = True
	if i.isalpha():
		c2 = True
	if i.isdigit():
		c3 = True
	if i.islower():
		c4 = True
	if i.isupper():
		c5 = True
print(c1)
print(c2)
print(c3)
print(c4)
print(c5)


l = [False, False, False, False, False]
a = input()
for i in range(0, len(a)):
	if a[i].isdigit():
		l[2] = True
		l[0] = True
	elif a[i].isalpha():
		l[1] = True
		l[0] = True
		if a[i].islower():
			l[3] = True
		if a[i].isupper():
			l[4] = True
for i in l:
	print(i)


S = input()
found = False
for a in S:
	if a.isalnum():
		found = True
print(found)
found = False
for a in S:
	if a.isalpha():
		found = True
print(found)
found = False
for a in S:
	if a.isdigit():
		found = True
print(found)
found = False
for a in S:
	if a.islower():
		found = True
print(found)
found = False
for a in S:
	if a.isupper():
		found = True
print(found)


s = input()
c1 = c2 = c3 = c4 = c5 = 0
for i in s:
	if i.isalnum():
		c1 = c1 + 1
	if i.isalpha():
		c2 = c2 + 1
	if i.isdigit():
		c3 = c3 + 1
	if i.islower():
		c4 = c4 + 1
	if i.isupper():
		c5 = c5 + 1
for i in [c1, c2, c3, c4, c5]:
	if i > 0:
		print('True')
	else:
		print('False')


s = input()
has = False
for each in s:
	if each.isalnum():
		has = True
print(has)
has = False
for each in s:
	if each.isalpha():
		has = True
print(has)
has = False
for each in s:
	if each.isdigit():
		has = True
print(has)
has = False
for each in s:
	if each.islower():
		has = True
print(has)
has = False
for each in s:
	if each.isupper():
		has = True
print(has)


def checker(in_str):
	anc = False
	ac = False
	dc = False
	lc = False
	uc = False
	for c in in_str:
		if c.isalnum():
			anc = True
	for c in in_str:
		if c.isalpha():
			ac = True
	for c in in_str:
		if c.isdigit():
			dc = True
	for c in in_str:
		if c.islower():
			lc = True
	for c in in_str:
		if c.isupper():
			uc = True
	print(anc)
	print(ac)
	print(dc)
	print(lc)
	print(uc)
a_string = str(input()).strip()
checker(a_string)


line = list(input())
found = False
for c in line:
	if c.isalnum():
		found = True
		break
print(found)
found = False
for c in line:
	if c.isalpha():
		found = True
		break
print(found)
found = False
for c in line:
	if c.isdigit():
		found = True
		break
print(found)
found = False
for c in line:
	if c.islower():
		found = True
		break
print(found)
found = False
for c in line:
	if c.isupper():
		found = True
		break
print(found)


c = input()
l = [0, 0, 0, 0, 0]
for s in c:
	if s.isalnum():
		l[0] = 1
	if s.isalpha():
		l[1] = 1
	if s.isdigit():
		l[2] = 1
	if s.islower():
		l[3] = 1
	if s.isupper():
		l[4] = 1
for i in l:
	if i == 1:
		print('True')
	else:
		print('False')


import re
S = input()
print(re.match('.*[a-z]|[A-Z]|[0-9].*', S) != None)
print(re.match('.*[a-z]|[A-Z].*', S) != None)
print(re.match('.*[0-9].*', S) != None)
print(re.match('.*[a-z].*', S) != None)
print(re.match('.*[A-Z].*', S) != None)


b = [False for _ in range(5)]
for x in input():
	b[0] += x.isalnum()
	b[1] += x.isalpha()
	b[2] += x.isdigit()
	b[3] += x.islower()
	b[4] += x.isupper()
print('\n'.join(map(str, map(bool, b))))


s = input()
flag = 0
for c in s:
	if c.isalnum() == True:
		print('True')
		flag = 1
		break
if flag == 0:
	print('False')
flag = 0
for c in s:
	if c.isalpha() == True:
		print('True')
		flag = 1
		break
if flag == 0:
	print('False')
flag = 0
for c in s:
	if c.isdigit() == True:
		print('True')
		flag = 1
		break
if flag == 0:
	print('False')
flag = 0
for c in s:
	if c.islower() == True:
		print('True')
		flag = 1
		break
if flag == 0:
	print('False')
flag = 0
for c in s:
	if c.isupper() == True:
		print('True')
		flag = 1
		break
if flag == 0:
	print('False')


s = input()
flag = 0
al = 0
nm = 0
f = 0
for i in s:
	if i.isalpha():
		al = 1
	if i.isdigit():
		nm = 1
		if al == 1:
			break
if al == 1 or nm == 1:
	print('True')
else:
	print('False')
for i in s:
	if i.isalpha():
		flag = 1
		break
if flag == 1:
	print('True')
else:
	print('False')
flag = 0
for i in s:
	if i.isnumeric():
		flag = 1
		break
if flag == 1:
	print('True')
else:
	print('False')
flag = 0
for i in s:
	if i.islower():
		flag = 1
		break
if flag == 1:
	print('True')
else:
	print('False')
flag = 0
for i in s:
	if i.isupper():
		flag = 1
		break
if flag == 1:
	print('True', end='')
else:
	print('False', end='')


s = input()
print(any(map(lambda x: x.isalnum(), s)))
print(any(map(lambda x: x.isalpha(), s)))
print(any(map(lambda x: x.isdigit(), s)))
print(any(map(lambda x: x.islower(), s)))
print(any(map(lambda x: x.isupper(), s)))


s = input()
l = []
for i in range(5):
	l.append(False)
for i in s:
	if i.isalnum():
		l[0] = True
	if i.isalpha():
		l[1] = True
	if i.isdigit():
		l[2] = True
	if i.islower():
		l[3] = True
	if i.isupper():
		l[4] = True
for i in l:
	print(i)


inp = input()
print(any((x.isalnum() for x in inp)))
print(any((x.isalpha() for x in inp)))
print(any((x.isdigit() for x in inp)))
print(any((x.islower() for x in inp)))
print(any((x.isupper() for x in inp)))


s = input()
alpha = False
digit = False
lower = False
upper = False
for x in s:
	if x.isalpha():
		alpha = True
	if x.isdigit():
		digit = True
	if x.islower():
		lower = True
	if x.isupper():
		upper = True
print(alpha or digit)
print(alpha)
print(digit)
print(lower)
print(upper)


str = input()
alnum = False
alpha = False
digit = False
lower = False
upper = False
for i in str:
	if i.isalnum() == True:
		alnum = True
	if i.isalpha() == True:
		alpha = True
	if i.isdigit() == True:
		digit = True
	if i.islower() == True:
		lower = True
	if i.isupper() == True:
		upper = True
print(alnum)
print(alpha)
print(digit)
print(lower)
print(upper)


S = input()
print(any((i.isalnum() for i in S)))
print(any((i.isalpha() for i in S)))
print(any((i.isdigit() for i in S)))
print(any((i.islower() for i in S)))
print(any((i.isupper() for i in S)))


import string
s = input()
print(any((char in string.ascii_letters + string.digits for char in s)))
print(any((char in string.ascii_letters for char in s)))
print(any((char in string.digits for char in s)))
print(any((char in string.ascii_lowercase for char in s)))
print(any((char in string.ascii_uppercase for char in s)))


S = input()
print(True in [i.isalnum() for i in S])
print(True in [i.isalpha() for i in S])
print(True in [i.isdigit() for i in S])
print(True in [i.islower() for i in S])
print(True in [i.isupper() for i in S])


s = list(input())
for i in range(0, len(s)):
	if s[i].isalnum() == True:
		print('True')
		break
else:
	print('False')
for i in range(0, len(s)):
	if s[i].isalpha() == True:
		print('True')
		break
else:
	print('False')
for i in range(0, len(s)):
	if s[i].isdigit() == True:
		print('True')
		break
else:
	print('False')
for i in range(0, len(s)):
	if s[i].islower() == True:
		print('True')
		break
else:
	print('False')
for i in range(0, len(s)):
	if s[i].isupper() == True:
		print('True')
		break
else:
	print('False')


s = input()
st = []
for i in range(5):
	st.append('False')
for i in range(len(s)):
	if s[i].isalnum() == True:
		st[0] = 'True'
	if s[i].isalpha() == True:
		st[1] = 'True'
	if s[i].isdigit() == True:
		st[2] = 'True'
	if s[i].islower() == True:
		st[3] = 'True'
	if s[i].isupper() == True:
		st[4] = 'True'
for i in range(5):
	print(st[i])


str1 = input()
count1 = 0
count2 = 0
count3 = 0
count4 = 0
count5 = 0
for i in range(len(str1)):
	if str1[i].isalnum():
		print('True')
		count1 += 1
		break
if count1 == 0:
	print('False')
for i in range(len(str1)):
	if str1[i].isalpha():
		print('True')
		count2 += 1
		break
if count2 == 0:
	print('False')
for i in range(len(str1)):
	if str1[i].isdigit():
		print('True')
		count3 += 1
		break
if count3 == 0:
	print('False')
for i in range(len(str1)):
	if str1[i].islower():
		print('True')
		count4 += 1
		break
if count4 == 0:
	print('False')
for i in range(len(str1)):
	if str1[i].isupper():
		print('True')
		count5 += 1
		break
if count5 == 0:
	print('False')


def read_int():
	return int(input())

def read_int_words():
	return map(int, input().split())
s = input()

def pt(f):
	print(any(map(f, s)))
pt(lambda x: x.isalnum())
pt(lambda x: x.isalpha())
pt(lambda x: x.isdigit())
pt(lambda x: x.islower())
pt(lambda x: x.isupper())


S = input()
found = False
for i in S:
	if i.isalnum():
		found = True
		break
print(found)
found = False
for i in S:
	if i.isalpha():
		found = True
		break
print(found)
found = False
for i in S:
	if i.isdigit():
		found = True
		break
print(found)
found = False
for i in S:
	if i.islower():
		found = True
		break
print(found)
found = False
for i in S:
	if i.isupper():
		found = True
		break
print(found)


instring = input()
print(True in (k.isalnum() for k in instring))
print(True in (k.isalpha() for k in instring))
print(True in (k.isdigit() for k in instring))
print(True in (k.islower() for k in instring))
print(True in (k.isupper() for k in instring))


a = input()
alnum = alpha = digit = lower = upper = 0
for i in a:
	if i.isalnum():
		alnum += 1
	if i.isalpha():
		alpha += 1
	if i.isdigit():
		digit += 1
	if i.islower():
		lower += 1
	if i.isupper():
		upper += 1
print(alnum > 0)
print(alpha > 0)
print(digit > 0)
print(lower > 0)
print(upper > 0)


s = input()
funcs = [str.isalnum, str.isalpha, str.isdigit, str.islower, str.isupper]
for func in funcs:
	found = False
	for i in s:
		if func(i):
			found = True
	print(found)


string = input()
print(any((x.isalnum() for x in string)))
print(any((x.isalpha() for x in string)))
print(any((x.isdigit() for x in string)))
print(any((x.islower() for x in string)))
print(any((x.isupper() for x in string)))


values_list = [False for _ in range(5)]
for x in input():
	if x.isalnum():
		values_list[0] = True
	if x.isalpha():
		values_list[1] = True
	if x.isdigit():
		values_list[2] = True
	if x.islower():
		values_list[3] = True
	if x.isupper():
		values_list[4] = True
list(map(print, values_list))


data = input().strip()
alnum = False
alpha = False
digit = False
lower = False
upper = False
for i in data:
	if i.isalnum():
		alnum = True
	if i.isalpha():
		alpha = True
	if i.isdigit():
		digit = True
	if i.islower():
		lower = True
	if i.isupper():
		upper = True
print(alnum)
print(alpha)
print(digit)
print(lower)
print(upper)


S = input()
c = 0
for x in S:
	if x.isalnum():
		print('True')
		break
	c = c + 1
if c == len(S):
	print('False')
c = 0
for x in S:
	if x.isalpha():
		print('True')
		break
	c = c + 1
if c == len(S):
	print('False')
c = 0
for x in S:
	if x.isdigit():
		print('True')
		break
	c = c + 1
if c == len(S):
	print('False')
c = 0
for x in S:
	if x.islower():
		print('True')
		break
	c = c + 1
if c == len(S):
	print('False')
c = 0
for x in S:
	if x.isupper():
		print('True')
		break
	c = c + 1
if c == len(S):
	print('False')


s = input()
one = False
two = False
three = False
four = False
five = False
for c in s:
	if not one:
		one = c.isalnum()
	if not two:
		two = c.isalpha()
	if not three:
		three = c.isdigit()
	if not four:
		four = c.islower()
	if not five:
		five = c.isupper()
print(one)
print(two)
print(three)
print(four)
print(five)


s = input()
for i in range(0, len(s)):
	if s[i].isalnum():
		print('True')
		break
	if i == len(s) - 1:
		print('False')
for i in range(0, len(s)):
	if s[i].isalpha():
		print('True')
		break
	if i == len(s) - 1:
		print('False')
for i in range(0, len(s)):
	if s[i].isdigit():
		print('True')
		break
	if i == len(s) - 1:
		print('False')
for i in range(0, len(s)):
	if s[i].islower():
		print('True')
		break
	if i == len(s) - 1:
		print('False')
for i in range(0, len(s)):
	if s[i].isupper():
		print('True')
		break
	if i == len(s) - 1:
		print('False')


import sys
if sys.version_info[0] >= 3:
	raw_input = input
s = raw_input()
for e in ['isalnum', 'isalpha', 'isdigit', 'islower', 'isupper']:
	print(any((getattr(c, e)() for c in s)))


s = list(str(input()))
(a, b, c, d, e) = [False] * 5
for x in s:
	if x.isalpha():
		(a, b) = (True, True)
	if x.isdigit():
		(a, c) = (True, True)
	if x.islower():
		d = True
	if x.isupper():
		e = True
	if all([a, b, c, d, e]):
		break
print('%s\n%s\n%s\n%s\n%s\n' % (a, b, c, d, e))


s = input()
isalnum = 'False'
isalpha = 'False'
isdigit = 'False'
islower = 'False'
isupper = 'False'
for character in s:
	if character.isalnum():
		isalnum = 'True'
	if character.isalpha():
		isalpha = 'True'
	if character.isdigit():
		isdigit = 'True'
	if character.islower():
		islower = 'True'
	if character.isupper():
		isupper = 'True'
print(isalnum)
print(isalpha)
print(isdigit)
print(islower)
print(isupper)


a = str(input())
rep = False
for l in a:
	if l.isalnum():
		rep = True
print(rep)
rep = False
for l in a:
	if l.isalpha():
		rep = True
print(rep)
rep = False
for l in a:
	if l.isdigit():
		rep = True
print(rep)
rep = False
for l in a:
	if l.islower():
		rep = True
print(rep)
rep = False
for l in a:
	if l.isupper():
		rep = True
print(rep)


w = input()
a = 0
b = 0
c = 0
d = 0
e = 0
for i in range(len(w)):
	if w[i].isalnum():
		a = 1
	if w[i].isalpha():
		b = 1
	if w[i].isdigit():
		c = 1
	if w[i].islower():
		d = 1
	if w[i].isupper():
		e = 1
if a == 1:
	print(True)
else:
	print(False)
if b == 1:
	print(True)
else:
	print(False)
if c == 1:
	print(True)
else:
	print(False)
if d == 1:
	print(True)
else:
	print(False)
if e == 1:
	print(True)
else:
	print(False)


s = input()
(alphanum, alphabet, dig, low, up) = (False, False, False, False, False)
for c in s:
	if c.isalnum():
		alphanum = True
	if c.isalpha():
		alphabet = True
	if c.isdigit():
		dig = True
	if c.islower():
		low = True
	if c.isupper():
		up = True
print(alphanum)
print(alphabet)
print(dig)
print(low)
print(up)


test = -1
sample = input()
for letter in sample:
	if letter.isalnum():
		print(True)
		test = 1
		break
if test == -1:
	print(False)
test = -1
for letter in sample:
	if letter.isalpha():
		print(True)
		test = 1
		break
if test == -1:
	print(False)
test = -1
for letter in sample:
	if letter.isdigit():
		print(True)
		test = 1
		break
if test == -1:
	print(False)
test = -1
for letter in sample:
	if letter.islower():
		print(True)
		test = 1
		break
if test == -1:
	print(False)
test = -1
for letter in sample:
	if letter.isupper():
		print(True)
		test = 1
		break
if test == -1:
	print(False)


s = input()
for c in s:
	if c.isalnum():
		print(True)
		break
else:
	print(False)
for c in s:
	if c.isalpha():
		print(True)
		break
else:
	print(False)
for c in s:
	if c.isdigit():
		print(True)
		break
else:
	print(False)
for c in s:
	if c.islower():
		print(True)
		break
else:
	print(False)
for c in s:
	if c.isupper():
		print(True)
		break
else:
	print(False)


slist = list(input())
flag = False
for s in slist:
	if s.isalnum():
		print('True')
		flag = True
		break
if not flag:
	print('False')
else:
	flag = False
for s in slist:
	if s.isalpha():
		print('True')
		flag = True
		break
if not flag:
	print('False')
else:
	flag = False
for s in slist:
	if s.isdigit():
		print('True')
		flag = True
		break
if not flag:
	print('False')
else:
	flag = False
for s in slist:
	if s.islower():
		print('True')
		flag = True
		break
if not flag:
	print('False')
else:
	flag = False
for s in slist:
	if s.isupper():
		print('True')
		flag = True
		break
if not flag:
	print('False')
else:
	flag = False


text = input()
isalnum = False
isalpha = False
isdigit = False
islower = False
isupper = False
for letter in text:
	if isalnum == False:
		isalnum = letter.isalnum()
	if isalpha == False:
		isalpha = letter.isalpha()
	if isdigit == False:
		isdigit = letter.isdigit()
	if islower == False:
		islower = letter.islower()
	if isupper == False:
		isupper = letter.isupper()
print(isalnum)
print(isalpha)
print(isdigit)
print(islower)
print(isupper)


a = input()

def has_alnum(a):
	res = False
	for x in a:
		if res | x.isalnum():
			return True
			break
		else:
			res = res | x.isalnum()
	return res

def has_alpha(a):
	res = False
	for x in a:
		if res | x.isalpha():
			return True
			break
		else:
			res = res | x.isalpha()
	return res

def has_digit(a):
	res = False
	for x in a:
		if res | x.isdigit():
			return True
			break
		else:
			res = res | x.isdigit()
	return res

def has_lower(a):
	res = False
	for x in a:
		if res | x.islower():
			return True
			break
		else:
			res = res | x.islower()
	return res

def has_upper(a):
	res = False
	for x in a:
		if res | x.isupper():
			return True
			break
		else:
			res = res | x.isupper()
	return res
print(has_alnum(a))
print(has_alpha(a))
print(has_digit(a))
print(has_lower(a))
print(has_upper(a))


st = input()
if True in [s.isalnum() for s in st]:
	print('True')
else:
	print('False')
if True in [s.isalpha() for s in st]:
	print('True')
else:
	print('False')
if True in [s.isdigit() for s in st]:
	print('True')
else:
	print('False')
if True in [s.islower() for s in st]:
	print('True')
else:
	print('False')
if True in [s.isupper() for s in st]:
	print('True')
else:
	print('False')


s = input()
t = lambda f, s: len(list(filter(lambda c: getattr(c, f)(), s)))
out = [t('isalnum', s) > 0, t('isalpha', s) > 0, t('isdigit', s) > 0, t('islower', s) > 0, t('isupper', s) > 0]
for x in out:
	print(x)


oks = [False] * 5
s = input()
for c in s:
	if c.isalpha():
		oks[1] = True
		if c.isupper():
			oks[4] = True
		else:
			oks[3] = True
	if c.isdigit():
		oks[2] = True
if oks[1] or oks[2]:
	oks[0] = True
for ok in oks:
	print(ok)


S = input()
alphanumeric = False
aphabetical = False
digits = False
lowercase = False
UpperCase = False
for letter in S:
	if letter.isalnum():
		alphanumeric = True
	if letter.isalpha():
		aphabetical = True
	if letter.isdigit():
		digits = True
	if letter.islower():
		lowercase = True
	if letter.isupper():
		UpperCase = True
print(alphanumeric)
print(aphabetical)
print(digits)
print(lowercase)
print(UpperCase)


S = input()
T = 'True'
F = 'False'
Out = {'Alphanumeric': F, 'Alphabetic': F, 'Digit': F, 'Lowercase': F, 'Uppercase': F}
for s in S:
	if s.isalnum():
		Out['Alphanumeric'] = T
	if s.isalpha():
		Out['Alphabetic'] = T
	if s.isdigit():
		Out['Digit'] = T
	if s.islower():
		Out['Lowercase'] = T
	if s.isupper():
		Out['Uppercase'] = T
print(Out['Alphanumeric'])
print(Out['Alphabetic'])
print(Out['Digit'])
print(Out['Lowercase'])
print(Out['Uppercase'])


s = list(input())
flag1 = False
flag2 = False
flag3 = False
flag4 = False
flag5 = False
for i in range(len(s)):
	if s[i].isalnum() == True:
		flag1 = True
	if s[i].isalpha() == True:
		flag2 = True
	if s[i].isdigit() == True:
		flag3 = True
	if s[i].islower() == True:
		flag4 = True
	if s[i].isupper() == True:
		flag5 = True
else:
	print(flag1)
	print(flag2)
	print(flag3)
	print(flag4)
	print(flag5)


S = input()
alnum = False
alpha = False
digit = False
low = False
up = False
for c in S:
	if c.isalnum():
		alnum = True
	if c.isalpha():
		alpha = True
	if c.isdigit():
		digit = True
	if c.islower():
		low = True
	if c.isupper():
		up = True
print(alnum)
print(alpha)
print(digit)
print(low)
print(up)


test_string = input()
(alphanum, alpha, dig, low, upp) = (False, False, False, False, False)
for letter in test_string:
	if letter.isalnum():
		alphanum = True
	if letter.isalpha():
		alpha = True
	if letter.isdigit():
		dig = True
	if letter.islower():
		low = True
	if letter.isupper():
		upp = True
print(alphanum)
print(alpha)
print(dig)
print(low)
print(upp)


def decide(fun):
	for c in s:
		if fun(c):
			return True
	else:
		return False
s = input()
print(decide(str.isalnum))
print(decide(str.isalpha))
print(decide(str.isdigit))
print(decide(str.islower))
print(decide(str.isupper))


a = input()
flag = 0
for i in a:
	if i.isalnum():
		print('True')
		flag = 1
		break
if flag == 0:
	for i in a:
		if not i.isalnum():
			print('False')
			flag = 1
			break
flag = 0
for i in a:
	if i.isalpha():
		print('True')
		flag = 1
		break
if flag == 0:
	for i in a:
		if not i.isalpha():
			print('False')
			flag = 1
			break
flag = 0
for i in a:
	if i.isdigit():
		print('True')
		flag = 1
		break
if flag == 0:
	for i in a:
		if not i.isdigit():
			print('False')
			flag = 1
			break
flag = 0
for i in a:
	if i.islower():
		print('True')
		flag = 1
		break
if flag == 0:
	for i in a:
		if not i.islower():
			print('False')
			flag = 1
			break
flag = 0
for i in a:
	if i.isupper():
		print('True')
		flag = 1
		break
if flag == 0:
	for i in a:
		if not i.isupper():
			print('False')
			flag = 1
			break


st = input()
for i in range(len(st)):
	if st[i].isalnum():
		print('True')
		break
	elif i == len(st) - 1:
		print('False')
for i in range(len(st)):
	if st[i].isalpha():
		print('True')
		break
	elif i == len(st) - 1:
		print('False')
for i in range(len(st)):
	if st[i].isdigit():
		print('True')
		break
	elif i == len(st) - 1:
		print('False')
for i in range(len(st)):
	if st[i].islower():
		print('True')
		break
	elif i == len(st) - 1:
		print('False')
for i in range(len(st)):
	if st[i].isupper():
		print('True')
		break
	elif i == len(st) - 1:
		print('False')


s = input()
for e in ['isalnum', 'isalpha', 'isdigit', 'islower', 'isupper']:
	print(any((getattr(c, e)() for c in s)))


from functools import reduce
l = [c for c in input()]
print(reduce(lambda x, y: x or y.isalnum(), l, False), reduce(lambda x, y: x or y.isalpha(), l, False), reduce(lambda x, y: x or y.isdigit(), l, False), reduce(lambda x, y: x or y.islower(), l, False), reduce(lambda x, y: x or y.isupper(), l, False), sep='\n')


S = input()

def comp(S, func):
	for s in S:
		if eval(func):
			return True
	return False
print(comp(S, 's.isalnum()'))
print(comp(S, 's.isalpha()'))
print(comp(S, 's.isdigit()'))
print(comp(S, 's.islower()'))
print(comp(S, 's.isupper()'))


s = input()
if len(s) > 999 or len(s) < 1:
	exit()
a = False
b = False
w = False
d = False
e = False
for c in s:
	if c.isalnum() == True:
		a = True
		break
for c in s:
	if c.isalpha() == True:
		b = True
		break
for c in s:
	if c.isdigit() == True:
		w = True
		break
for c in s:
	if c.islower() == True:
		d = True
		break
for c in s:
	if c.isupper() == True:
		e = True
		break
print(a)
print(b)
print(w)
print(d)
print(e)


s = input()
for f in [str.isalnum, str.isalpha, str.isdigit, str.islower, str.isupper]:
	print(any(map(f, s)))


S = input()
isalnum = False
isalpha = False
isdigit = False
isupper = False
islower = False
for s in S:
	if s.isalpha() and isalpha != True:
		isalpha = True
	if s.isdigit() and isdigit != True:
		isdigit = True
	if s.isupper() and isupper != True:
		isupper = True
	if s.islower() and islower != True:
		islower = True
	if isalpha == True and isdigit == True and (isupper == True) and (islower == True):
		break
if isalpha == True or isdigit == True:
	isalnum = True
print(isalnum)
print(isalpha)
print(isdigit)
print(islower)
print(isupper)


s = [False, False, False, False, False]
strr = input()

def tell():
	for i in range(0, len(s)):
		if s[i] == False:
			return False
	return True

def check():
	for i in range(0, len(strr)):
		if strr[i].isalnum() == True:
			s[0] = True
		if strr[i].isalpha() == True:
			s[1] = True
		if strr[i].isdigit() == True:
			s[2] = True
		if strr[i].islower() == True:
			s[3] = True
		if strr[i].isupper() == True:
			s[4] = True
		if tell() == True:
			return
check()
for i in range(0, len(s)):
	print(str(s[i]))


string = input()
isalnum = False
isalpha = False
isdigit = False
islower = False
isupper = False
for i in range(0, len(string)):
	isalnum = True if string[i].isalnum() else isalnum
	isalpha = True if string[i].isalpha() else isalpha
	isdigit = True if string[i].isdigit() else isdigit
	islower = True if string[i].islower() else islower
	isupper = True if string[i].isupper() else isupper
print(isalnum, isalpha, isdigit, islower, isupper, sep='\n')


t = input()
for num in ['.isalnum()', '.isalpha()', '.isdigit()', '.islower()', '.isupper()']:
	m = False
	for i in t:
		if eval('i' + num) == True:
			print(True)
			m = True
			break
	if m != True:
		print(False)


s = input()
print(any([c.isalnum() for c in s]))
print(any([c.isalpha() for c in s]))
print(any([c.isdigit() for c in s]))
print(any([c.islower() for c in s]))
print(any([c.isupper() for c in s]))


str = input()
a = False
b = False
c = False
d = False
e = False
for char in str:
	if char.isalnum():
		a = True
	if char.isalpha():
		b = True
	if char.isdigit():
		c = True
	if char.islower():
		d = True
	if char.isupper():
		e = True
print(a)
print(b)
print(c)
print(d)
print(e)


str = list(input())
hasalnum = hasal = hasdig = hasup = haslo = 'False'
for i in range(len(str)):
	if str[i].isalpha():
		hasal = 'True'
		hasalnum = 'True'
		if str[i].islower():
			haslo = 'True'
		if str[i].isupper():
			hasup = 'True'
	if str[i].isdigit():
		hasdig = 'True'
		hasalnum = 'True'
print(hasalnum)
print(hasal)
print(hasdig)
print(haslo)
print(hasup)


s = input()
print(any([x.isalnum() for x in s]))
print(any([x.isalpha() for x in s]))
print(any([x.isdigit() for x in s]))
print(any([x.islower() for x in s]))
print(any([x.isupper() for x in s]))


str = input()
arr = [False] * 5
for letter in str:
	if letter.isalnum():
		arr[0] = True
	if letter.isalpha():
		arr[1] = True
	if letter.isdigit():
		arr[2] = True
	if letter.islower():
		arr[3] = True
	if letter.isupper():
		arr[4] = True
print(arr[0])
print(arr[1])
print(arr[2])
print(arr[3])
print(arr[4])


word = input('')
for k in word:
	if 64 < ord(k) < 92 or 96 < ord(k) < 123 or 48 < ord(k) < 58:
		print('True')
		break
else:
	print('False')
for k in range(65, 92):
	if chr(k) in word:
		print('True')
		break
else:
	for i in range(97, 123):
		if chr(i) in word:
			print('True')
			break
	else:
		print('False')
for k in word:
	if k in ('1', '2', '3', '4', '5', '6', '7', '8', '9'):
		print('True')
		break
else:
	print('False')
for i in range(97, 123):
	if chr(i) in word:
		print('True')
		break
else:
	print('False')
for k in range(65, 92):
	if chr(k) in word:
		print('True')
		break
else:
	print('False')


str = input()

def hasAlnum(w):
	for l in w:
		if l.isalnum():
			return True
	return False

def hasAlpha(w):
	for l in w:
		if l.isalpha():
			return True
	return False

def hasDigit(w):
	for l in w:
		if l.isdigit():
			return True
	return False

def hasLower(w):
	for l in w:
		if l.islower():
			return True
	return False

def hasUpper(w):
	for l in w:
		if l.isupper():
			return True
	return False
print(hasAlnum(str))
print(hasAlpha(str))
print(hasDigit(str))
print(hasLower(str))
print(hasUpper(str))


s = input()
d = 0
a = 0
l = 0
u = 0
for i in s:
	if d != 1 and i.isdigit():
		d = 1
	if a != 1 and i.isalpha():
		a = 1
	if l != 1 and i.islower():
		l = 1
	if u != 1 and i.isupper():
		u = 1
if a == 1 or d == 1:
	print(True)
else:
	print(False)
if a == 1:
	print(True)
else:
	print(False)
if d == 1:
	print(True)
else:
	print(False)
if l == 1:
	print(True)
else:
	print(False)
if u == 1:
	print(True)
else:
	print(False)


s = input()
for i in s:
	if i.isalnum():
		print(True)
		break
else:
	print(False)
for i in s:
	if i.isalpha():
		print(True)
		break
else:
	print(False)
for i in s:
	if i.isdigit():
		print(True)
		break
else:
	print(False)
for i in s:
	if i.islower():
		print(True)
		break
else:
	print(False)
for i in s:
	if i.isupper():
		print(True)
		break
else:
	print(False)


import string
st = input()
u = [x for x in st if x.isupper()]
a = [x for x in st if x.isalnum()]
ap = [x for x in st if x.isalpha()]
d = [x for x in st if x.isdigit()]
l = [x for x in st if x.islower()]
if len(a) > 0:
	print('True')
else:
	print('False')
if len(ap) > 0:
	print('True')
else:
	print('False')
if len(d) > 0:
	print('True')
else:
	print('False')
if len(l) > 0:
	print('True')
else:
	print('False')
if len(u) > 0:
	print('True')
else:
	print('False')


inputStr = input()
resalnum = False
resalpha = False
resdigit = False
reslower = False
resupper = False
for i in inputStr:
	if i.isalnum():
		resalnum = True
	if i.isalpha():
		resalpha = True
	if i.isdigit():
		resdigit = True
	if i.islower():
		reslower = True
	if i.isupper():
		resupper = True
print(resalnum)
print(resalpha)
print(resdigit)
print(reslower)
print(resupper)


import re
alphanumeric_matcher = re.compile('[a-zA-Z0-9]')
alpha_matcher = re.compile('[a-zA-Z]')
digit_matcher = re.compile('[0-9]')
lower_matcher = re.compile('[a-z]')
upper_matcher = re.compile('[A-Z]')
cad = input()
print(bool(alphanumeric_matcher.search(cad)))
print(bool(alpha_matcher.search(cad)))
print(bool(digit_matcher.search(cad)))
print(bool(lower_matcher.search(cad)))
print(bool(upper_matcher.search(cad)))


s = input()
flag = False
for i in range(len(s)):
	new_s = s[i:i + 1]
	if new_s.isalnum():
		flag = True
		break
print(flag)
flag = False
for i in range(len(s)):
	new_s = s[i:i + 1]
	if new_s.isalpha():
		flag = True
		break
print(flag)
flag = False
for i in range(len(s)):
	new_s = s[i:i + 1]
	if new_s.isdigit():
		flag = True
		break
print(flag)
flag = False
for i in range(len(s)):
	new_s = s[i:i + 1]
	if new_s.islower():
		flag = True
		break
print(flag)
flag = False
for i in range(len(s)):
	new_s = s[i:i + 1]
	if new_s.isupper():
		flag = True
		break
print(flag)


s = input()
functions = [lambda x: x.isalnum(), lambda x: x.isalpha(), lambda x: x.isdigit(), lambda x: x.islower(), lambda x: x.isupper()]
for fun in functions:
	print(any(map(fun, s)))