Learn Programming
Ana Bell
  • MEAP began October 2016
  • Publication in April 2017 (estimated)
  • ISBN 9781617293788
  • 400 pages (estimated)
  • printed in black & white

Computer programming is one of the most marketable skills you can add to your resume. Whether you want to become a professional software developer, create web sites, analyze scientific data, or just automate tedious business tasks, learning to program is the first step. Fortunately, learning to program doesn't have to be difficult. All you need is some help to get going. Filled with practical examples and step-by-step lessons using the easy-on-the-brain Python language, this book will get you started!

Learn Programming is an introduction to the core skills and uses of computer programming. After a jargon-free guide to setting up your programming environment, you'll dive into the basics hands-on by writing your first programs! This easy-to-follow tutorial is full of exercises to practice and reinforce each new concept, so you'll have the confidence to move on to each new bite-sized lesson. As you progress, you'll learn programming topics and concepts common to all programming languages. By the end of the book, you'll have a practical grasp of how to write Python programs along with some solid programming best practices.

Table of Contents detailed table of contents

Unit 0 : Python and Your Programming Environment

Lesson 1 Why Should You Learn How to Program?

1.1 Why Programming Matters

1.1.1 Programming is not just for Professionals

1.1.2 Improve your Life

1.1.3 Challenge Yourself

1.2 Where you are now and where you will be

1.3 Our Plan for Learning how to Program

1.3.1 First Steps

1.3.2 Practice, practice, practice, practice

1.3.3 Thinking like a programmer

1.4 Summary

Lesson 2 Basic Principles of Learning a Programming Language

2.1 Programming as a Skill

2.2 A Parallel with Baking

2.2.1 Understand the Task "bake a loaf of bread"

2.2.2 The Recipe

2.2.3 Visualizing the Recipe with Flowcharts

2.2.4 Use an Existing Recipe or Make One Up?

2.3 Think, Code, Test, Debug, Repeat

2.3.1 Understanding the Task

2.3.2 Visualizing the Task

2.3.3 Writing Pseudocode

2.4 Writing Readable Code

2.4.1 Using Descriptive and Meaningful Names

2.4.2 Commenting Your Code

2.5 Summary

Unit 1: Variables, Types, Expressions, and Statements

Lesson 3 Introducing Python: A Programming Language

3.1 Installing Python

3.1.1 What is Python?

3.1.2 Downloading Python Version 3.5

3.1.3 Anaconda Python Distribution

3.1.4 Integrated Development Environments

3.2 Setting up your Workspace

3.2.1 The IPython Console

3.2.2 The File Editor

3.3 Summary

Lesson 4 Variables and Expressions: Giving Names and Values to Things

4.1 Giving Names to Things

4.1.1 Math versus Programming

4.1.2 What the Computer Can and Cannot Do

4.2 Introducing Variables

4.2.1 Objects are Things that can be Manipulated

4.2.2 Objects have Names

4.2.3 What Object Names are Allowed?

4.2.4 Creating a Variable

4.2.5 Updating a Variable

4.3 Summary

Lesson 5 Object Types and Statements of Code

5.1 Types of Things

5.2 Basic Type of Objects in Programming

5.2.1 Integers as Whole Numbers

5.2.2 Floating Point as Decimal Numbers

5.2.3 Booleans as True/False Data

5.2.4 Strings as Sequences of Characters

5.2.5 The Absence of a Value

5.3 Working with Basic Types of Data Values

5.3.1 Building Blocks of Expressions

5.3.2 Converting Between Different Types

5.3.3 How Arithmetic Impacts Object Types

5.4 Summary

Lesson 6 Capstone Project: Your First Python Program

6.1 What You Know so Far

6.2 Your First Programming Task: Convert Minutes to Hours

6.2.1 Think-Code-Test-Debug

6.2.2 Divide your Task

6.2.3 Implement the Conversion Formula

6.3 Your First Python Program: One Solution

6.4 Your First Python Program: Another Solution

6.5 Checkpoint Exercises

6.6 Summary

Unit 2: Strings, Tuples, and Interacting with the User

Lesson 7 Introducing String Objects: Sequences of Characters

7.1 Strings as Sequences of Characters

7.2 Basic Operations on Strings

7.2.1 Creating a string Object

7.2.2 Understanding Indexing into a String

7.2.3 Understanding Slicing a string

7.3 Other Operations on string Objects

7.3.1 Getting the Number of Characters in a String with len()

7.3.2 Converting Between Letter Cases with upper() and lower()

7.4 Summary

Lesson 8 Advanced String Operations

8.1.1 Find a Specific Substring in a String with find()

8.1.2 Find out if a Substring is in the String with "in"

8.1.3 Count how Many Times a Substring Occurs with count()

8.1.4 Replacing Substrings with replace()

8.2 Mathematical Operations

8.3 Summary

Lesson 9 Simple Error Messages

9.1 Reading Basic Error Messages

9.1.1 Type Up Statements and Try Things Out

9.1.2 String Error Messages

9.2 Summary

Lesson 10 Tuple Objects: Sequences of any Kind of Object

10.1 Tuples as Sequences of Data

10.1.1 Understanding the Tuple Object Representation

10.2 Understanding Operations on Tuples

10.2.1 Getting the tuple Length with len()

