Home Page Icon
Home Page
Table of Contents for
Week 4: Stepping Up to Object-Oriented Programming
Close
Week 4: Stepping Up to Object-Oriented Programming
by Brendan Scott
Python For Kids For Dummies
Cover
Cover
Introduction
About This Book
Conventions Used
Foolish Assumptions
Icons Used in This Book
Beyond the Book
Where to Go from Here
Week 1: Slithering into Python
Project 1: Getting Started with Python
Python and Why It’s Wonderful
Who’s Using Python
Making Things with Python
Understanding This Book’s Pedagogical Approach
Install Python on Mac OSX
Install Python on Windows
Install Python for Linux
Pin Python to Your Start Menu
Start the Python Interpreter
Use Python’s Built-In Documentation
Put the Kibosh on the Python Interpreter
Find Python Documentation Online
Join the Broader Python Community
Handle Problems
Learn How to Learn
Summary
Project 2: Hello World!
Write Hello World!
Spot and Fix Errors
Work with Literals
Literally Save Your Strings in Variables
Interrupt a Program
Drive Up to Python Keywords
Many Loop, Much Hello
Fill the Screen with Greetings
Make Python Count
Summary
Week 2: Building Guessing Games
Project 3: Guessing Game
Plan the Game
Get Input from the Player
Ask for Input
Make Sure Things Are Equal
Call the Operators
Divide in Python
Compare the Guess to a Number
Compare the Player’s Guess to the Computer’s Number
Tell Players If the Guess Is Wrong
Keep Asking Until the Player Guesses Correctly
Make Python Think of a Random Number
Use Namespaces
Finish Your Guessing Game
Summary
Project 4: Set Up Your Coding Environment
Use the Default Development Environment
Start IDLE
Stash Some IDLE Tricks
Use the IDLE Editor Window
Write Comments in Your Files
Insert Hash Comments
Save Your Shell Contents
Comment Out Code
Indent and Dedent Your Code
Summary
Project 5: A Better Guessing Game
Handle Your Functions
Naming Functions
Add Function Help Text
Make a Function Stub
Rework Your Guessing Game
Find a Logic Problem
Solve the Logic Problem
Notice Double Use of computers_number
Understand How Scope Works
Communicate with Your Function
Send Information to a Function
Give Some Arguments a Default Value
Communicate from the Function
Add a Score
Let the User Quit
The Complete Code
Summary
Week 3: Creating Word Games
Project 6: Hacker Speaker: 1337 Sp34k3r
Waiter, There’s An Object In My String
Dot Your Objects’ Attributes
Meet the List
Go Through the Elements of a List
Create Your Own List
Create a List on Steroids
Test Whether an Element’s In a List
Planning Your Elite Hacker Speaker
Set Up Your File
Make Code Letter Substitutions
Replace a Letter
Let the User Enter a Message
Define Letter Substitutions
Apply all the Substitutions
Use print to Debug the Code
Debug with IDLE’s Debugger
Summary
Project 7: Cryptopy
Slice Off Those Dud Characters
Make a Substitution Table
Set Up Your Cipher
Use the Dictionary
Create an Encryption Dictionary
Use a join
Rewrite the Encryption Function
Write the Decryption Function
Encrypt a Text File
Encrypt and Decrypt from a File
Decrypt from Your Shell
Change the Code to Decrypt Too
The Complete Code
Summary
Project 8: Silly Sentences
Insert Format Strings
Have the Right Number of Values
Use the Tuple Data Type
Get Started on Your Silly Sentences
Fill the Template
Add More Words
The Complete Code
Summary
Week 4: Stepping Up to Object-Oriented Programming
Project 9: Address Book
Your First Class Objects
Create a Class
Create an Instance
Create Class and Instance Attributes
Plan Your Address Book
Set Up Your File and Create a Class
Add Your First Person
Instantiate an Instance Using __init__
Create a Function to Print the Instance
Use __repr__ Magic
Initialize the AddressBook Instance
Find Pickle Power
Add a save Function
Loading a Saved Pickle in the Same Application
Test the load Method
Add an Interface
Fill in the Methods
The Complete Code
Summary
Project 10: Math Trainer
Planning Your Math Trainer
Setting Up
Create Questions
Ask Lots of Questions in a Row
Print Out a Times Table
Print Multiple Tables Across the Screen
Start on the User Interface
Add Quit Functionality
Polishing It Off
Summary
About the Author
Cheat Sheet
Connect with Dummies
End User License Agreement
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Project 8: Silly Sentences
Next
Next Chapter
Project 9: Address Book
Week 4
Stepping Up to Object-Oriented Programming
This week you’re building an …
Address Book
Math Trainer
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset