Lesson 2, Step 6: String Method: lower()


#1



In the lesson regarding string methods, specifically for lower(), I continue to encounter an error regardless of how I change syntax e.g., adding semicolons or changing amount of white space. Even refreshing the webpage and reopening the browser don't resolve it.

When trying to call the method lower(), I receive the following error every time:

Traceback (most recent call last):
File "python", line 3, in module
NameError: name 'lower' is not defined

Per the previous exercise, lower(parrot) should have changed "Norwegian Blue" to "norwegian blue". I don't see how there is any syntax issue. This error seems to be indicating that the interpreter doesn't recognize the lower() string method? I don't know how I can proceed to the next lesson with this error repeatedly occurring.

parrot = "Norwegian Blue";
    
print lower(parrot)

#2

it's not the right syntax.

syntax for lower() method −

str.lower()

you have to use Dot Notation.
you can see the lesson example too :slight_smile:


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.