1.8. πŸ‘©β€πŸ’» Predict Before You Run!ΒΆ

You’ve run your first program! You’ll be doing that a lot in this book and the programs will become increasingly complicated. One way to help understand what is happening and learn programming is predicting the effect of running a snippet of code before actually running the program. Later on in your development, you may make predictions about large snippets of code, but for now you will typically be predicting the effect of executing a single line of code. A prediction will either be about what gets printed out, or about the value of a variable, or that an error will occur.

A prediction is not a random guess. It is based on some explanation you have about what the current state of variables is and about what you think certain commands in python do.

While you read the textbook you’ll see chapters, pages, or snippets of text that begin with β€œWP:”. This denotes sections that talk about the Way of the Programmer: advice or information that will help you to be a better programmer and make better programs. Be on the lookout for other WP pages!

Next Section - 1.9. πŸ‘©β€πŸ’» To Understand a Program, Change It!