Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo
Python: Visual QuickStart Guide, Third Edition

Book Description

Python is a remarkably powerful dynamic programming language used in a wide variety of situations such as Web, database access, desktop GUIs, game and software development, and network programming. Fans of Python use the phrase "batteries included" to describe the standard library, which covers everything from asynchronous processing to zip files. The language itself is a flexible powerhouse that can handle practically any application domain.

This task-based tutorial on Python is for those new to the language and walks you through the fundamentals. You'll learn about arithmetic, strings, and variables; writing programs; flow of control, functions; strings; data structures; input and output; and exception handling. At the end of the book, a special section walks you through a longer, realistic application, tying the concepts of the book together.

Table of Contents

  1. Title Page
  2. Copyright Page
  3. Acknowledgments
  4. Contents at a Glance
  5. Table of Contents
  6. 1. Introduction to Programming
    1. The Python Language
    2. What Is Python Useful For?
    3. How Programmers Work
    4. Installing Python
  7. 2. Arithmetic, Strings, and Variables
    1. The Interactive Command Shell
    2. Integer Arithmetic
    3. Floating Point Arithmetic
    4. Other Math Functions
    5. Strings
    6. String Concatenation
    7. Getting Help
    8. Converting Between Types
    9. Variables and Values
    10. Assignment Statements
    11. How Variables Refer to Values
    12. Multiple Assignment
  8. 3. Writing Programs
    1. Using IDLE’s Editor
    2. Compiling Source Code
    3. Reading Strings from the Keyboard
    4. Printing Strings on the Screen
    5. Source Code Comments
    6. Structuring a Program
  9. 4. Flow of Control
    1. Boolean Logic
    2. If-Statements
    3. Code Blocks and Indentation
    4. Loops
    5. Comparing For-Loops and While-Loops
    6. Breaking Out of Loops and Blocks
    7. Loops Within Loops
  10. 5. Functions
    1. Calling Functions
    2. Defining Functions
    3. Variable Scope
    4. Using a main Function
    5. Function Parameters
    6. Modules
  11. 6. Strings
    1. String Indexing
    2. Characters
    3. Slicing Strings
    4. Standard String Functions
    5. Regular Expressions
  12. 7. Data Structures
    1. The type Command
    2. Sequences
    3. Tuples
    4. Lists
    5. List Functions
    6. Sorting Lists
    7. List Comprehensions
    8. Dictionaries
    9. Sets
  13. 8. Input and Output
    1. Formatting Strings
    2. String Formatting
    3. Reading and Writing Files
    4. Examining Files and Folders
    5. Processing Text Files
    6. Processing Binary Files
    7. Reading Webpages
  14. 9. Exception Handling
    1. Exceptions
    2. Catching Exceptions
    3. Clean-Up Actions
  15. 10. Object-Oriented Programming
    1. Writing a Class
    2. Displaying Objects
    3. Flexible Initialization
    4. Setters and Getters
    5. Inheritance
    6. Polymorphism
    7. Learning More
  16. 11. Case Study: Text Statistics
    1. Problem Description
    2. Keeping the Letters We Want
    3. Testing the Code on a Large Data File
    4. Finding the Most Frequent Words
    5. Converting a String to a Frequency Dictionary
    6. Putting It All Together
    7. Exercises
    8. The Final Program
  17. A. Popular Python Packages
    1. Some Popular Packages
  18. B. Comparing Python 2 and Python 3
    1. What’s New in Python 3
  19. Index