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

When you're ready to learn to program, Python is a great language to start with. It has a straightforward syntax, you'll find it easy to learn, and it's extremely versatile. Once you master the basics, you'll appreciate Python's very strong online community where you can continue learning and tinkering with more advanced programming techniques. All you need is some help to get going. Learning to program with Python doesn't have to be difficult, in fact it can even be fun. This book will get you started!

Learn Programming is an introduction to programming using one of the most popular programming languages. The first few chapters give you a quick background to programming concepts and a hands-on guide to setting up your programming environment. You will then be gently introduced to the basics of programming, building up to writing your first programs! This easy-to-follow tutorial is full of exercises to practice and reinforce each new concept, as well as to give you confidence that you are ready to move on to the next lesson. As you progress, you'll learn programming topics and concepts that are ubiquitous across almost all other programming languages. By the end of the book, you'll have a solid grasp of how to write programs as well as programming best practices.

Table of Contents detailed table of contents

Unit 0 Python and Your Programming Environment

1. Lesson 1 Why Should You Learn Python?

1.1. Introducing Python

1.2. Why you should care about Python

1.2.1. A general purpose language

1.2.2. Writing in Python is intuitive

1.2.3. Challenges in Using Python

1.3. Where you are now and where you will be

1.4. Our plan for learning Python

1.4.1. First Steps

1.4.2. Practice, practice, practice, practice

1.4.3. Thinking like a programmer

1.5. Summary

2. Lesson 2 Understanding your Programming Environment

2.1. Different Python Versions

2.1.1. Python Version 3.5

2.1.2. Downloading Python Version 3.5

2.1.3. Anaconda Python Distribution

2.1.4. Integrated Development Environments

2.2. Setting up your Workspace

2.2.1. The IPython Console

2.2.2. The File Editor

2.3. Summary

Unit 1 Programming Overview, Objects, and Statements

3. Lesson 3 Basic Principles of Learning a Programming Language

3.1. Programming as a Skill

3.2. A Parallel with Baking

3.2.1. Understand the Task "bake a loaf of bread"

3.2.2. The Recipe

3.2.3. Visualizing the Recipe with Flowcharts

3.2.4. Use an Existing Recipe or Make One Up?

3.3. Think, Code, Test, Debug, Repeat

3.3.1. Understanding the Task

3.3.2. Visualizing the Task

3.3.3. Writing Pseudocode

3.4. Writing Readable Code

3.4.1. Using Descriptive and Meaningful Names

3.4.2. Commenting Your Code

3.5. Summary

4. Lesson 4 Python Variables and Expressions

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 Python 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

5. Lesson 5 Object Types and Python Statements

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. NoneType as the Absence of a Type

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

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

7. Lesson 7 String Objects

7.1. Strings as Sequences of Characters

7.2. Creating a string Object

7.3. Understanding Indexing into a String

7.4. Understanding Slicing a string

7.5. Other Operations on string Objects

7.5.1. The Number of Characters in a String

7.5.2. Converting Between Letter Cases

7.5.3. Find a Substring

7.5.4. Is a Substring in the String?

7.5.5. Count how Many Times a Substring Occurs

7.5.6. Replacing Substrings

7.5.7. Mathematical Operations

7.6. Summary

8. Lesson 8 Simple Error Messages and Tuple Objects

8.1. Reading Basic Error Messages

8.1.1. Type Up Statements and Try Things Out

8.1.2. String Error Messages

8.2. Tuples as Sequences of Data

8.3. Understanding Tuple Values

8.4. Understanding Operations on Tuples

8.4.1. Getting the tuple Length

8.4.2. Indexing into and Slicing a tuple

8.4.3. Mathematical Operations

8.4.4. Swapping Objects Inside tuples

8.5. Summary

9. Lesson 9 Interacting with the User

9.1. Showing Output

9.1.1. Printing Expressions

9.1.2. Printing Multiple Objects

9.2. Getting User Input

9.2.1. Prompting the User

9.2.2. Reading the Input

