Contents

Preface

Improvements in the Python 3 Edition

The Hard Way Is Easier

Reading and Writing

Attention to Detail

Spotting Differences

Ask, Don’t Stare

Do Not Copy-Paste

Using the Included Videos

A Note on Practice and Persistence

Acknowledgments

Exercise 0 The Setup

macOS

macOS: What You Should See

Windows

Windows: What You Should See

Linux

Linux: What You Should See

Finding Things on the Internet

Warnings for Beginners

Alternative Text Editors

Exercise 1 A Good First Program

What You Should See

Study Drills

Common Student Questions

Exercise 2 Comments and Pound Characters

What You Should See

Study Drills

Common Student Questions

Exercise 3 Numbers and Math

What You Should See

Study Drills

Common Student Questions

Exercise 4 Variables and Names

What You Should See

Study Drills

Common Student Questions

Exercise 5 More Variables and Printing

What You Should See

Study Drills

Common Student Questions

Exercise 6 Strings and Text

What You Should See

Study Drills

Break It

Common Student Questions

Exercise 7 More Printing

What You Should See

Study Drills

Break It

Common Student Questions

Exercise 8 Printing, Printing

What You Should See

Study Drills

Common Student Questions

Exercise 9 Printing, Printing, Printing

What You Should See

Study Drills

Common Student Questions

Exercise 10 What Was That?

What You Should See

Escape Sequences

Study Drills

Common Student Questions

Exercise 11 Asking Questions

What You Should See

Study Drills

Common Student Questions

Exercise 12 Prompting People

What You Should See

Study Drills

Common Student Questions

Exercise 13 Parameters, Unpacking, Variables

Hold Up! Features Have Another Name

What You Should See

Study Drills

Common Student Questions

Exercise 14 Prompting and Passing

What You Should See

Study Drills

Common Student Questions

Exercise 15 Reading Files

What You Should See

Study Drills

Common Student Questions

Exercise 16 Reading and Writing Files

What You Should See

Study Drills

Common Student Questions

Exercise 17 More Files

What You Should See

Study Drills

Common Student Questions

Exercise 18 Names, Variables, Code, Functions

What You Should See

Study Drills

Common Student Questions

Exercise 19 Functions and Variables

What You Should See

Study Drills

Common Student Questions

Exercise 20 Functions and Files

What You Should See

Study Drills

Common Student Questions

Exercise 21 Functions Can Return Something

What You Should See

Study Drills

Common Student Questions

Exercise 22 What Do You Know So Far?

What You Are Learning

Exercise 23 Strings, Bytes, and Character Encodings

Initial Research

Switches, Conventions, and Encodings

Disecting the Output

Disecting the Code

Encodings Deep Dive

Breaking It

Exercise 24 More Practice

What You Should See

Study Drills

Common Student Questions

Exercise 25 Even More Practice

What You Should See

Study Drills

Common Student Questions

Exercise 26 Congratulations, Take a Test!

Common Student Questions

Exercise 27 Memorizing Logic

The Truth Terms

The Truth Tables

Common Student Questions

Exercise 28 Boolean Practice

What You Should See

Study Drills

Common Student Questions

Exercise 29 What If

What You Should See

Study Drills

Common Student Questions

Exercise 30 Else and If

What You Should See

Study Drills

Common Student Questions

Exercise 31 Making Decisions

What You Should See

Study Drills

Common Student Questions

Exercise 32 Loops and Lists

What You Should See

Study Drills

Common Student Questions

Exercise 33 While Loops

What You Should See

Study Drills

Common Student Questions

Exercise 34 Accessing Elements of Lists

Study Drills

Exercise 35 Branches and Functions

What You Should See

Study Drills

Common Student Questions

Exercise 36 Designing and Debugging

Rules for if-statements

Rules for Loops

Tips for Debugging

Homework

Exercise 37 Symbol Review

Keywords

Data Types

String Escape Sequences

Old Style String Formats

Operators

Reading Code

Study Drills

Common Student Questions

Exercise 38 Doing Things to Lists

What You Should See

What Lists Can Do

When to Use Lists

Study Drills

Common Student Questions

