From the course: Introduction to Python: Learn How to Program Today with Python by Pearson

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

More context: Refactor your code

More context: Refactor your code

Okay, so that was all of the basics of the language that you have now and can actually write some decent sized programs and use all of the programming constructs like conditionals and loops and functions that most programmers know and a lot of people don't really go too far beyond that. But now, we've got a program, we have Challenge 5 quiz, it is 38 lines long. We maybe want to add features to this, make it more complex, maybe someone else wants to read it. What can we do now to improve our code and make it more easier to read, more maintainable and extendable, and also ensure that the quality is still there and that everything works still. Because as you saw, as I change things, I would need to test quite a bit. Test correct answers, wrong answers, getting everything right, quitting, and that's a lot of stuff to do, especially the more complex your program gets. So now I'm going to talk about how you might want to refactor your code so that it doesn't just work, but it's actually a…

Contents