Impractical Python Projects

Book description

Impractical Python Projects picks up where the complete beginner books leave off, expanding on existing concepts and introducing new tools that you’ll use every day. And to keep things interesting, each project includes a zany twist featuring historical incidents, pop culture references, and literary allusions.

You’ll flex your problem-solving skills and employ Python’s many useful libraries to do things like:

• Help James Bond crack a high-tech safe with a hill-climbing algorithm• Write haiku poems using Markov Chain Analysis
• Use genetic algorithms to breed a race of gigantic rats
• Crack the world’s most successful military cipher using cryptanalysis
• Foil corporate security with invisible electronic ink
• Derive the anagram, “I am Lord Voldemort” using linguistical sieves
• Plan your parents’ secure retirement with Monte Carlo simulation
• Save the sorceress Zatanna from a stabby death using palingrams
• Model the Milky Way and calculate our odds of detecting alien civilizations
• Help the world’s smartest woman win the Monty Hall problem argument
• Reveal Jupiter’s Great Red Spot using optical stacking
• Save the head of Mary, Queen of Scots with steganography

Simulate volcanoes, map Mars, and more, all while gaining valuable experience using free modules like Tkinter, matplotlib, Cprofile, Pylint, Pygame, Pillow, and Python-Docx.

Whether you’re looking to pick up some new Python skills or just need a pick-me-up, you’ll find endless educational, geeky fun with Impractical Python Projects.

