210k views
2 votes
Can someone help me. When this code is ran through processes or I get an error: "NameError: name 'movie' is not defined on line 9"

def main():


movie = input("Whats your favorite movie?")

if(movie == "Sword Art Online Ordinal Scale."):

User Pajooh
by
4.9k points

1 Answer

5 votes

Answer:

See Explanation

Step-by-step explanation:

The question is incomplete, as the remaining part of the code segment is missing from the question.

The error from your question; movie not defined means that variable name has not been defined

From the 3 lines of your code, I can see that variable movie has been properly defined in the main() function

Since movie has been defined in this function, then a possible reason why you get the error is that:

You have another function in your program where you try to use variable movie, before it is defined

Another reason is that you misspell the variable name movie in the said function.

User Rmdroid
by
4.6k points