9.2.3. Storing the Input in a Variable

9.2.4. Converting the User Input to a Different Type

9.2.5. Asking for More Inputs

9.3. Checkpoint Exercises

9.4. Summary

10. Lesson 10 Capstone Project: Name Mashup

10.1. The Programming Task

10.2. Understanding the Problem Statement

10.2.1. Drawing out a Sketch of the Problem

10.2.2. Coming up with a few Examples

10.2.3. Abstracting the Problem into Pseudocode

10.3. Splitting up First and Last Names

10.3.1. Finding the Space between the First and Last Name

10.3.2. Using Variables to Save Calculated Values

10.3.3. Testing what you have so Far

10.4. Storing the Halves of all Names

10.4.1. Finding the Midpoint of Names

10.5. Combining the Halves

10.6. Summary

Unit 3 Making Decisions in Your Programs

11. Lesson 11 Introducing Control Flow in Programs

11.1. Making Decisions With Conditionals

11.1.1. Yes/No Questions and True/False Statements

11.1.2. Adding a Condition to a Statement

11.2. The Code to Make the Decision

11.2.1. Coding up a Decision - an Example

11.2.2. Coding up a Decision - a General Way

11.3. Structuring Your Programs

11.3.1. Making Many Decisions

11.3.2. Making Decisions Based on Other Decision’s Outcomes

11.3.3. A More Complicated Example with Nested Conditionals

11.4. Checkpoint Exercises

11.5. Summary

12. Lesson 12 Making More Complicated Decisions

12.1. Combining Multiple Conditions

12.1.1. Conditionals are Made up of True/False Expressions

12.1.2. Operator Precedence Rules

12.2. Choosing which Lines to Execute

12.2.1. Do this or that

12.2.2. Putting it All Together

12.2.3. Thinking in Terms of Code Blocks

12.3. Checkpoint Exercises

12.4. Summary

13. Lesson 13 Capstone Project: Choose Your Own Adventure

13.1. The Programming Task

13.2. Outlining the Game Rules

13.3. Creating Different Paths

13.4. More Choices? Yes, Please!

13.5. Summary

14. Lesson 14 Repeating Tasks with Loops

14.1. Repeating a Task

14.1.1. Adding Non-Linearity to Programs

14.1.2. Infinite Repetitions

14.2. Looping a Certain Number of Times

14.2.1. for Loops

14.3. Looping N Times

14.3.1. Loops over the Common Sequence 0 to N-1

14.3.2. Unrolling Loops

14.4. Summary

Unit 4

15. Lesson 15 Customizing Loops

16. Lesson 16 Repeating Tasks while Conditions Hold

17. Lesson 17 CAPSTONE PROJECT: Escape the Maze

Unit 5

18. Lesson 18 Building Programs to Last

19. Lesson 19 Achieving Modularity and Abstraction with Functions

20. Lesson 20 Advanced Operations with Functions

21. Lesson 21 CAPSTONE PROJECT: Analyze Your Friends

Unit 6

22. Lesson 22 Introducing Collections of Data

23. Lesson 23 Python Lists

24. Lesson 24 Python Dictionaries

25. Lesson 25 Aliasing an Object

26. Lesson 26 CAPSTONE PROJECT: Plagiarism Detector

Unit 7

27. Lesson 27 Introducing Python Objects and Classes

28. Lesson 28 Working with Classes

29. Lesson 29 Object Oriented Programming

30. Lesson 30 CAPSTONE PROJECT: The Solar System

Unit 8

31. Lesson 31 Debugging

32. Lesson 32 Useful Libraries

33. Lesson 33 File Input and Output

34. Lesson 34 What is a GUI

35. Lesson 35 CAPSTONE PROJECT: Traffic Simulator

36. Lesson 36 What's Next?

37. Lesson 37 CAPSTONE PROJECT: Movie Picker

Appendixes

Appendix A: Python Cheat Sheet

Appendix B: Interesting Python Packages

What's inside

  • Learn programming fundamentals for any language
  • Python 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