Exercise 39 Dictionaries, Oh Lovely Dictionaries

A Dictionary Example

What You Should See

What Dictionaries Can Do

Study Drills

Common Student Questions

Exercise 40 Modules, Classes, and Objects

Modules Are Like Dictionaries

Classes Are Like Modules

Objects Are Like Import

Getting Things from Things

A First Class Example

What You Should See

Study Drills

Common Student Questions

Exercise 41 Learning to Speak Object-Oriented

Word Drills

Phrase Drills

Combined Drills

A Reading Test

Practice English to Code

Reading More Code

Common Student Questions

Exercise 42 Is-A, Has-A, Objects, and Classes

How This Looks in Code

About class Name(object)

Study Drills

Common Student Questions

Exercise 43 Basic Object-Oriented Analysis and Design

The Analysis of a Simple Game Engine

Write or Draw About the Problem

Extract Key Concepts and Research Them

Create a Class Hierarchy and Object Map for the Concepts

Code the Classes and a Test to Run Them

Repeat and Refine

Top Down versus Bottom Up

The Code for “Gothons from Planet Percal #25”

What You Should See

Study Drills

Common Student Questions

Exercise 44 Inheritance versus Composition

What Is Inheritance?

Implicit Inheritance

Override Explicitly

Alter Before or After

All Three Combined

The Reason for super()

Using super() with __init__

Composition

When to Use Inheritance or Composition

Study Drills

Common Student Questions

Exercise 45 You Make a Game

Evaluating Your Game

Function Style

Class Style

Code Style

Good Comments

Evaluate Your Game

Exercise 46 A Project Skeleton

macOS/Linux Setup

Windows 10 Setup

Creating the Skeleton Project Directory

Final Directory Structure

Testing Your Setup

Using the Skeleton

Required Quiz

Common Student Questions

Exercise 47 Automated Testing

Writing a Test Case

Testing Guidelines

What You Should See

Study Drills

Common Student Questions

Exercise 48 Advanced User Input

Our Game Lexicon

Breaking Up a Sentence

Lexicon Tuples

Scanning Input

Exceptions and Numbers

A Test First Challenge

What You Should Test

Study Drills

Common Student Questions

Exercise 49 Making Sentences

Match and Peek

The Sentence Grammar

A Word on Exceptions

The Parser Code

Playing with the Parser

What You Should Test

Study Drills

Common Student Questions

Exercise 50 Your First Website

Installing flask

Make a Simple “Hello World” Project

What’s Going On?

Fixing Errors

Create Basic Templates

Study Drills

Common Student Questions

Exercise 51 Getting Input from a Browser

How the Web Works

How Forms Work

Creating HTML Forms

Creating a Layout Template

Writing Automated Tests for Forms

Study Drills

Breaking It

Exercise 52 The Start of Your Web Game

Refactoring the Exercise 43 Game

Creating an Engine

Your Final Exam

Common Student Questions

Next Steps

How to Learn Any Programming Language

Advice from an Old Programmer

Appendix Command Line Crash Course

Introduction: Shut Up and Shell

How to Use This Appendix

You Will Be Memorizing Things

The Setup

Do This

You Learned This

Do More

Paths, Folders, Directories (pwd)

Do This

You Learned This

Do More

If You Get Lost

Do This

You Learned This

Make a Directory (mkdir)

Do This

You Learned This

Do More

Change Directory (cd)

Do This

You Learned This

Do More

List Directory (ls)

Do This

You Learned This

Do More

Remove Directory (rmdir)

Do This

You Learned This

Do More

Moving Around (pushd, popd)

Do This

You Learned This

Do More

Making Empty Files (touch/New-Item)

Do This

You Learned This

Do More

Copy a File (cp)

Do This

You Learned This

Do More

Moving a File (mv)

Do This

You Learned This

Do More

View a File (less/more)

Do This

You Learned This

Do More

Stream a File (cat)

Do This

You Learned This

Do More

Removing a File (rm)

Do This

You Learned This

Do More

Exiting Your Terminal (exit)

Do This

You Learned This

Do More

Command Line Next Steps

Unix Bash References

PowerShell References

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.211.66