So I'm trying to run this, but it errors out and I need help understanding what's wrong. I really appreciate any help, I'm taking the MIT opencourseware intro to programming:
words="GreatTimes"
words.lowercase
And I get this error:
AttributeError: 'str' object has no attribute 'lowercase'
The issue is that I'm trying to run example code from "How to think like a computer scientist" and it still gives me the error.
def isLower(ch):
return string.find(string.lowercase, ch) != -1
So I can't figure out what the syntax error is. Looking at the Python doc page it says this:
string.lowercase A string containing all the characters that are considered lowercase letters. On most systems this is the string 'abcdefghijklmnopqrstuvwxyz'. The specific value is locale-dependent, and will be updated when locale.setlocale() is called.
Thoughts?
Edit: Ah, sorry I should be more clear. So I'm trying to write a piece of code that will tell me whether or not a character in a string is lowercase or not. my code is my implementation of it. while the example code is something i'm using to try to check to see if my syntax is wrong and that is the source of the problem. However, the example code also generates an error. In a nutshell, why doesn't this code work? It seems like it Should spit out a string of all the lowercase letters like "reatimes" from "GreatTimes" And/or how would you use string.lowercase to make this program?