def any_lowercase1(s):
for c in s:
if c.islower():
return True
else:
return False
#Using the for loop we check through the argument if it is lower case or not
#The function returns true if they are all lowercase and false if any of the letters in s is upper case
def any_lowercase2(s):
for c in s:
if 'c'.islower():
return 'True'
else:
return 'False'
any_lowercase2('Wright')
#The code isn't correct, first we change 'c' to c, 'True' to True and 'False' to False as in the code below
'True'
def any_lowercase2(s):
for c in s:
if c.islower():
return True
else:
return False
any_lowercase2('Wright')
False
def any_lowercase5(s):
for c in s:
if not c.islower():
return False
return True
any_lowercase2('Wright')
#we pass the string as argument s, we then check if c is in lowercase, we return true, else return False
False
Comments
Leave a comment