O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Python® Programming for Teens

Book Description

If you want to learn how to program in Python, one of today's most popular computer programming languages, PYTHON PROGRAMMING FOR TEENS is the perfect first step. Written by teacher, author, and Python expert Kenneth Lambert, this book will help you build a solid understanding of programming and prepare you to make the jump to other languages and more advanced instruction. In PYTHON PROGRAMMING FOR TEENS, you will learn problem solving, program development, the basics of using classes and objects, and more. Special topics include 2-D geometry, fractals, animations, and recursion. The book's topics are illustrated using turtle graphics, a system that provides graphical output from programs and makes learning more fun. Get started programming today with PYTHON PROGRAMMING FOR TEENS.

Table of Contents

  1. Title Page
  2. Copyright Page
  3. Dedication
  4. Acknowledgments
  5. About the Author
  6. Contents
  7. Introduction
  8. Chapter 1 Getting Started with Python
    1. Taking Care of Preliminaries
    2. Working with Numbers
    3. Working with Strings
    4. Working with Lists
    5. Working with Dictionaries
    6. Summary
    7. Exercises
  9. Chapter 2 Getting Started with Turtle Graphics
    1. Looking at the Turtle and Its World
    2. Using Basic Movement Operations
    3. Setting and Examining the Turtle’s State
    4. Working with Colors
    5. Drawing Circles
    6. Drawing Text
    7. Using the Turtle’s Window and Canvas
    8. Using a Configuration File
    9. Summary
    10. Exercises
  10. Chapter 3 Control Structures: Sequencing, Iteration, and Selection
    1. Repeating a Sequence of Statements: Iteration
    2. Asking Questions: Boolean Expressions
    3. Making Choices: Selection Statements
    4. Using Selection to Control Iteration
    5. Summary
    6. Exercises
  11. Chapter 4 Composing, Saving, and Running Programs
    1. Exploring the Program Development Process
    2. Composing a Program
    3. Running a Program
    4. Looking Behind the Scenes: How Python Runs Programs
    5. Summary
    6. Exercises
  12. Chapter 5 Defining Functions
    1. Basic Elements of Function Definitions
    2. Functions as General Solutions to Problems
    3. Modules as Libraries of Functions
    4. Math Topic: Graphing Functions
    5. Refactoring a Program with Functions
    6. Summary
    7. Exercises
  13. Chapter 6 User Interaction with the Mouse and the Keyboard
    1. Using Dialog-Based Input
    2. Responding to Mouse Events
    3. Responding to Keyboard Events
    4. Using Module Variables
    5. Using Two Mouse Buttons
    6. Summary
    7. Exercises
  14. Chapter 7 Recursion
    1. Recursive Design
    2. Recursive Patterns in Art: Abstract Painting
    3. Recursive Patterns in Nature: Fractals
    4. Summary
    5. Exercises
  15. Chapter 8 Objects and Classes
    1. Objects, Methods, and Classes in Turtle Graphics
    2. A New Class: RegularPolygon
    3. New Class: Menu Item
    4. A Grid Class for the Game of Tic-Tac-Toe
    5. Summary
    6. Exercises
  16. Chapter 9 Animations
    1. Animating the Turtle with a Timer
    2. Animating Many Turtles
    3. Creating Custom Turtle Shapes
    4. Summary
    5. Exercises
  17. Appendix A Turtle Graphics Commands
    1. Turtle Functions
    2. Functions Related to the Window and Canvas
  18. Appendix B Solutions to Exercises
    1. Exercise Solutions for Chapter 1
    2. Exercise Solutions for Chapter 2
    3. Exercise Solutions for Chapter 3
    4. Exercise Solutions for Chapter 4
    5. Exercise Solutions for Chapter 5
    6. Exercise Solutions for Chapter 6
    7. Exercise Solutions for Chapter 7
    8. Exercise Solutions for Chapter 8
    9. Exercise Solutions for Chapter 9
  19. Index