Table of contents

  1. Cover Page
  2. Title Page
  3. Copyright Page
  4. Dedication
  5. About the Author
  6. About the Technical Reviewer
  7. BRIEF CONTENTS
  8. CONTENTS IN DETAIL
  9. ACKNOWLEDGMENTS
  10. INTRODUCTION
    1. Who This Book Is For
    2. What’s in This Book
    3. Where to Get Help
    4. Onward!
  11. 1 SILLY NAME GENERATOR
    1. Project #1: Generating Pseudonyms
    2. Planning and Designing a Project
    3. The Code
    4. Summary
    5. Further Reading
    6. Practice Projects
    7. Challenge Projects
  12. 2 FINDING PALINGRAM SPELLS
    1. Finding and Opening a Dictionary
    2. Project #2: Finding Palindromes
    3. Project #3: Finding Palingrams
    4. dnE ehT
    5. Further Reading
    6. Practice Project: Dictionary Cleanup
    7. Challenge Project: Recursive Approach
  13. 3 SOLVING ANAGRAMS
    1. Project #4: Finding Single-Word Anagrams
    2. Project #5: Finding Phrase Anagrams
    3. Project #6: Finding Voldemort: The Gallic Gambit
    4. Project #7: Finding Voldemort: The British Brute-Force
    5. Summary
    6. Further Reading
    7. Practice Project: Finding Digrams
    8. Challenge Project: Automatic Anagram Generator
  14. 4 DECODING AMERICAN CIVIL WAR CIPHERS
    1. Project #8: The Route Cipher
    2. Project #9: The Rail Fence Cipher
    3. Summary
    4. Further Reading
    5. Practice Projects
    6. Challenge Projects
  15. 5 ENCODING ENGLISH CIVIL WAR CIPHERS
    1. Project #10: The Trevanion Cipher
    2. Project #11: Writing a Null Cipher
    3. Summary
    4. Further Reading
    5. Practice Projects
  16. 6 WRITING IN INVISIBLE INK
    1. Project #12: Hiding a Vigenère Cipher
    2. The Platform
    3. The Strategy
    4. The Pseudocode
    5. The Code
    6. Detecting the Hidden Message
    7. Summary
    8. Further Reading
    9. Practice Project: Checking the Number of Blank Lines
    10. Challenge Project: Using Monospace Font
  17. 7 BREEDING GIANT RATS WITH GENETIC ALGORITHMS
    1. Finding the Best of All Possible Solutions
    2. Project #13: Breeding an Army of Super-Rats
    3. Project #14: Cracking a High-Tech Safe
    4. Further Reading
    5. Challenge Projects
  18. 8 COUNTING SYLLABLES FOR HAIKU POETRY
    1. Japanese Haiku
    2. Project #15: Counting Syllables
    3. The Strategy
    4. Managing Missing Words
    5. The Count Syllables Code
    6. A Program to Check Your Program
    7. Summary
    8. Further Reading
    9. Practice Project: Syllable Counter vs. Dictionary File
  19. 9 WRITING HAIKU WITH MARKOV CHAIN ANALYSIS
    1. Project #16: Markov Chain Analysis
    2. The Strategy
    3. The Pseudocode
    4. The Training Corpus
    5. Debugging
    6. The Code
    7. The Results
    8. Summary
    9. Further Reading
    10. Challenge Projects
  20. 10 ARE WE ALONE? EXPLORING THE FERMI PARADOX
    1. Project #17: Modeling the Milky Way
    2. The Strategy
    3. Estimating the Number of Civilizations
    4. Selecting Radio Bubble Dimensions
    5. Generating a Formula for the Probability of Detection
    6. The Probability-of-Detection Code
    7. Building the Graphical Model
    8. Results
    9. Summary
    10. Further Reading
    11. Practice Projects
    12. Challenge Projects
  21. 11 THE MONTY HALL PROBLEM
    1. Monte Carlo Simulation
    2. Project #18: Verify vos Savant
    3. Project #19: The Monty Hall Game
    4. Summary
    5. Further Reading
    6. Practice Project: The Birthday Paradox
  22. 12 SECURING YOUR NEST EGG
    1. Project #20: Simulating Retirement Lifetimes
    2. The Strategy
    3. The Pseudocode
    4. Finding Historical Data
    5. The Code
    6. Using the Simulator
    7. Summary
    8. Further Reading
    9. Challenge Projects
  23. 13 SIMULATING AN ALIEN VOLCANO
    1. Project #21: The Plumes of Io
    2. A Slice of pygame
    3. The Strategy
    4. The Code
    5. Running the Simulation
    6. Summary
    7. Further Reading
    8. Practice Project: Going the Distance
    9. Challenge Projects
  24. 14 MAPPING MARS WITH THE MARS ORBITER
    1. Astrodynamics for Gamers
    2. Project #22: The Mars Orbiter Game
    3. The Strategy
    4. Game Assets
    5. The Code
    6. Summary
    7. Challenge Projects
  25. 15 IMPROVING YOUR ASTROPHOTOGRAPHY WITH PLANET STACKING
    1. Project #23: Stacking Jupiter
    2. The pillow Module
    3. Working with Files and Folders
    4. The Video
    5. The Strategy
    6. The Code
    7. Summary
    8. Further Reading
    9. Challenge Project: Vanishing Act
  26. 16 FINDING FRAUDS WITH BENFORD’S LAW
    1. Project #24: Benford’s Law of Leading Digits
    2. The Dataset
    3. The Strategy
    4. The Code
    5. Summary
    6. Further Reading
    7. Practice Project: Beating Benford
    8. Challenge Projects
  27. APPENDIX PRACTICE PROJECT SOLUTIONS
    1. Chapter 1: Silly Name Generator
    2. Chapter 2: Finding Palingram Spells
    3. Chapter 3: Solving Anagrams
    4. Chapter 4: Decoding American Civil War Ciphers
    5. Chapter 5: Encoding English Civil War Ciphers
    6. Chapter 6: Writing in Invisible Ink
    7. Chapter 8: Counting Syllables for Haiku Poetry
    8. Chapter 10: Are We Alone? Exploring the Fermi Paradox
    9. Chapter 11: The Monty Hall Problem
    10. Chapter 13: Simulating an Alien Volcano
    11. Chapter 16: Finding Frauds with Benford’s Law
  28. INDEX

Product information

  • Title: Impractical Python Projects
  • Author(s): Lee Vaughan
  • Release date: November 2018
  • Publisher(s): No Starch Press
  • ISBN: 9781593278908