Quote:
Originally Posted by DaWei
That works because it's making a pass through the code to pick up the definitions and then a pass to execute. Not all languages or assemblers or compilers or interpreters give you that facility. It's fairly common for interpreters, though. They have to emit the actual runnable code, so they often generate all of it, then run it.
|
So why would this book (How to think like a computer scientist, Learning with Python) give me this excercise? The way the excercise is written I'm expecting an error. It had another one after where I put the def newLine() after the def threeLines() but the same thing happened. It worked perfectly.
Sorry to waste your time with such simple questions, but I want to be thorough and learn this properly.
By the way, the book doesn't tell me how to use the program. I had to figure that out myself. Am I doing this right?
I create a new script for the above example, then go into the interactive window that is there when Python first loads up and I imported the script.