Real-World Python: A Hacker's Guide to Solving Problems with Code

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

A project-based approach to learning Python programming for beginners. Intriguing projects teach you how to tackle challenging problems with code. With its emphasis on project-based practice, Real World Python will take you from playing with syntax to writing complete programs in no time. You'll conduct experiments, explore statistical concepts, and solve novel problems that have frustrated geniuses throughout history, like detecting distant exoplanets, as you continue to build your Python skills. Chapters begin with a clearly defined project goal and a discussion of ways to attack the problem, followed by a mission designed to make you think like a programmer. You'll direct a Coast Guard search-and-rescue effort, plot and execute a NASA flight to the moon, protect access to a secure lab using facial recognition, and more. Along the way you'll learn how to: • Use libraries like matplotlib, NumPy, Bokeh, pandas, Requests, Beautiful Soup, and turtle • Work with Natural Language Processing and computer vision modules like NLTK and OpenCV • Write a program to detect and track objects moving across a starfield • Scrape speeches from the internet and autosummarize them • Use the Mars Orbiter Laser Altimeter (MOLA) map to select spacecraft landing sites • Survive a zombie apocalypse with the aid of data-plotting and visualization tools The book's programs are beginner-friendly, but as you progress you'll learn more sophisticated techniques to help you grow your coding capabilities. Once your missions are accomplished, you'll be ready to solve real-world problems with Python on your own.

Author(s): Lee Vaughan
Edition: 1
Publisher: No Starch Press
Year: 2020

Language: English
Commentary: Vector PDF
Pages: 360
City: San Francisco, CA
Tags: Natural Language Processing; Computer Vision; Programming; Python; Face Recognition; Bayesian Inference; Data Visualization; Encryption; NLTK; pandas; Simulation; Text Summarization; Bokeh; HoloViews; Object Detection; Elementary; Astronomy; Stylometry

