Head First Programming: A Learner's Guide to Programming Using the Python Language (Head First Series)


Looking for a reliable way to learn how to program on your own, without being overwhelmed by confusing concepts? Head First Programming introduces the core concepts of writing computer programs — variables, decisions, loops, functions, and objects — which apply regardless of the programming language. This book offers concrete examples and exercises in the dynamic and versatile Python language to demonstrate and reinforce these concepts.

Learn the basic tools to start writing the...

See more details below
BN.com price
(Save 29%)$49.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (27) from $2.52   
  • New (12) from $26.95   
  • Used (15) from $2.52   
Head First Programming: A learner's guide to programming using the Python language

Available on NOOK devices and apps  
  • NOOK Devices
  • NOOK HD/HD+ Tablet
  • NOOK
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK Study
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
BN.com price
(Save 42%)$39.99 List Price


Looking for a reliable way to learn how to program on your own, without being overwhelmed by confusing concepts? Head First Programming introduces the core concepts of writing computer programs — variables, decisions, loops, functions, and objects — which apply regardless of the programming language. This book offers concrete examples and exercises in the dynamic and versatile Python language to demonstrate and reinforce these concepts.

Learn the basic tools to start writing the programs that interest you, and get a better understanding of what software can (and cannot) do. When you're finished, you'll have the necessary foundation to learn any programming language or tackle any software project you choose.

With a focus on programming concepts, this book teaches you how to:

  • Understand the core features of all programming languages, including: variables, statements, decisions, loops, expressions, and operators
  • Reuse code with functions
  • Use library code to save time and effort
  • Select the best data structure to manage complex data
  • Write programs that talk to the Web
  • Share your data with other programs
  • Write programs that test themselves and help you avoid embarrassing coding errors

We think your time is too valuable to waste struggling with new concepts. Using the latest research in cognitive science and learning theory to craft a multi-sensory learning experience, Head First Programming uses a visually rich format designed for the way your brain works, not a text-heavy approach that puts you to sleep.

Read More Show Less

Product Details

  • ISBN-13: 9780596802370
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 12/16/2009
  • Series: Head First Series
  • Edition number: 1
  • Pages: 406
  • Sales rank: 334,610
  • Product dimensions: 7.96 (w) x 9.20 (h) x 0.94 (d)

Meet the Author

David Griffiths began programming at age 12, after being inspired by a documentary on the work of Seymour Papert. At age 15 he wrote an implementation of Papert's computer language LOGO. After studying Pure Mathematics at University, he began writing code for computers and magazine articles for humans and he currently works in the UK, helping people to create simpler, more valuable software. He spends his free time traveling and time with his lovely wife, Dawn.

