Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Buy Now $39.99
Standard view
Full view
of .
Look up keyword or section
Like this
2Activity

Table Of Contents

Prepare and run your code
A program is more than a list of commands
Codeville: Your program is like a network of roads
Branches are code intersections
The Python code needs interconnecting paths
Python uses indents to connect paths
Loops let you run the same piece of code over and over again
Your Programming Toolbox
Your new gig at Starbuzz Coffee
Here’s the current Starbuzz code
The cost is embedded in the HTML
A string is a series of characters
Find characters inside the text
But how do you get at more than one character?
The String Exposed
Beans'R'Us is rewarding loyal customers
Searching is complex
Python data is smart
Strings and numbers are different
The program has overloaded the Beans’R’Us Server
Time... if only you had more of it
You’re already using library code
Order is restored
Starbuzz is out of beans!
What does the new program need to do?
Reuse code with functions
Always get things in the right order
Return data with the return command
The function always sends the same message
Use parameters to avoid duplicating functions
Someone decided to mess with your code
The rest of the program can’t see the password variable
When you call a function, the computer creates a fresh list of variables
When you leave a function, its variables get thrown away
Starbuzz is fully stocked!
Surf’s up in Codeville
Find the highest score in the results file
Iterate through the file with the open, for, close pattern
The file contains more than numbers
Split each line as you read it
The split() method cuts the string
But you need more than one top score
Keeping track of 3 scores makes the code more complex
An ordered list makes code much simpler
Sorting is easier in memory
You can’t use a separate variable for each line of data
An array lets you manage a whole train of data
Python gives you arrays with lists
Sort the array before displaying the results
Sort the scores from highest to lowest
And the winner is...?
You somehow forgot the surfer names
Associate a key with a value using a hash
The code remains the same; it's the function that changes
The health club has a new requirement
The Starbuzz code
The two discount functions have the same name
Fully Qualified Names (FQNs) prevent your programs from getting confused
The discounts get the customers flooding in
Head First TVN now produces game shows
The GUI works, but doesn’t do anything
Connect code to your button events
The GUI program’s now ready for a screentest
Head-Ex needs a new delivery system
They’ve already designed the interface
Read data from the GUI
The Entry and Text widgets let you enter text data into your GUI
Read and write data to text fields
Large Text fields are harder to handle
One of the Head-Ex deliveries went astray
Users can enter anything in the fields
Radio buttons force users to choose a valid depot
Creating radio buttons in tkinter
The radio buttons should work together
The radio buttons can share a model
The system tells the other widgets when the model changes
So how do you use models in tkinter?
Head-Ex's business is expanding
There are too many depots on the GUI
An OptionMenu lets you have as many options as needed
The model stays the same
Things are going great at Head-Ex
The music just kept on playing
Not all events are generated by button clicks
Capturing the protocol event isn’t enough
Two buttons, or not two buttons? That is the question
The checkbox is an on/off, flip/flop toggle
Working with checkboxes in tkinter
Create code for each track as a function
The new function contains other functions
Your new function needs to create widgets and event handlers
The DJ is confused
Group widgets together
A frame widget contains other widgets
A class is a machine for creating objects
A class has methods that define behavior
But how does an object call a method?
The SoundPanel class looks a lot like the create gui() function
class = methods + data
The Class Exposed
The DJ has an entire directory of tracks
It’s party time!
It’s been great having you here in Codeville!
P. 1
Head First Programming: A learner's guide to programming using the Python language

Head First Programming: A learner's guide to programming using the Python language

Ratings:

3.5

(5)
|Views: 22|Likes:

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.

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.

More info:

Publish date: Nov 16, 2009
Added to Scribd: Jan 10, 2014
Copyright:Traditional Copyright: All rights reservedISBN:9781449389130
List Price: $39.99 Buy Now

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
This book can be read on up to 6 mobile devices.
See more
See less

05/05/2015

442

9781449389130

$39.99

USD

You're Reading a Free Preview
Pages 18 to 28 are not shown in this preview.
You're Reading a Free Preview
Pages 46 to 213 are not shown in this preview.
You're Reading a Free Preview
Pages 240 to 371 are not shown in this preview.
You're Reading a Free Preview
Pages 389 to 442 are not shown in this preview.

Activity (2)

You've already reviewed this. Edit your review.
ricgerace reviewed this
Save your money. I'm a fan of the Head First books, but this one fails to deliver. Poorly presented, the book makes too many assumptions and leaps. I'm not sure who they had in mind as the audience, but they say it was for beginners, and that just ain't so. The only reason I haven't sent it back for a refund is that I want to keep it as an example of how not to write a book on programming (or anything else, for that matter).
1 hundred reads

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->