Create simple, easy programs in the popular Python language
Beginning Programming with Python For Dummies is the trusted way to learn the foundations of programming using the Python programming language. Python is one of the top-ranked languages, and there’s no better way to get started in computer programming than this friendly guide. You’ll learn the basics of coding and the process of creating simple, fun programs right away. This updated edition features new chapters, including coverage of Google Colab, plus expanded information on functions and objects, and new examples and graphics that are relevant to today’s beginning coders. Dummies helps you discover the wealth of things you can achieve with Python.
• Employ an online coding environment to avoid installation woes and code anywhere, any time
• Learn the basics of programming using the popular Python language
• Create easy, fun projects to show off your new coding chops
• Fix errors in your code and use Python with external data sets
Beginning Programming with Python For Dummies will get new programmers started—the easy way.
Author(s): John Paul Mueller
Series: For Dummies
Edition: 3
Publisher: Wiley
Year: 2022
Language: English
Commentary: Publisher's PDF
Pages: 416
City: Hoboken, NJ
Tags: Programming; Python; For Dummies; Jupyter; Error Handling; Google Colaboratory; Elementary
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
Making your computer do funny things
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
C#
Java
Perl
R
Haskell
Chapter 2 Working with Google Colab
Defining Google Colab
Understanding what Google Colab does
Working with Google Colab features
Locating commands
Configuring settings
Customizing keyboard shortcuts
Comparing files
Working with Notebooks
Creating a new notebook
Opening existing notebooks
Using Google Drive for existing notebooks
Using GitHub for existing notebooks
Using local storage for existing notebooks
Saving notebooks using GitHub
Using Drive to save notebooks
Using GitHub to save notebooks
Getting the gist of things
Working with Drive
Performing Common Tasks
Creating code cells
Creating text cells
Creating special cells
Working with headings
Working with a table of contents
Editing cells
Moving cells
Using Hardware Acceleration
Executing the Code
Getting Help
Chapter 3 Interacting with Python
Typing a Command
Telling the computer what to do
Telling the computer you’re done
Seeing the result
Getting Python’s Help
Entering into help mode
Asking for help
Leaving help mode
Obtaining help directly
Finding Out More about Functions and Objects
Yelling “Hello There” doesn’t help: Use dir() instead
What are those double underscores all about?
Drilling, drilling, drilling down into classes
Playing the Part of Inspector
Gaining access to inspect
Using inspect
Is reflection really like looking in a mirror?
Chapter 4 Writing Your First Application
Understanding Why IDEs Are Important
Creating better code
Debugging functionality
Defining why notebooks are useful
Creating the Application
Developing the code
Adding documentation cells
Other cell content
Playing around with scratch cells
Interacting with form fields
Choosing a form field type
Defining the variable type and name
Using the form field
Running the Application
Seeing the result
Viewing the executed code history
Understanding the Use of Indentation
Adding Comments
Understanding comments
Creating multiline comments
Using comments to leave yourself reminders
Using comments to keep code from executing
Making Your Notebook Informative, Descriptive, and Pretty
Working with text cells
Adding section headers
Interacting with the table of contents
Renaming a notebook
Closing and Halting a Notepad
Chapter 5 Performing Magic
Understanding the Concept of a Magic Command
What Kind of Magic Do You Want to Perform?
Working with line magic commands
Working with cell magic commands
Learning the Magic Commands
Getting magic command details
An overview of line magic commands
An overview of cell magic commands
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
Integers
Floating-point values
Complex numbers
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
Unary
Arithmetic
Relational
Logical
Bitwise
Assignment
Membership
Identity
Understanding operator precedence
Creating and Using Functions
Viewing functions as code packages
Understanding code reusability
Defining a function
Accessing functions
Sending information to functions
Understanding arguments
Sending required arguments
Sending arguments by name
Giving function arguments a default value
Creating functions with a variable number of arguments
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
Working with relational operators
Performing multiple tasks
Making multiple comparisons by using logical operators
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
Doing nothing with the pass statement
Validating input 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
Compile time
Runtime
Distinguishing error types
Syntactical
Semantic
Logical
Catching Exceptions
Basic exception handling
Handling a single exception
Using the except clause without an exception
Working with exception arguments
Handling multiple exceptions with a single except clause
Handling multiple exceptions with multiple except clauses
Handling more specific to less specific exceptions
Nested exception handling
Raising Exceptions
Raising exceptions during exceptional conditions
Passing error information to the caller
Deciding to Say “Oops” in Your Own Way: Custom Exceptions
Using the finally Clause
Part 3 Performing Common Tasks
Chapter 11 Interacting with Packages
Creating Code Groupings
I’m confused! Understanding modules versus packages
Creating your first package
Understanding the package types
Considering the package cache
Importing Packages
Using the import statement
Using the from. . .import statement
Using the import. . .as statement
Finding Packages
Locating packages on disk
Locating packages online
Downloading Packages from Other Sources
Opening the Anaconda Prompt
Working with conda packages
Viewing conda packages
Installing conda packages
Updating conda packages
Removing conda packages
And just why is conda missing in Colab?
Installing packages by using pip
Installing packages using the %pip magics
Viewing the Package Content
Viewing Package Documentation
Using !pydoc to access PyDoc
Typing a search term
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
Using String Interpolation
Employing the % (modulo) approach
Working with the format() function
Simplifying things using f-string
Creating and using string templates
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
Working with nested dictionaries
Replacing the switch statement with a dictionary
Creating Stacks Using Lists
Working with queues
Working with deques
Chapter 15 Creating and Using Classes
Considering the Parts of a Class
Creating the class definition
Considering the built-in class attributes
Working with methods
Creating class methods
Creating instance methods
Working with constructors
Working with variables
Creating class variables
Creating instance variables
Using methods with variable argument lists
Overloading operators
Creating and Using an External Class
Developing the external class
Defining the MyClass class
Saving a class to disk
Using MyClass in an application
Extending Classes to Make New Classes
Building the child class
Testing class inheritance 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
Host
Port
Local hostname
Defining the parts of the letter
Defining the message
Specifying the transmission
Considering the message subtypes
Putting everything together for text messages
Working with an HTML message
Part 5 The Part of Tens
Chapter 18 Ten Amazing Programming Resources
Working with the Python Documentation Online
Discovering Details Using a Tutorial
Performing Web Programming by Using Python
Locating Useful (versus Useless) Modules
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 CryptLib
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 Whoosh
Creating an Interoperable Java Environment by Using JPype
Accessing Local Network Resources by Using Twisted Matrix
Accessing Internet Resources by Using Libraries
Index
EULA