You are previewing Beginning Programming with Python For Dummies.
O'Reilly logo
Beginning Programming with Python For Dummies

Book Description

Learn Python—the fun and easy way—and get in the programming game today!

Python is one of the fastest growing programming languages, and no wonder. It requires three to five times less time than developing in Java, is a great building block for learning both procedural and object-oriented programming concepts, and is an ideal language for data analysis. Beginning Programming with Python For Dummies is the perfect guide to this dynamic and powerful programming language—even if you've never coded before! Author John Paul Mueller draws on his vast programming knowledge and experience to guide you step-by-step through the syntax and logic of programming with Python and provides several real-world programming examples to give you hands-on experience trying out what you've learned.

  • Provides a solid understanding of basic computer programming concepts and helps familiarize you with syntax and logic

  • Explains the fundamentals of procedural and object-oriented programming

  • Shows how Python is being used for data analysis and other applications

  • Includes short, practical programming samples to apply your skills to real-world programming scenarios

  • Whether you've never written a line of code or are just trying to pick up Python, there's nothing to fear with the fun and friendly Beginning Programming with Python For Dummies leading the way.

    Table of Contents

      1. Introduction
        1. About This Book
        2. Foolish Assumptions
        3. Icons Used in This Book
        4. Beyond the Book
        5. Where to Go from Here
      2. Part I: Getting Started with Python
        1. Chapter 1: Talking to Your Computer
          1. Understanding Why You Want to Talk to Your Computer
          2. Knowing that an Application is a Form of Communication
            1. Thinking about procedures you use daily
            2. Writing procedures down
            3. Seeing applications as being like any other procedure
            4. Understanding that computers take things literally
          3. Defining What an Application Is
            1. Understanding that computers use a special language
            2. Helping humans speak to the computer
          4. Understanding Why Python is So Cool
            1. Unearthing the reasons for using Python
            2. Deciding how you can personally benefit from Python
            3. Discovering which organizations use Python
            4. Finding useful Python applications
            5. Comparing Python to other languages
        2. Chapter 2: Getting Your Own Copy of Python
          1. Downloading the Version You Need
          2. Installing Python
            1. Working with Windows
            2. Working with the Mac
            3. Working with Linux
          3. Accessing Python on Your Machine
            1. Using Windows
            2. Using the Mac
            3. Using Linux
          4. Testing Your Installation
        3. Chapter 3: Interacting with Python
          1. Opening the Command Line
            1. Starting Python
            2. Using the command line to your advantage
            3. Using Python environment variables to your advantage
          2. Typing a Command
            1. Telling the computer what to do
            2. Telling the computer you’re done
            3. Seeing the result
          3. Using Help
            1. Getting into help mode
            2. Asking for help
            3. Leaving help mode
            4. Obtaining help directly
          4. Closing the Command Line
        4. Chapter 4: Writing Your First Application
          1. Understanding the Integrated DeveLopment Environment (IDLE)
          2. Starting IDLE
            1. Using standard commands
            2. Understanding color coding
            3. Getting GUI help
            4. Configuring IDLE
          3. Creating the Application
            1. Opening a new window
            2. Typing the command
            3. Saving the file
          4. Running the Application
          5. Understanding the Use of Indentation
          6. Adding Comments
            1. Understanding comments
            2. Using comments to leave yourself reminders
            3. Using comments to keep code from executing
          7. Loading and Running Existing Applications
            1. Using the command line or terminal window
            2. Using the Edit window
            3. Using the Python Shell window or Python command line
          8. Closing IDLE
      3. Part II: Talking the Talk
        1. Chapter 5: Storing and Modifying Information
          1. Storing Information
            1. Seeing variables as storage boxes
            2. Using the right box to store the data
          2. Defining the Essential Python Data Types
            1. Putting information into variables
            2. Understanding the numeric types
            3. Understanding Boolean values
            4. Understanding strings
          3. Working with Dates and Times
        2. Chapter 6: Managing Information
          1. Controlling How Python Views Data
            1. Making comparisons
            2. Understanding how computers make comparisons
          2. Working with Operators
            1. Defining the operators
            2. Understanding operator precedence
          3. Creating and Using Functions
            1. Viewing functions as code packages
            2. Understanding code reusability
            3. Defining a function
            4. Accessing functions
            5. Sending information to functions
            6. Returning information from functions
            7. Comparing function output
          4. Getting User Input
        3. Chapter 7: Making Decisions
          1. Making Simple Decisions Using the if Statement
            1. Understanding the if statement
            2. Using the if statement in an application
          2. Choosing Alternatives Using the if...else Statement
            1. Understanding the if...else statement
            2. Using the if...else statement in an application
            3. Using the if...elif statement in an application
          3. Using Nested Decision Statements
            1. Using multiple if or if...else statements
            2. Combining other types of decisions
        4. Chapter 8: Performing Repetitive Tasks
          1. Processing Data Using the for Statement
            1. Understanding the for statement
            2. Creating a basic for loop
            3. Controlling execution with the break statement
            4. Controlling execution with the continue statement
            5. Controlling execution with the pass clause
            6. Controlling execution with the else statement
          2. Processing Data Using the while Statement
            1. Understanding the while statement
            2. Using the while statement in an application
          3. Nesting Loop Statements
        5. Chapter 9: Dealing with Errors
          1. Knowing Why Python Doesn’t Understand You
          2. Considering the Sources of Errors
            1. Classifying when errors occur
            2. Distinguishing error types
          3. Catching Exceptions
            1. Basic exception handling
            2. Handling more specific to less specific exceptions
            3. Nested exception handling
          4. Raising Exceptions
            1. Raising exceptions during exceptional conditions
            2. Passing error information to the caller
          5. Creating and Using Custom Exceptions
          6. Using the finally Clause
      4. Part III: Performing Common Tasks
        1. Chapter 10: Interacting with Modules
          1. Creating Code Groupings
          2. Importing Modules
            1. Using the import statement
            2. Using the from...import statement
          3. Finding Modules on Disk
          4. Viewing the Module Content
          5. Using the Python Module Documentation
            1. Opening the pydoc application
            2. Using the quick-access links
            3. Typing a search term
            4. Viewing the results
        2. Chapter 11: Working with Strings
          1. Understanding That Strings Are Different
            1. Defining a character using numbers
            2. Using characters to create strings
          2. Creating Stings with Special Characters
          3. Selecting Individual Characters
          4. Slicing and Dicing Strings
          5. Locating a Value in a String
          6. Formatting Strings
        3. Chapter 12: Managing Lists
          1. Organizing Information in an Application
            1. Defining organization using lists
            2. Understanding how computers view lists
          2. Creating Lists
          3. Accessing Lists
          4. Looping through Lists
          5. Modifying Lists
          6. Searching Lists
          7. Sorting Lists
          8. Working with the Counter Object
        4. Chapter 13: Collecting All Sorts of Data
          1. Understanding Collections
          2. Working with Tuples
          3. Working with Dictionaries
            1. Creating and using a dictionary
            2. Replacing the switch statement with a dictionary
          4. Creating Stacks Using Lists
          5. Working with queues
          6. Working with deques
        5. Chapter 14: Creating and Using Classes
          1. Understanding the Class as a Packaging Method
          2. Considering the Parts of a Class
            1. Creating the class definition
            2. Considering the built-in class attributes
            3. Working with methods
            4. Working with constructors
            5. Working with variables
            6. Using methods with variable argument lists
            7. Overloading operators
          3. Creating a Class
          4. Using the Class in an Application
          5. Extending Classes to Make New Classes
            1. Building the child class
            2. Testing the class in an application
      5. Part IV: Performing Advanced Tasks
        1. Chapter 15: Storing Data in Files
          1. Understanding How Permanent Storage Works
          2. Creating Content for Permanent Storage
          3. Creating a File
          4. Reading File Content
          5. Updating File Content
          6. Deleting a File
        2. Chapter 16: Sending an E-Mail
          1. Understanding What Happens When You Send E-mail
            1. Viewing e-mail as you do a letter
            2. Defining the parts of the envelope
            3. Defining the parts of the letter
          2. Creating the E-mail Message
            1. Working with a text message
            2. Working with an HTML message
          3. Seeing the E-mail Output
      6. Part V: The Part of Tens
        1. Chapter 17: Ten Amazing Programming Resources
          1. Working with the Python Documentation Online
          2. Using the Tutorial
          3. Performing Web Programming Using Python
          4. Getting Additional Libraries
          5. Creating Applications Faster Using an IDE
          6. Checking Your Syntax with Greater Ease
          7. Using XML to Your Advantage
          8. Getting Past the Common Python Newbie Errors
          9. Understanding Unicode
          10. Making Your Python Application Fast
        2. Chapter 18: Ten Ways to Make a Living with Python
          1. Working in QA
          2. Becoming the IT Staff for a Smaller Organization
          3. Performing Specialty Scripting for Applications
          4. Administering a Network
          5. Teaching Programming Skills
          6. Helping People Decide on Location
          7. Performing Data Mining
          8. Interacting with Embedded Systems
          9. Carrying Out Scientific Tasks
          10. Performing Real-Time Analysis of Data
        3. Chapter 19: Ten Interesting Tools
          1. Tracking Bugs with Roundup Issue Tracker
          2. Creating a Virtual Environment Using VirtualEnv
          3. Installing Your Application Using PyInstaller
          4. Building Developer Documentation Using pdoc
          5. Developing Application Code Using Komodo Edit
          6. Debugging Your Application Using pydbgr
          7. Entering an Interactive Environment Using IPython
          8. Testing Python Applications Using PyUnit
          9. Tidying Your Code Using Isort
          10. Providing Version Control Using Mercurial
        4. Chapter 20: Ten Libraries You Need to Know About
          1. Developing a Secure Environment Using PyCrypto
          2. Interacting with Databases Using SQLAlchemy
          3. Seeing the World Using Google Maps
          4. Adding a Graphical User Interface Using TkInter
          5. Providing a Nice Tabular Data Presentation Using PrettyTable
          6. Enhancing Your Application with Sound Using PyAudio
          7. Manipulating Images Using PyQtGraph
          8. Locating Your Information Using IRLib
          9. Creating an Interoperable Java Environment Using JPype
          10. Accessing Local Network Resources Using Twisted Matrix
          11. Accessing Internet Resources Using Libraries
      7. About the Author
      8. Cheat Sheet