Dear Reader,
This book assumes that you are a new programmer with no prior knowledge of programming. So, what is programming? Programming solves problems by creating solutions writing programs--in a programming language. The fundamentals of problem solving and programming are the same regardless of which programming language you use. You can learn programming using any high-level programming language such as Python, Java, C++, or C#. Once you know how to program in one language, it is easy to pick up other languages, because the basic tech-niques for writing programs are the same.
So what are the benefits of learning programming using Python? Python is easy to learn and fun to program. Python code is simple, short, readable, intuitive, and powerful, and thus it is effective for introducing computing and problem solving to beginners.
Beginners are motivated to learn programming so they can create graphics. A big reason for learning programming using Python ts that you can start programmmg using graphics on day one. We use Python"s built-in Turtle graphics module in Chapters 1-6 because it is a good pedagogical tool for introducing fundamental concepts and techniques of programming. We introduce Python"s built-in Tkinter in Chapter 9, because it is a great tool for developing comprehensive graphical user interfaces and for learning object-oriented programming. Both Turtle and Tkinter are remarkably simple and easy to use. More importantly, they are valuable pedagogical tools for teaching the fundamentals of programming and object-oriented programming.
To give instructors flexibility to use this book, we cover Turtle at the end of Chapters 1-6 so they can be skipped as optional material.
The book teaches problem solving in a problem-driven way that focuses on problem solv-ing rather than syntax. We stimulate student intorests in programming by using interesting examples in a broad context. While the central thread of the book is on problem solving,appropriate Python syntax and library are introduced in order to solve the problems. To sup-port the teaching of programming in a problem-driven way, the book provides a wide variety of problems at various levels of difficulty to motivate students. In order to appeal to students in all majors, the problems cover many application areas in math, science, business, financial management, gaming, animation, and multimedia.
All data in Python are objects. We introduce and use objects from Chapter 3, but defining custom classes are covered in the middle of the book starting from Chapter 7. The book focuses on fundamentals first: it introduces basic programming concepts and techniques on selections, loops, and functions before writing custom classes.
The best way to teach programming is by example, and the only way to learn programming is by doing. Basic concepts are explained by example and a large number of exercises with various levels of difficulty are provided for students to practice. Our goal is to produce a text that teaches problem solving and programming in a broad context using a wide variety of interesting examples and exerci