Paul Barry is formally educated and trained in Computer Science and holds a Masters Degree in Computing Science. He has been programming professionally, on and off, for close to 25 years. Paul already has two textbooks to his name, and is also a Contributing Editor to Linux Journal magazine. His day job is with the Institute of Technology, Carlow in Ireland where he has spent over a decade preparing Ireland's next generation of computing folk to be productive in the workforce. His role as a third level educator affords him the opportunity to explore, learn and teach the very latest programming technologies and practices, which is something that he enjoys even though he knows this makes him a bonafide "geek". Paul lives just outside the town of Carlow in Ireland with his wife, two sons, daughter, dog and cat. There's a bunch of computers and a growing collection of music instruments in the house, too (and like a lot of the Head First family, Paul is a struggling guitarist trapped inside a geek's body). He has so far resisted any suggestion that the family acquire a hamster ... or a set of drums.

Read More Show Less

Table of Contents

Advance Praise for Head First Programming;
Praise for other Head First books;
Authors of Head First Programming;
How to Use This Book: Intro;
Who is this book for?;
We know what you’re thinking;
We know what your brain is thinking;
Metacognition: thinking about thinking;
Here’s what WE did;
Here’s what YOU can do to bend your brain into submission;
Read Me;
The technical review team;
Safari® Books Online;
Chapter 1: Starting to Code: Finding your way;
1.1 Programming lets you do more;
1.2 So how do you run your code?;
1.3 Create a new program file;
1.4 Prepare and run your code;
1.5 A program is more than a list of commands;
1.6 Codeville: Your program is like a network of roads;
1.7 Branches are code intersections;
1.8 if/else branches;
1.9 The Python code needs interconnecting paths;
1.10 Python uses indents to connect paths;
1.11 Loops let you run the same piece of code over and over again;
1.12 Python’s while loop;
1.13 Your Programming Toolbox;
Chapter 2: Textual Data: Every string has its place;
2.1 Your new gig at Starbuzz Coffee;
2.2 Here’s the current Starbuzz code;
2.3 The cost is embedded in the HTML;
2.4 A string is a series of characters;
2.5 Find characters inside the text;
2.6 But how do you get at more than one character?;
2.7 Beans‘R’Us is rewarding loyal customers;
2.8 Searching is complex;
2.9 Python data is smart;
2.10 Strings and numbers are different;
2.11 The program has overloaded the Beans’R’Us Server;
2.12 Time... if only you had more of it;
2.13 You’re already using library code;
2.14 Order is restored;
2.15 Your Programming Toolbox;
Chapter 3: Functions: Let’s get organized;
3.1 Starbuzz is out of beans!;
3.2 What does the new program need to do?;
3.3 Don’t duplicate your code...;
3.4 ...Reuse your code instead;
3.5 Reuse code with functions;
3.6 Always get things in the right order;
3.7 Return data with the return command;
3.8 Use the Force, Web Luke;
3.9 The function always sends the same message;
3.10 Use parameters to avoid duplicating functions;
3.11 Someone decided to mess with your code;
3.12 The rest of the program can’t see the password variable;
3.13 When you call a function, the computer creates a fresh list of variables;
3.14 When you leave a function, its variables get thrown away;
3.15 Starbuzz is fully stocked!;
3.16 Your Programming Toolbox;
Chapter 4: Data in Files and Arrays: Sort it out;
4.1 Surf’s up in Codeville;
4.2 Find the highest score in the results file;
4.3 Iterate through the file with the open, for, close pattern;
4.4 The file contains more than numbers...;
4.5 Split each line as you read it;
4.6 The split() method cuts the string;
4.7 But you need more than one top score;
4.8 Keeping track of 3 scores makes the code more complex;
4.9 An ordered list makes code much simpler;
4.10 Sorting is easier in memory;
4.11 You can’t use a separate variable for each line of data;
4.12 An array lets you manage a whole train of data;
4.13 Python gives you arrays with lists;
4.14 Sort the array before displaying the results;
4.15 Sort the scores from highest to lowest;
4.16 And the winner is...?;
4.17 You somehow forgot the surfer names;
4.18 Your Programming Toolbox;
Chapter 5: Hashes and Databases: Putting data in its place;
5.1 Who won the surfing contest?;
5.2 Associate the name with the score;
5.3 Associate a key with a value using a hash;
5.4 Iterate hash data with for;
5.5 The data isn’t sorted;
5.6 When data gets complex;
5.7 Return a data structure from a function;
5.8 Here’s your new board!;
5.9 Meanwhile, down at the studio...;
5.10 The code remains the same; it’s the function that changes;
5.11 TVN’s data is on the money!;
5.12 Your Programming Toolbox;
Chapter 6: Modular Programming: Keeping things straight;
6.1 Head First Health Club is upgrading some systems;
6.2 The program needs to create a transaction file;
6.3 Use strings to format strings;
6.4 A late night email ruins your day;
6.5 $50,000... for a donut?!;
6.6 Only the sales from your program were rejected;
6.7 The new bank uses a new format;
6.8 Your coffee bar program still uses the old format;
6.9 Don’t just update your copy;
6.10 So how do you create a module...?;
6.11 The transaction file is working great, too;
6.12 The health club has a new requirement;
6.13 The Starbuzz code;
6.14 The two discount functions have the same name;
6.15 Fully Qualified Names (FQNs) prevent your programs from getting confused;
6.16 The discounts get the customers flooding in;
6.17 Your Programming Toolbox;
Chapter 7: Building a Graphical User Interface: Going all gooey;
7.1 Head First TVN now produces game shows;
7.2 pygame is cross platform;
7.3 0... 2... 1... 9... blast off!;
7.4 tkinter gives you the event loop for free;
7.5 tkinter is packed with options;
7.6 The GUI works, but doesn’t do anything;
7.7 Connect code to your button events;
7.8 The GUI program’s now ready for a screentest;
7.9 But TVN is still not happy;
7.10 Label it;
7.11 Your Programming Toolbox;
Chapter 8: Guis and Data: Data entry widgets;
8.1 Head-Ex needs a new delivery system;
8.2 They’ve already designed the interface;
8.3 Read data from the GUI;
8.4 The Entry and Text widgets let you enter text data into your GUI;
8.5 Read and write data to text fields;
8.6 Large Text fields are harder to handle;
8.7 One of the Head-Ex deliveries went astray;
8.8 Users can enter anything in the fields;
8.9 Radio buttons force users to choose a valid depot;
8.10 Creating radio buttons in tkinter;
8.11 The radio buttons should work together;
8.12 The radio buttons can share a model;
8.13 The system tells the other widgets when the model changes;
8.14 So how do you use models in tkinter?;
8.15 Head-Ex’s business is expanding;
8.16 There are too many depots on the GUI;
8.17 An OptionMenu lets you have as many options as needed;
8.18 The model stays the same;
8.19 Things are going great at Head-Ex;
8.20 Your Programming Toolbox;
Chapter 9: Exceptions and Message Boxes: Get the message?;
9.1 What’s that smell?;
9.2 Someone changed the file permissions;
9.3 When it couldn’t write to the file, the program threw an exception;
9.4 Catch the exception;
9.5 Watch for exceptions with try/except;
9.6 There’s an issue with the exception handler;
9.7 A message box demands attention;
9.8 Creating message boxes in Python;
9.9 Your Programming Toolbox;
Chapter 10: Graphical Interface Elements: Selecting the right tool;
10.1 Time to mix it up;
10.2 The music just kept on playing...;
10.3 Not all events are generated by button clicks;
10.4 Controlling the Window Manager;
10.5 Capturing the protocol event isn’t enough;
10.6 Two buttons, or not two buttons? That is the question...;
10.7 The checkbox is an on/off, flip/flop toggle;
10.8 Working with checkboxes in tkinter;
10.9 Pump up the volume!;
10.10 Model a slider on a scale;
10.11 Use pygame to set the volume;
10.12 Use tkinter for everything else;
10.13 The DJ is over the moon!;
10.14 Your Programming Toolbox;
Chapter 11: Custom Widgets and Classes: With an object in mind;
11.1 The DJ wants to play more than one track;
11.2 Create code for each track as a function;
11.3 The new function contains other functions;
11.4 Your new function needs to create widgets and event handlers;
11.5 The DJ is confused;
11.6 Group widgets together;
11.7 A frame widget contains other widgets;
11.8 A class is a machine for creating objects;
11.9 A class has methods that define behavior;
11.10 But how does an object call a method?;
11.11 The SoundPanel class looks a lot like the create_gui() function;
11.12 class = methods + data;
11.13 The DJ has an entire directory of tracks;
11.14 It’s party time!;
11.15 Your Programming Toolbox;
11.16 Leaving town...;
11.17 It’s been great having you here in Codeville!;
Leftovers: The Top Ten Things (we didn’t cover);
#1: Doing things “The Python Way”;
#2: Using Python 2;
#3: Other programming languages;
#4: Automated testing techniques;
#5: Debugging;
#6: Command-line execution;
#7: Ooops... we could’ve covered more OOP;
#8: Algorithms;
#9: Advanced Scary programming topics;
#10: Other IDEs, shells, and text editors;

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 3 Customer Reviews
  • Anonymous

    Posted December 6, 2011

    Great first programming book

    I have no complaints. I am VERY new to programming and I warn that this is a book for someone like that. I would guess that if you have a lot or even medium knowledge of programming this book is NOT for you as it has a lot of hand holding and info that probably will not be helpful for the more experienced programmer.

    Was this review helpful? Yes  No   Report this review
  • Posted January 30, 2010

    use HEad First for accelerated learning

    This is a neat concept that the book is more like a lab notebook (you are encouraged to write in it), I love it. Most learning of computer languages is tough, but this book makes it easy.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted August 29, 2010

    No text was provided for this review.

Sort by: Showing all of 3 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)