10.2.2 Indexing into and Slicing a tuple with []

10.2.3 Mathematical Operations

10.2.4 Swapping Objects Inside tuples

10.3 Summary

Lesson 11 Interacting with the User

11.1 Showing Output

11.1.1 Printing Expressions

11.1.2 Printing Multiple Objects

11.2 Getting User Input

11.2.1 Prompting the User

11.2.2 Reading the Input

11.2.3 Storing the Input in a Variable

11.2.4 Converting the User Input to a Different Type

11.2.5 Asking for More Inputs

11.3 Checkpoint Exercises

11.4 Summary

Lesson 12 Capstone Project: Name Mashup

12.1 The Programming Task

12.2 Understanding the Problem Statement

12.2.1 Drawing out a Sketch of the Problem

12.2.2 Coming up with a few Examples

12.2.3 Abstracting the Problem into Pseudocode

12.3 Splitting up First and Last Names

12.3.1 Finding the Space between the First and Last Name

12.3.2 Using Variables to Save Calculated Values

12.3.3 Testing what you have so Far

12.4 Storing the Halves of all Names

12.4.1 Finding the Midpoint of Names

12.5 Combining the Halves

12.6 Summary

Unit 3: Making Decisions in Your Programs

Lesson 13 Introducing Decisions in Programs

13.1 Making Decisions With Conditionals

13.1.1 Yes/No Questions and True/False Statements

13.1.2 Adding a Condition to a Statement

13.2 The Code to Make the Decision

13.2.1 Coding up a Decision - an Example

13.2.2 Coding up a Decision - a General Way

13.3 Structuring Your Programs

13.3.1 Making Many Decisions

13.3.2 Making Decisions Based on Other Decision’s Outcomes

13.3.3 A More Complicated Example with Nested Conditionals

13.4 Checkpoint Exercises

13.5 Summary

Lesson 14 Making More Complicated Decisions

14.1 Combining Multiple Conditions

14.1.1 Conditionals are Made up of True/False Expressions

14.1.2 Operator Precedence Rules

14.2 Choosing which Lines to Execute

14.2.1 Do this or that

14.2.2 Putting it All Together

14.2.3 Thinking in Terms of Code Blocks

14.3 Checkpoint Exercises

14.4 Summary

Lesson 15 Capstone Project: Choose Your Own Adventure

15.1 The Programming Task

15.2 Outlining the Game Rules

15.3 Creating Different Paths

15.4 More Choices? Yes, Please!

15.5 Summary

Unit 4: Repeating Tasks

Lesson 16 Repeating Tasks with Loops

16.1 Repeating a Task

16.1.1 Adding Non-Linearity to Programs

16.1.2 Infinite Repetitions

16.2 Looping a Certain Number of Times

16.2.1 for Loops

16.3 Looping N Times

16.3.1 Loops over the Common Sequence 0 to N-1

16.3.2 Unrolling Loops

16.4 Summary

Lesson 17 Customizing Loops

17.1 Customizing Loops

17.2 Looping Over Strings

17.3 Checkpoint Exercises

17.4 Summary

Lesson 18 Repeating Tasks while Conditions Hold

18.1 Looping While a Condition is True

18.1.1 Looping to Make a Guess

18.1.2 while Loops

18.1.3 Infinite Loop

18.2 for Loops vs while Loops

18.3 Manipulating Loops

18.3.1 Exiting Early out of a Loop

18.3.2 Going to the Beginning of a Loop

18.4 Checkpoint Exercises

18.5 Summary

Lesson 19 Capstone Project: Scrabble, Art Edition

19.1 Scrabble, Art Edition

19.2 Understanding the Problem Statement

19.2.1 Change the Representation of all Valid Words

19.2.2 Making a Valid Word with the Given Tiles

19.3 Dividing Up your Code into Pieces

19.4 Summary

Unit 5

Lesson 20 Building programs to last

Lesson 21 Achieving modularity and abstraction with functions

Lesson 22 Advanced operations with functions

Lesson 23 Capstone : Analyze your friends

Unit 6

Lesson 24 Introducing Collections of data

Lesson 25 Lists

Lesson 26 Dictionaries

Lesson 27 Aliasing an object

Lesson 28 Capstone : Plagiarism Detector

Unit 7

Lesson 29 Objects and Classes

Lesson 30 Working with Classes

Lesson 31 Object Oriented Programming

Lesson 32 Capstone : The solar system

Unit 8

Lesson 33 Debugging

Lesson 34 Useful Libraries

Lesson 35 File Input and Output

Lesson 36 What is a GUI

Lesson 37 Capstone : Traffic Simulator

Appendixes

Appendix A: Python Cheat Sheet

Appendix B: Interesting Python Packages

What's inside

  • Learn programming fundamentals for any language
  • Programming language basics like functions, classes, and file input/output
  • Writing data-centric and mathematical programs
  • Creating programs with graphical user interfaces
  • Programming best practices

About the reader

No programming experience needed.

About the author

Ana Bell is a lecturer at MIT in the Electrical Engineering and Computer Science department, where she co-lectures the Introduction to Computer Science and Programming Using Python course aimed at students with no programming experience.


Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
Buy
  • MEAP combo $34.99 pBook + eBook
  • MEAP eBook $27.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks