Answer to Question #280238 in Python for kika

Question #280238

For each function, describe what it actually does when called with a string argument. If it does not correctly check for lowercase letters, give an example argument that produces incorrect results, and describe why the result is incorrect.

# 1

def any_lowercase1(s):

   for c in s:

     if c.islower():

        return True

     else:

        return False


1
Expert's answer
2021-12-20T10:01:54-0500
def any_lowercase1(s):
   for c in s:
     if c.islower():
        return True
     else:
        return False

The function actually checks if the first character is lowercase. So the call

any_lowercase1("AbCD")

returns False while it should return True


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS