Why does this happen? /u/Influence-Various Python Education

I am doing exercises for my Programming Fundamentals class and these codes are intended to check whether a string contains any lowercase letters, but something is wrong.

Here is the code:

def any_lowercase3(s):
for c in s:
flag=c.islower()
return flag

I understand that it is wrong because this will only check the last letter of the string and return that, but I don’t understand why.

This class is my first experience in Python and coding as a whole since the HTML MySpace days so I am struggling a bit.

submitted by /u/Influence-Various
[link] [comments]

​r/learnpython I am doing exercises for my Programming Fundamentals class and these codes are intended to check whether a string contains any lowercase letters, but something is wrong. Here is the code: def any_lowercase3(s): for c in s: flag=c.islower() return flag I understand that it is wrong because this will only check the last letter of the string and return that, but I don’t understand why. This class is my first experience in Python and coding as a whole since the HTML MySpace days so I am struggling a bit. submitted by /u/Influence-Various [link] [comments] 

I am doing exercises for my Programming Fundamentals class and these codes are intended to check whether a string contains any lowercase letters, but something is wrong.

Here is the code:

def any_lowercase3(s):
for c in s:
flag=c.islower()
return flag

I understand that it is wrong because this will only check the last letter of the string and return that, but I don’t understand why.

This class is my first experience in Python and coding as a whole since the HTML MySpace days so I am struggling a bit.

submitted by /u/Influence-Various
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *