I\'ve looked at the other post similar to my question, Password check- Python 3, except my question involves checking if the password contains both uppercase and lower case
Your question is simple to answer. You are returning things of the form return('steps' == True)
which is always going to return false. So just replace those with return True
or return False
.
Assuming you fix the above, your looping is also buggy. You only want to return false after you have looped through the entire string. Consider the password: ABCd
. This contains a lowercase character but your check lowercase method would return false because the first letter is uppercase. You want to look through every character in password and if none of those are lowercase, then return false.
If you want a neater way to do it, cdlane's answer is a nice pythonic way.