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

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

by David Griffiths, Paul Barry

Paperback

$59.99
View All Available Formats & Editions
Choose Expedited Shipping at checkout for guaranteed delivery by Tuesday, April 30

Product Details

ISBN-13: 9780596802370
Publisher: O'Reilly Media, Incorporated
Publication date: 12/16/2009
Series: Head First Series
Pages: 406
Sales rank: 845,751
Product dimensions: 8.00(w) x 9.25(h) x 1.00(d)

About 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.

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;
Acknowledgments;
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;

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews