120k views
12 votes
Atheel tests a program and gets a NameError. How can this be fixed?

2 Answers

5 votes

Answer:

You can't call a function unless you've already defined it. Move the def createDirs(): block up to the top of your file, below the imports.

Step-by-step explanation:

Some languages allow you to use functions before defining them. For example, javascript calls this "hoisting". But Python is not one of those languages.

User MX D
by
5.4k points
4 votes

Answer:

B = Create a variable

Step-by-step explanation:

First off to understand this question, you need to understand what a NameError is. A NameError is when a function or variable isn't valid, or is not defined. So what you need to do it make a variable that is valid/defined. Therefore the answer is B create a variable

I hope this helps!

User Maitreya
by
4.8k points