The easy way to learn programming fundamentals with Python
Python is a remarkably powerful and dynamic programming language that's used in a wide variety of application domains. Some of its key distinguishing features include a very clear, readable syntax, strong introspection capabilities, intuitive object orientation, and natural expression of procedural code. Plus, Python features full modularity, supporting hierarchical packages, exception-based error handling, and modules easily written in C, C++, Java, R, or .NET languages, such as C#. In addition, Python supports a number of coding styles that include: functional, imperative, object-oriented, and procedural.
Due to its ease of use and flexibility, Python is constantly growing in popularity--and now you can wear your programming hat with pride and join the ranks of the pros with the help of this guide. Inside, expert author John Paul Mueller gives a complete step-by-step overview of all there is to know about Python. From performing common and advanced tasks, to collecting data, to interacting with package--this book covers it all!
Use Python to create and run your first application Find out how to troubleshoot and fix errors Learn to work with Anaconda and use Magic Functions Benefit from completely updated and revised information since the last edition If you've never used Python or are new to programming in general, Beginning Programming with Python For Dummies is a helpful resource that will set you up for success.
Author(s): John Paul Mueller
Edition: 2
Publisher: For Dummies
Year: 2018
Language: English
Pages: 392
Title Page
Copyright Page
Table of Contents
Introduction
About This Book
Foolish Assumptions
Icons Used in This Book
Beyond the Book
Where to Go from Here
Part
1 Getting Started with Python
Chapter 1 Talking to Your Computer
Understanding Why You Want to Talk to Your Computer
Knowing that an Application is a Form of Communication
Thinking about procedures you use daily
Writing procedures down
Seeing applications as being like any other procedure
Understanding that computers take things literally
Defining What an Application Is
Understanding that computers use a special language
Helping humans speak to the computer
Understanding Why Python is So Cool
Unearthing the reasons for using Python
Deciding how you can personally benefit from Python
Discovering which organizations use Python
Finding useful Python applications
Comparing Python to other languages
Chapter 2 Getting Your Own Copy of Python
Downloading the Version You Need
Installing Python
Working with Windows
Working with the Mac
Working with Linux
Accessing Python on Your Machine
Using Windows
Using the Mac
Using Linux
Testing Your Installation
Chapter 3 Interacting with Python
Opening the Command Line
Starting Python
Using the command line to your advantage
Using Python environment variables to your advantage
Typing a Command
Telling the computer what to do
Telling the computer you’re done
Seeing the result
Using Help
Getting into help mode
Asking for help
Leaving help mode
Obtaining help directly
Closing the Command Line
Chapter 4 Writing Your First Application
Understanding Why IDEs Are Important
Creating better code
Debugging functionality
Defining why notebooks are useful
Obtaining Your Copy of Anaconda
Obtaining Analytics Anaconda
Installing Anaconda on Linux
Installing Anaconda on MacOS
Installing Anaconda on Windows
Downloading the Datasets and Example Code
Using Jupyter Notebook
Defining the code repository
Creating the Application
Understanding cells
Adding documentation cells
Other cell content
Understanding the Use of Indentation
Adding Comments
Understanding comments
Using comments to leave yourself reminders
Using comments to keep code from executing
Closing Jupyter Notebook
Chapter 5 Working with Anaconda
Downloading Your Code
Working with Checkpoints
Defining the uses of checkpoints
Saving a checkpoint
Restoring a checkpoint
Manipulating Cells
Adding various cell types
Splitting and merging cells
Moving cells around
Running cells
Toggling outputs
Changing Jupyter Notebook’s Appearance
Finding commands using the Command Palette
Working with line numbers
Using the Cell Toolbar features
Interacting with the Kernel
Obtaining Help
Using the Magic Functions
Viewing the Running Processes
Part
2 Talking the Talk
Chapter 6 Storing and Modifying Information
Storing Information
Seeing variables as storage boxes
Using the right box to store the data
Defining the Essential Python Data Types
Putting information into variables
Understanding the numeric types
Understanding Boolean values
Understanding strings
Working with Dates and Times
Chapter 7 Managing Information
Controlling How Python Views Data
Making comparisons
Understanding how computers make comparisons
Working with Operators
Defining the operators
Understanding operator precedence
Creating and Using Functions
Viewing functions as code packages
Understanding code reusability
Defining a function
Accessing functions
Sending information to functions
Returning information from functions
Comparing function output
Getting User Input
Chapter 8 Making Decisions
Making Simple Decisions by Using the if Statement
Understanding the if statement
Using the if statement in an application
Choosing Alternatives by Using the if. . .else Statement
Understanding the if. . .else statement
Using the if. . .else statement in an application
Using the if. . .elif statement in an application
Using Nested Decision Statements
Using multiple if or if. . .else statements
Combining other types of decisions
Chapter 9 Performing Repetitive Tasks
Processing Data Using the for Statement
Understanding the for statement
Creating a basic for loop
Controlling execution with the break statement
Controlling execution with the continue statement
Controlling execution with the pass clause
Controlling execution with the else statement
Processing Data by Using the while Statement
Understanding the while statement
Using the while statement in an application
Nesting Loop Statements
Chapter 10 Dealing with Errors
Knowing Why Python Doesn’t Understand You
Considering the Sources of Errors
Classifying when errors occur
Distinguishing error types
Catching Exceptions
Basic exception handling
Handling more specific to less specific exceptions
Nested exception handling
Raising Exceptions
Raising exceptions during exceptional conditions
Passing error information to the caller
Creating and Using Custom Exceptions
Using the finally Clause
Part
3 Performing Common Tasks
Chapter 11 Interacting with Packages
Creating Code Groupings
Understanding the package types
Considering the package cache
Importing Packages
Using the import statement
Using the from. . .import statement
Finding Packages on Disk
Downloading Packages from Other Sources
Opening the Anaconda Prompt
Working with conda packages
Installing packages by using pip
Viewing the Package Content
Viewing Package Documentation
Opening the Pydoc application
Using the quick-access links
Typing a search term
Viewing the results
Chapter 12 Working with Strings
Understanding That Strings Are Different
Defining a character by using numbers
Using characters to create strings
Creating Stings with Special Characters
Selecting Individual Characters
Slicing and Dicing Strings
Locating a Value in a String
Formatting Strings
Chapter 13 Managing Lists
Organizing Information in an Application
Defining organization using lists
Understanding how computers view lists
Creating Lists
Accessing Lists
Looping through Lists
Modifying Lists
Searching Lists
Sorting Lists
Printing Lists
Working with the Counter Object
Chapter 14 Collecting All Sorts of Data
Understanding Collections
Working with Tuples
Working with Dictionaries
Creating and using a dictionary
Replacing the switch statement with a dictionary
Creating Stacks Using Lists
Working with queues
Working with deques
Chapter 15 Creating and Using Classes
Understanding the Class as a Packaging Method
Considering the Parts of a Class
Creating the class definition
Considering the built-in class attributes
Working with methods
Working with constructors
Working with variables
Using methods with variable argument lists
Overloading operators
Creating a Class
Defining the MyClass class
Saving a class to disk
Using the Class in an Application
Extending Classes to Make New Classes
Building the child class
Testing the class in an application
Part
4 Performing Advanced Tasks
Chapter 16 Storing Data in Files
Understanding How Permanent Storage Works
Creating Content for Permanent Storage
Creating a File
Reading File Content
Updating File Content
Deleting a File
Chapter 17 Sending an Email
Understanding What Happens When You Send Email
Viewing email as you do a letter
Defining the parts of the envelope
Defining the parts of the letter
Creating the Email Message
Working with a text message
Working with an HTML message
Seeing the Email Output
Part
5 The Part of Tens
Chapter 18 Ten Amazing Programming Resources
Working with the Python Documentation Online
Using the LearnPython.org Tutorial
Performing Web Programming by Using Python
Getting Additional Libraries
Creating Applications Faster by Using an IDE
Checking Your Syntax with Greater Ease
Using XML to Your Advantage
Getting Past the Common Python Newbie Errors
Understanding Unicode
Making Your Python Application Fast
Chapter 19 Ten Ways to Make a Living with Python
Working in QA
Becoming the IT Staff for a Smaller Organization
Performing Specialty Scripting for Applications
Administering a Network
Teaching Programming Skills
Helping People Decide on Location
Performing Data Mining
Interacting with Embedded Systems
Carrying Out Scientific Tasks
Performing Real-Time Analysis of Data
Chapter 20 Ten Tools That Enhance Your Python Experience
Tracking Bugs with Roundup Issue Tracker
Creating a Virtual Environment by Using VirtualEnv
Installing Your Application by Using PyInstaller
Building Developer Documentation by Using pdoc
Developing Application Code by Using Komodo Edit
Debugging Your Application by Using pydbgr
Entering an Interactive Environment by Using IPython
Testing Python Applications by Using PyUnit
Tidying Your Code by Using Isort
Providing Version Control by Using Mercurial
Chapter 21 Ten (Plus) Libraries You Need to Know About
Developing a Secure Environment by Using PyCrypto
Interacting with Databases by Using SQLAlchemy
Seeing the World by Using Google Maps
Adding a Graphical User Interface by Using TkInter
Providing a Nice Tabular Data Presentation by Using PrettyTable
Enhancing Your Application with Sound by Using PyAudio
Manipulating Images by Using PyQtGraph
Locating Your Information by Using IRLib
Creating an Interoperable Java Environment by Using JPype
Accessing Local Network Resources by Using Twisted Matrix
Accessing Internet Resources by Using Libraries
Index
EULA