
If you want to learn how to program, working with Python is an excellent way to start. This hands-on guide takes you through the language one step at a time, beginning with basic programming concepts before moving on to functions, recursion, data structures, and object-oriented design. Through exercises in each chapter, you’ll try out programming concepts as you learn them. Think Python is ideal for students at the high school or college level, as well as self-learners, home-schooled students, and professionals who need to learn programming basics.
https://greenteapress.com/wp/think-python-2e/
For code examples, I like Peter Norvig's pytudes:
Here's Think Python (How to Think Like a Computer Scientist):
Another nontraditional intro to computing worth mentioning is "Structure and Interpretation of Computer Programs" by Abelson and Sussman(s). It teaches programming concepts using the Lisp/Scheme language (seldom used any more), but does so brilliantly.
"Think Python: How to Think Like a Computer Scientist" by Downey might provide the right mix of computing concepts and programming practice.
If you do want a traditional intro to CS theory, two books that cover that topic well are: "Introduction to the Theory of Computation" by Sipser, and "Introduction to Automata Theory, Languages, and Computation" by Hopcroft, Motwani, and Ullman.
Three very good books that introduce algorithms are: "Introduction to Algorithms: A Creative Approach" by Manber, "The Algorithm Design Manual" by Skiena, and "Algorithms" by Sedgewick and Wayne.
Remember that CS theory doesn't age, so buying a used early edition of a textbook should serve your needs just as well as an new up-to-date edition.
Seconding Petzold's Code for hardware and low-level programming. Also seconding Downey's Think Python (which has appeared in several versions with different titles). It is an easy read but is a bit deeper than many introduction to Python books.
Also seconding Wirth's Algorithms + Data Structures = Programs but it requires a lot more concentration and study than the previous suggestions. It is also old-fashioned, from the late 1970s I think, uses Pascal as its programming language. It teaches and celebrates a rigorous, economical programming method and coding style which is not much in vogue any more.
https://greenteapress.com/wp/think-python-2e/
(Case Study: interface design http://greenteapress.com/thinkpython2/html/thinkpython2005.h...)
The book is very good for first-time learners IMHO.