Brief Contents
Contents in Detail
Introduction
Who Should Read This Book?
Why Python?
What’s in This Book?
Python Version, Platform, and IDE
Installing Python
Running Python
Using a Virtual Environment
Onward!
Chapter 1: Saving Shipwrecked Sailors with Bayes’ Rule
Bayes’ Rule
Project #1: Search and Rescue
The Strategy
Installing the Python Libraries
The Bayes Code
Playing the Game
Summary
Further Reading
Challenge Project: Smarter Searches
Challenge Project: Finding the Best Strategy with MCS
Challenge Project: Calculating the Probability of Detection
Chapter 2: Attributing Authorship with Stylometry
Project #2: The Hound, The War, and The Lost World
The Strategy
Installing NLTK
The Corpora
The Stylometry Code
Summary
Further Reading
Practice Project: Hunting the Hound with Dispersion
Practice Project: Punctuation Heatmap
Challenge Project: Fixing Frequency
Chapter 3: Summarizing Speeches with Natural Language Processing
Project #3: I Have a Dream . . . to Summarize Speeches!
The Strategy
Web Scraping
The “I Have a Dream” Code
Project #4: Summarizing Speeches with gensim
Installing gensim
The Make Your Bed Code
Project #5: Summarizing Text with Word Clouds
The Word Cloud and PIL Modules
The Word Cloud Code
Fine-Tuning the Word Cloud
Summary
Further Reading
Challenge Project: Game Night
Challenge Project: Summarizing Summaries
Challenge Project: Summarizing a Novel
Challenge Project: It’s Not Just What You Say, It’s How You Say It!
Chapter 4: Sending Super-Secret Messages with a Book Cipher
The One-Time Pad
The Rebecca Cipher
Project #6: The Digital Key to Rebecca
The Strategy
The Encryption Code
Sending Messages
Summary
Further Reading
Practice Project: Charting the Characters
Practice Project: Sending Secrets the WWII Way
Chapter 5: Finding Pluto
Project #7: Replicating a Blink Comparator
The Strategy
The Data
The Blink Comparator Code
Using the Blink Comparator
Project #8: Detecting Astronomical Transients with Image Differencing
The Strategy
The Transient Detector Code
Using the Transient Detector
Summary
Further Reading
Practice Project: Plotting the Orbital Path
Practice Project: What’s the Difference?
Challenge Project: Counting Stars
Chapter 6: Winning the Moon Race with Apollo 8
Understanding the Apollo 8 Mission
The Free Return Trajectory
The Three-Body Problem
Project #9: To the Moon with Apollo 8!
Using the turtle Module
The Strategy
The Apollo 8 Free Return Code
Running the Simulation
Summary
Further Reading
Practice Project: Simulating a Search Pattern
Practice Project: Start Me Up!
Practice Project: Shut Me Down!
Challenge Project: True-Scale Simulation
Challenge Project: The Real Apollo 8
Chapter 7: Selecting Martian Landing Sites
How to Land on Mars
The MOLA Map
Project #10: Selecting Martian Landing Sites
Strategy
The Site Selector Code
Results
Summary
Further Reading
Practice Project: Confirming That Drawings Become Part of an Image
Practice Project: Extracting an Elevation Profile
Practice Project: Plotting in 3D
Practice Project: Mixing Maps
Challenge Project: Making It Three in a Row
Challenge Project: Wrapping Rectangles
Chapter 8: Detecting Distant Exoplanets
Transit Photometry
Project #11: Simulating an Exoplanet Transit
The Strategy
The Transit Code
Experimenting with Transit Photometry
Project #12: Imaging Exoplanets
The Strategy
The Pixelator Code
Summary
Further Reading
Practice Project: Detecting Alien Megastructures
Practice Project: Detecting Asteroid Transits
Practice Project: Incorporating Limb Darkening
Practice Project: Detecting Starspots
Practice Project: Detecting an Alien Armada
Practice Project: Detecting a Planet with a Moon
Practice Project: Measuring the Length of an Exoplanet’s Day
Challenge Project: Generating a Dynamic Light Curve
Chapter 9: Identifying Friend or Foe
Detecting Faces in Photographs
Project #13: Programming a Robot Sentry Gun
The Strategy
The Code
Results
Detecting Faces from a Video Stream
Summary
Further Reading
Practice Project: Blurring Faces
Challenge Project: Detecting Cat Faces
Chapter 10: Restricting Access with Face Recognition
Recognizing Faces with Local Binary Pattern Histograms
The Face Recognition Flowchart
Extracting Local Binary Pattern Histograms
Project #14: Restricting Access to the Alien Artifact
The Strategy
Supporting Modules and Files
The Video Capture Code
The Face Trainer Code
The Face Predictor Code
Results
Summary
Further Reading
Challenge Project: Adding a Password and Video Capture
Challenge Project: Look-alikes and Twins
Challenge Project: Time Machine
Chapter 11: Creating an Interactive Zombie Escape Map
Project #15: Visualizing Population Density with a Choropleth Map
The Strategy
The Python Data Analysis Library
The bokeh and holoviews Libraries
Installing pandas, bokeh, and holoviews
Accessing the County, State, Unemployment, and Population Data
Hacking holoviews
The Choropleth Code
Planning the Escape
Summary
Further Reading
Challenge Project: Mapping US Population Change
Chapter 12: Are We Living in a Computer Simulation?
Project #16: Life, the Universe, and Yertle’s Pond
The Pond Simulation Code
Implications of the Pond Simulation
Measuring the Cost of Crossing the Lattice
Results
The Strategy
Summary
Further Reading
Moving On
Challenge Project: Finding a Safe Space
Challenge Project: Here Comes the Sun
Challenge Project: Seeing Through a Dog’s Eyes
Challenge Project: Customized Word Search
Challenge Project: Simplifying a Celebration Slideshow
Challenge Project: What a Tangled Web We Weave
Challenge Project: Go Tell It on the Mountain
Practice Project Solutions
Chapter 2: Attributing Authorship with Stylometry
Hunting the Hound with Dispersion
Punctuation Heatmap
Chapter 4: Sending Super-Secret Messages with a Book Cipher
Charting the Characters
Sending Secrets the WWII Way
Chapter 5: Finding Pluto
Plotting the Orbital Path
What’s the Difference?
Chapter 6: Winning the Moon Race with Apollo 8
Simulating a Search Pattern
Start Me Up!
Shut Me Down!
Chapter 7: Selecting Martian Landing Sites
Confirming That Drawings Become Part of an Image
Extracting an Elevation Profile
Plotting in 3D
Mixing Maps
Chapter 8: Detecting Distant Exoplanets
Detecting Alien Megastructures
Detecting Asteroid Transits
Incorporating Limb Darkening
Detecting an Alien Armada
Detecting a Planet with a Moon
Measuring the Length of an Exoplanet’s Day
Chapter 9: Identifying Friend or Foe
Blurring Faces
Chapter 10: Restricting Access with Face Recognition
Challenge Project: Adding a Password and Video Capture
Index
Blank Page