/dev/reading
Category

Python

65 books
Order by
View
Accelerate your Python programs using proven techniques and design patterns
by Quan Nguyen

Python's powerful capabilities for implementing robust and efficient programs make it one of the most sought-after programming languages.

In this book, you'll explore the tools that allow you to improve performance and take your Python programs to the next level.

This book starts by examining the built-in as well as external libraries that streamline tasks in the development cycle, such as benchmarking, profiling, and optimizing. You'll then get to grips with using specialized tools such as dedicated libraries and compilers to increase your performance at number-crunching tasks, including training machine learning models.

The book covers concurrency, a major solution to making programs more efficient and scalable, and various concurrent programming techniques such as multithreading, multiprocessing, and asynchronous programming.

You'll also understand the common problems that cause undesirable behavior in concurrent programs.

Finally, you'll work with a wide range of design patterns, including creational, structural, and behavioral patterns that enable you to tackle complex design and architecture challenges, making your programs more robust and maintainable.

By the end of the book, you'll be exposed to a wide range of advanced functionalities in Python and be equipped with the practical knowledge needed to apply them to your use cases.

What you will learn

  • Write efficient numerical code with NumPy, pandas, and Xarray
  • Use Cython and Numba to achieve native performance
  • Find bottlenecks in your Python code using profilers
  • Optimize your machine learning models with JAX
  • Implement multithreaded, multiprocessing, and asynchronous programs
  • Solve common problems in concurrent programming, such as deadlocks
  • Tackle architecture challenges with design patterns

Who this book is for

This book is for intermediate to experienced Python programmers who are looking to scale up their applications in a systematic and robust manner. Programmers from a range of backgrounds will find this book useful, including software engineers, scientific programmers, and software architects.

Enabling Test-Driven Development, Domain-Driven Design, and Event-Driven Microservices
by Harry Percival and Bob Gregory

As Python continues to grow in popularity, projects are becoming larger and more complex. Many Python developers are taking an interest in high-level software design patterns such as hexagonal/clean architecture, event-driven architecture, and the strategic patterns prescribed by domain-driven design (DDD). But translating those patterns into Python isn’t always straightforward.

With this hands-on guide, Harry Percival and Bob Gregory from MADE.com introduce proven architectural design patterns to help Python developers manage application complexity—and get the most value out of their test suites.

Each pattern is illustrated with concrete examples in beautiful, idiomatic Python, avoiding some of the verbosity of Java and C# syntax. Patterns include:

  • Dependency inversion and its links to ports and adapters (hexagonal/clean architecture)
  • Domain-driven design’s distinction between Entities, Value Objects, and Aggregates
  • Repository and Unit of Work patterns for persistent storage
  • Events, commands, and the message bus
  • Command-query responsibility segregation (CQRS)
  • Event-driven architecture and reactive microservices
Practical Programming for Total Beginners
by Al Sweigart

If you’ve ever spent hours renaming files or updating hundreds of spreadsheet cells, you know how tedious tasks like these can be. But what if you could have your computer do them for you?

In this fully revised second edition of the best-selling classic Automate the Boring Stuff with Python, you’ll learn how to use Python to write programs that do in minutes what would take you hours to do by hand—no prior programming experience required. You'll learn the basics of Python and explore Python’s rich library of modules for performing specific tasks, like scraping data off websites, reading PDF and Word documents, and automating clicking and typing tasks.

The second edition of this international fan favorite includes a brand-new chapter on input validation, as well as tutorials on automating Gmail and Google Sheets, plus tips on automatically updating CSV files. You’ll learn how to create programs that effortlessly perform useful feats of automation to:

  • Search for text in a file or across multiple files
  • Create, update, move, and rename files and folders
  • Search the Web and download online content
  • Update and format data in Excel spreadsheets of any size
  • Split, merge, watermark, and encrypt PDFs
  • Send email responses and text notifications
  • Fill out online forms

Step-by-step instructions walk you through each program, and updated practice projects at the end of each chapter challenge you to improve those programs and use your newfound skills to automate similar tasks.

Don't spend your time doing work a well-trained monkey could do. Even if you've never written a line of code, you can make your computer do the grunt work. Learn how in Automate the Boring Stuff with Python, 2nd Edition.

Best Practices for Writing Clean Code
by Al Sweigart

BRIDGE THE GAP BETWEEN NOVICE AND PROFESSIONAL

You’ve completed a basic Python programming tutorial or finished Al Sweigart’s best selling Automate the Boring Stuff with Python. What’s the next step toward becoming a capable, confident software developer?

Welcome to Beyond the Basic Stuff with Python. More than a mere collection of advanced syntax and masterful tips for writing clean code, this book will teach you how to advance your Python programming skills by using the command line and other professional tools like code formatters, type checkers, linters, and version control. Sweigart takes you through best practices for setting up your development environment, naming variables, and improving readability, then tackles documentation, organization and performance measurement, as well as object-oriented design and the Big-O algorithm analysis commonly used in coding interviews. The skills you learn will boost your ability to program—not just in Python but in any language.

You’ll learn:

  • Coding style, and how to use Python’s Black auto-formatting tool for cleaner code
  • Common sources of bugs, and how to detect them with static analyzers
  • How to structure the files in your code projects with the Cookiecutter template tool
  • Functional programming techniques like lambda and higher-order functions
  • How to profile the speed of your code with Python’s built-in timeit and cProfile modules
  • The computer science behind Big-O algorithm analysis
  • How to make your comments and docstrings informative, and how often to write them
  • How to create classes in object-oriented programming, and why they’re used to organize code

Toward the end of the book you’ll read a detailed source-code breakdown of two classic command-line games, the Tower of Hanoi (a logic puzzle) and Four-in-a-Row (a two-player tile-dropping game), and a breakdown of how their code follows the book’s best practices. You’ll test your skills by implementing the program yourself.

Of course, no single book can make you a professional software developer. But Beyond the Basic Stuff with Python will get you further down that path and make you a better programmer in the process as you learn to write readable code that’s easy to debug and perfectly Pythonic.

Python Programming for Hackers and Pentesters
by Justin Seitz and Tim Arnold

When it comes to creating powerful and effective hacking tools, Python is the language of choice for most security analysts. In this second edition of the bestselling Black Hat Python, you’ll explore the darker side of Python’s capabilities: everything from writing network sniffers, stealing email credentials, and bruteforcing directories to crafting mutation fuzzers, investigating virtual machines, and creating stealthy trojans.

All of the code in this edition has been updated to Python 3.x. You’ll also find new coverage of bit shifting, code hygiene, and offensive forensics with the Volatility Framework as well as expanded explanations of the Python libraries ctypes, struct, lxml, and BeautifulSoup, and offensive hacking strategies like splitting bytes, leveraging computer vision libraries, and scraping websites.

You’ll learn how to:

  • Create a trojan command-and-control server using GitHub
  • Detect sandboxing and automate common malware tasks like keylogging and screenshotting
  • Extend the Burp Suite web-hacking tool
  • Escalate Windows privileges with creative process control
  • Use offensive memory forensics tricks to retrieve password hashes and find vulnerabilities on a virtual machine
  • Abuse Windows COM automation
  • Exfiltrate data from a network undetected

When it comes to offensive security, you need to be able to create powerful tools on the fly. Learn how with Black Hat Python.

by David Kopec

Classic Computer Science Problems in Python deepens your knowledge of problem solving techniques from the realm of computer science by challenging you with time-tested scenarios, exercises, and algorithms. As you work through examples in search, clustering, graphs, and more, you'll remember important things you've forgotten and discover classic solutions to your "new" problems!

Develop maintainable and efficient code
by Mariano Anaya

Experienced professionals in every field face several instances of disorganization, poor readability, and testability due to unstructured code.

With updated code and revised content aligned to the new features of Python 3.9, this second edition of Clean Code in Python will provide you with all the tools you need to overcome these obstacles and manage your projects successfully.

The book begins by describing the basic elements of writing clean code and how it plays a key role in Python programming. You will learn about writing efficient and readable code using the Python standard library and best practices for software design.

The book discusses object-oriented programming in Python and shows you how to use objects with descriptors and generators. It will also show you the design principles of software testing and how to resolve problems by implementing software design patterns in your code. In the concluding chapter, we break down a monolithic application into a microservices-based one starting from the code as the basis for a solid platform.

By the end of this clean code book, you will be proficient in applying industry-approved coding practices to design clean, sustainable, and readable real-world Python code.

What you will learn

  • Set up a productive development environment by leveraging automatic tools
  • Leverage the magic methods in Python to write better code, abstracting complexity away and encapsulating details
  • Create advanced object-oriented designs using unique features of Python, such as descriptors
  • Eliminate duplicated code by creating powerful abstractions using software engineering principles of object-oriented design
  • Create Python-specific solutions using decorators and descriptors
  • Refactor code effectively with the help of unit tests
  • Build the foundations for solid architecture with a clean code base as its cornerstone

Who this book is for

This book is designed to benefit new as well as experienced programmers. It will appeal to team leads, software architects and senior software engineers who would like to write Pythonic code to save on costs and improve efficiency. The book assumes that you have a strong understanding of programming

An Introduction to Building and Breaking Ciphers
by Al Sweigart

Learn how to program in Python while making and breaking ciphers—algorithms used to create and send secret messages!

After a crash course in Python programming basics, you’ll learn to make, test, and hack programs that encrypt text with classical ciphers like the transposition cipher and Vigenère cipher. You’ll begin with simple programs for the reverse and Caesar ciphers and then work your way up to public key cryptography, the type of encryption used to secure today’s online transactions, including digital signatures, email, and Bitcoin.

Each program includes the full code and a line-by-line explanation of how things work. By the end of the book, you’ll have learned how to code in Python and you’ll have the clever programs to prove it!

You’ll also learn how to:

  • Combine loops, variables, and flow control statements into real working programs
  • Use dictionary files to instantly detect whether decrypted messages are valid English or gibberish
  • Create test programs to make sure that your code encrypts and decrypts correctly
  • Code (and hack!) a working example of the affine cipher, which uses modular arithmetic to encrypt a message
  • Break ciphers with techniques such as brute-force and frequency analysis

There’s no better way to learn to code than to play with real programs. Cracking Codes with Python makes the learning fun!

by Jonathan Rioux

Think big about your data! PySpark brings the powerful Spark big data processing engine to the Python ecosystem, letting you seamlessly scale up your data tasks and create lightning-fast pipelines.

In Data Analysis with Python and PySpark you will learn how to:

  • Manage your data as it scales across multiple machines
  • Scale up your data programs with full confidence
  • Read and write data to and from a variety of sources and formats
  • Deal with messy data with PySpark’s data manipulation functionality
  • Discover new data sets and perform exploratory data analysis
  • Build automated data pipelines that transform, summarize, and get insights from data
  • Troubleshoot common PySpark errors
  • Creating reliable long-running jobs

Data Analysis with Python and PySpark is your guide to delivering successful Python-driven data projects. Packed with relevant examples and essential techniques, this practical book teaches you to build pipelines for reporting, machine learning, and other data-centric tasks. Quick exercises in every chapter help you practice what you’ve learned, and rapidly start implementing PySpark into your data systems. No previous knowledge of Spark is required.

by John Canning, Alan Broder and Robert Lafore

This practical introduction to data structures and algorithms can help every programmer who wants to write more efficient software. Building on Robert Lafores legendary Java-based guide, this book helps you understand exactly how data structures and algorithms operate. Youll learn how to efficiently apply them with the enormously popular Python language and scale your code to handle todays big data challenges.

Throughout, the authors focus on real-world examples, communicate key ideas with intuitive, interactive visualizations, and limit complexity and math to what you need to improve performance. Step-by-step, they introduce arrays, sorting, stacks, queues, linked lists, recursion, binary trees, 2-3-4 trees, hash tables, spatial data structures, graphs, and more. Their code examples and illustrations are so clear, you can understand them even if youre a near-beginner, or your experience is with other procedural or object-oriented languages.

  • Build core computer science skills that take you beyond merely writing code
  • Learn how data structures make programs (and programmers) more efficient
  • See how data organization and algorithms affect how much you can do with todays, and tomorrows, computing resources
  • Develop data structure implementation skills you can use in any language
  • Choose the best data structure(s) and algorithms for each programming problemand recognize which ones to avoid

Data Structures & Algorithms in Python is packed with examples, review questions, individual and team exercises, thought experiments, and longer programming projects. It’s ideal for both self-study and classroom settings, and either as a primary text or as a complement to a more formal presentation.

Idiomatic Python for the Impatient Programmer
by Jason C. McDonald

Dead Simple Python is a thorough introduction to every feature of the Python language for programmers who are impatient to write production code. Instead of revisiting elementary computer science topics, you’ll dive deep into idiomatic Python patterns so you can write professional Python programs in no time.

After speeding through Python’s basic syntax and setting up a complete programming environment, you’ll learn to work with Python’s dynamic data typing, its support for both functional and object-oriented programming techniques, special features like generator expressions, and advanced topics like concurrency. You’ll also learn how to package, distribute, debug, and test your Python project.

Master how to:

  • Make Python's dynamic typing work for you to produce cleaner, more adaptive code.
  • Harness advanced iteration techniques to structure and process your data.
  • Design classes and functions that work without unwanted surprises or arbitrary constraints.
  • Use multiple inheritance and introspection to write classes that work intuitively.
  • Improve your code's responsiveness and performance with asynchrony, concurrency, and parallelism.
  • Structure your Python project for production-grade testing and distribution

The most pedantically pythonic primer ever printed, Dead Simple Python will take you from working with the absolute basics to coding applications worthy of publication.

A Pythonic Adventure for the Intrepid Beginner
by Bradford Tuckfield

Dive Into Algorithms is a wide-ranging, Pythonic tour of many of the world's most interesting algorithms. With little more than a bit of computer programming experience and basic high-school math, you'll explore standard computer science algorithms for searching, sorting, and optimization; human-based algorithms that help us determine how to catch a baseball or eat the right amount at a buffet; and advanced algorithms like ones used in machine learning and artificial intelligence. You'll even explore how ancient Egyptians and Russian peasants used algorithms to multiply numbers, how the ancient Greeks used them to find greatest common divisors, and how Japanese scholars in the age of samurai designed algorithms capable of generating magic squares.

You'll explore algorithms that are useful in pure mathematics and learn how mathematical ideas can improve algorithms. You'll learn about an algorithm for generating continued fractions, one for quick calculations of square roots, and another for generating seemingly random sets of numbers.

You'll also learn how to:

  • Use algorithms to debug code, maximize revenue, schedule tasks, and create decision trees
  • Measure the efficiency and speed of algorithms
  • Generate Voronoi diagrams for use in various geometric applications
  • Use algorithms to build a simple chatbot, win at board games, or solve sudoku puzzles
  • Write code for gradient ascent and descent algorithms that can find the maxima and minima of functions
  • Use simulated annealing to perform global optimization
  • Build a decision tree to predict happiness based on a person's characteristics

Once you've finished this book you'll understand how to code and implement important algorithms as well as how to measure and optimize their performance, all while learning the nitty-gritty details of today's most powerful algorithms.

Use Python to Tackle Your Toughest Business Challenges
by Bradford Tuckfield

Dive into the exciting world of data science with this practical introduction. Packed with essential skills and useful examples, Dive Into Data Science will show you how to obtain, analyze, and visualize data so you can leverage its power to solve common business challenges.

With only a basic understanding of Python and high school math, you’ll be able to effortlessly work through the book and start implementing data science in your day-to-day work. From improving a bike sharing company to extracting data from websites and creating recommendation systems, you’ll discover how to find and use data-driven solutions to make business decisions.

Topics covered include conducting exploratory data analysis, running A/B tests, performing binary classification using logistic regression models, and using machine learning algorithms.

You’ll also learn how to:

  • Forecast consumer demand
  • Optimize marketing campaigns
  • Reduce customer attrition
  • Predict website traffic
  • Build recommendation systems

With this practical guide at your fingertips, harness the power of programming, mathematical theory, and good old common sense to find data-driven solutions that make a difference. Don’t wait; dive right in!

Use Programming to Explore Algebra, Statistics, Calculus, and More!
by Amit Saha

Doing Math with Python shows you how to use Python to delve into high school–level math topics like statistics, geometry, probability, and calculus. You’ll start with simple projects, like a factoring program and a quadratic-equation solver, and then create more complex projects once you’ve gotten the hang of things.

Along the way, you’ll discover new ways to explore math and gain valuable programming skills that you’ll use throughout your study of math and computer science. Learn how to:

  • Describe your data with statistics, and visualize it with line graphs, bar charts, and scatter plots
  • Explore set theory and probability with programs for coin flips, dicing, and other games of chance
  • Solve algebra problems using Python’s symbolic math functions
  • Draw geometric shapes and explore fractals like the Barnsley fern, the Sierpinski triangle, and the Mandelbrot set
  • Write programs to find derivatives and integrate functions

Creative coding challenges and applied examples help you see how you can put your new math and coding skills into practice. You’ll write an inequality solver, plot gravity’s effect on how far a bullet will travel, shuffle a deck of cards, estimate the area of a circle by throwing 100,000 “darts” at a board, explore the relationship between the Fibonacci sequence and the golden ratio, and more.

Whether you’re interested in math but have yet to dip into programming or you’re a teacher looking to bring programming into the classroom, you’ll find that Python makes programming easy and practical. Let Python handle the grunt work while you focus on the math.

Uses Python 3

90 Specific Ways to Write Better Python
by Brett Slatkin

It’s easy to start developing programs with Python, which is why the language is so popular. However, Python’s unique strengths, charms, and expressiveness can be hard to grasp, and there are hidden pitfalls that can easily trip you up.

This second edition of Effective Python will help you master a truly “Pythonic” approach to programming, harnessing Python’s full power to write exceptionally robust and well-performing code. Using the concise, scenario-driven style pioneered in Scott Meyers’ best-selling Effective C++, Brett Slatkin brings together 90 Python best practices, tips, and shortcuts, and explains them with realistic code examples so that you can embrace Python with confidence.

Drawing on years of experience building Python infrastructure at Google, Slatkin uncovers little-known quirks and idioms that powerfully impact code behavior and performance. You’ll understand the best way to accomplish key tasks so you can write code that’s easier to understand, maintain, and improve. In addition to even more advice, this new edition substantially revises all items from the first edition to reflect how best practices have evolved.

Key features include

  • 30 new actionable guidelines for all major areas of Python
  • Detailed explanations and examples of statements, expressions, and built-in types
  • Best practices for writing functions that clarify intention, promote reuse, and avoid bugs
  • Better techniques and idioms for using comprehensions and generator functions
  • Coverage of how to accurately express behaviors with classes and interfaces
  • Guidance on how to avoid pitfalls with metaclasses and dynamic attributes
  • More efficient and clear approaches to concurrency and parallelism
  • Solutions for optimizing and hardening to maximize performance and quality
  • Techniques and built-in modules that aid in debugging and testing
  • Tools and best practices for collaborative development

Effective Python will prepare growing programmers to make a big impact using Python.

High performance techniques for large datasets
by Tiago Rodrigues Antao

Master Python techniques and libraries to reduce run times, efficiently handle huge datasets, and optimize execution for complex machine learning applications.

Fast Python is a toolbox of techniques for high performance Python including:

  • Writing efficient pure-Python code
  • Optimizing the NumPy and pandas libraries
  • Rewriting critical code in Cython
  • Designing persistent data structures
  • Tailoring code for different architectures
  • Implementing Python GPU computing

Fast Python is your guide to optimizing every part of your Python-based data analysis process, from the pure Python code you write to managing the resources of modern hardware and GPUs. You'll learn to rewrite inefficient data structures, improve underperforming code with multithreading, and simplify your datasets without sacrificing accuracy.

Written for experienced practitioners, this book dives right into practical solutions for improving computation and storage efficiency. You'll experiment with fun and interesting examples such as rewriting games in Cython and implementing a MapReduce framework from scratch. Finally, you'll go deep into Python GPU computing and learn how modern hardware has rehabilitated some former antipatterns and made counterintuitive ideas the most efficient way of working.

Clear, Conscise, and Effective Programming
by Luciano Ramalho

Don't waste time bending Python to fit patterns you've learned in other languages. Python's simplicity lets you become productive quickly, but often this means you aren't using everything the language has to offer. With the updated edition of this hands-on guide, you'll learn how to write effective, modern Python 3 code by leveraging its best ideas.

Discover and apply idiomatic Python 3 features beyond your past experience. Author Luciano Ramalho guides you through Python's core language features and libraries and teaches you how to make your code shorter, faster, and more readable.

Complete with major updates throughout, this new edition features five parts that work as five short books within the book:

  • Data structures: Sequences, dicts, sets, Unicode, and data classes
  • Functions as objects: First-class functions, related design patterns, and type hints in function declarations
  • Object-oriented idioms: Composition, inheritance, mixins, interfaces, operator overloading, protocols, and more static types
  • Control flow: Context managers, generators, coroutines, async/await, and thread/process pools
  • Metaprogramming: Properties, attribute descriptors, class decorators, and new class metaprogramming hooks that replace or simplify metaclasses
Cryptography, TLS, and attack resistance
by Dennis Byrne

No-nonsense techniques, libraries, and best practices you can use to keep your Python applications safe and secure.

In Full Stack Python Security: Cryptography, TLS, and attack resistance, you’ll learn how to:

  • Use algorithms to encrypt, hash, and digitally sign data
  • Create and install TLS certificates
  • Implement authentication, authorization, OAuth 2.0, and form validation in Django
  • Protect a web application with Content Security Policy
  • Implement Cross Origin Resource Sharing
  • Protect against common attacks including clickjacking, denial of service attacks, SQL injection, cross-site scripting, and more

Full Stack Python Security: Cryptography, TLS, and attack resistance teaches you everything you’ll need to build secure Python web applications. As you work through the insightful code snippets and engaging examples, you’ll put security standards, best practices, and more into action. Along the way, you’ll get exposure to important libraries and tools in the Python ecosystem.

Learn to code with Python
by Ana Bell

Get Programming: Learn to code with Python introduces you to the world of writing computer programs without drowning you in confusing jargon or theory that make getting started harder than it should be. Filled with practical examples and step-by-step lessons using the easy-on-the-brain Python language, this book will get you programming in no time!

This book works perfectly alongside Ana Bell's liveVideo course Get Programming with Python in Motion, featuring more projects and skills for you to pick up with this great language!

Python Programming for Hackers and Reverse Engineers
by Justin Seitz

Python is fast becoming the programming language of choice for hackers, reverse engineers, and software testers because it's easy to write quickly, and it has the low-level support and libraries that make hackers happy. But until now, there has been no real manual on how to use Python for a variety of hacking tasks. You had to dig through forum posts and man pages, endlessly tweaking your own code to get everything working. Not anymore.

Gray Hat Python explains the concepts behind hacking tools and techniques like debuggers, trojans, fuzzers, and emulators. But author Justin Seitz goes beyond theory, showing you how to harness existing Python-based security tools—and how to build your own when the pre-built ones won't cut it.

You'll learn how to:

  • Automate tedious reversing and security tasks
  • Design and program your own debugger
  • Learn how to fuzz Windows drivers and create powerful fuzzers from scratch
  • Have fun with code and library injection, soft and hard hooking techniques, and other software trickery
  • Sniff secure traffic out of an encrypted web browser session
  • Use PyDBG, Immunity Debugger, Sulley, IDAPython, PyEMU, and more

The world's best hackers are using Python to do their handiwork. Shouldn't you?

Store, manipulate, and access data effectively and boost the performance of your applications
by Dr. Basant Agarwal

Choosing the right data structure is pivotal to optimizing the performance and scalability of applications. This new edition of Hands-On Data Structures and Algorithms with Python will expand your understanding of key structures, including stacks, queues, and lists, and also show you how to apply priority queues and heaps in applications. You'll learn how to analyze and compare Python algorithms, and understand which algorithms should be used for a problem based on running time and computational complexity. You will also become confident organizing your code in a manageable, consistent, and scalable way, which will boost your productivity as a Python developer.

By the end of this Python book, you'll be able to manipulate the most important data structures and algorithms to more efficiently store, organize, and access data in your applications.

What you will learn

  • Understand common data structures and algorithms using examples, diagrams, and exercises
  • Explore how more complex structures, such as priority queues and heaps, can benefit your code
  • Implement searching, sorting, and selection algorithms on number and string sequences
  • Become confident with key string-matching algorithms
  • Understand algorithmic paradigms and apply dynamic programming techniques
  • Use asymptotic notation to analyze algorithm performance with regard to time and space complexities
  • Write powerful, robust code using the latest features of Python

Who this book is for

This book is for developers and programmers who are interested in learning about data structures and algorithms in Python to write complex, flexible programs. Basic Python programming knowledge is expected.

A Learner's Guide to the Fundamentals of Python Programming
by Paul Barry

Want to learn the Python language without slogging your way through how-to manuals? With Head First Python, you'll quickly grasp Python's fundamentals by working with built-in data structures and functions. You'll build your very own web app, which—once it's ready for prime time—runs in the cloud. You'll learn how to wrangle data with Python, scrape data from the web, feed data to pandas, and interact with databases. This third edition is a complete learning experience that will help you become a bona fide Python programmer in no time.

If you've read a Head First book, you know what to expect: a visually rich format designed for the way your brain works. If you haven't, you're in for a treat. With this book, you'll learn Python through a multisensory experience that engages your mind—rather than a text-heavy approach that puts you to sleep.

by Anthony Briggs

Hello! Python fully covers the building blocks of Python programming and gives you a gentle introduction to more advanced topics such as object-oriented programming, functional programming, network programming, and program design. New (or nearly new) programmers will learn most of what they need to know to start using Python immediately.

Practical Performant Programming for Humans
by Micha Gorelick and Ian Ozsvald

Your Python code may run correctly, but you need it to run faster. Updated for Python 3, this expanded edition shows you how to locate performance bottlenecks and significantly speed up your code in high-data-volume programs. By exploring the fundamental theory behind design choices, High Performance Python helps you gain a deeper understanding of Python’s implementation.

How do you take advantage of multicore architectures or clusters? Or build a system that scales up and down without losing reliability? Experienced Python programmers will learn concrete solutions to many issues, along with war stories from companies that use high-performance Python for social media analytics, productionized machine learning, and more.

  • Get a better grasp of NumPy, Cython, and profilers
  • Learn how Python abstracts the underlying computer architecture
  • Use profiling to find bottlenecks in CPU time and memory usage
  • Write efficient programs by choosing appropriate data structures
  • Speed up matrix and vector computations
  • Use tools to compile Python down to machine code
  • Manage multiple I/O and computational operations concurrently
  • Convert multiprocessing code to run on local or remote clusters
  • Deploy code faster using tools like Docker
Playful Programming Activities to Make You Smarter
by Lee Vaughan

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.

Learning to Program with AI, Big Data and The Cloud
by Paul J. Deitel and Harvey M. Deitel

The Deitels’ Introduction to Python for Computer Science and Data Science: Learning to Program with AI, Big Data and the Cloud offers a unique approach to teaching introductory Python programming, appropriate for both computer-science and data-science audiences. Providing the most current coverage of topics and applications, the book is paired with extensive traditional supplements as well as Jupyter Notebooks supplements. Real-world datasets and artificial-intelligence technologies allow students to work on projects making a difference in business, industry, government and academia. Hundreds of examples, exercises, projects (EEPs), and implementation case studies give students an engaging, challenging and entertaining introduction to Python programming and hands-on data science.

Modern Computing in Simple Packages
by Bill Lubanovic

Easy to understand and fun to read, this updated edition of Introducing Python is ideal for beginning programmers as well as those new to the language. Author Bill Lubanovic takes you from the basics to more involved and varied topics, mixing tutorials with cookbook-style code recipes to explain concepts in Python 3. End-of-chapter exercises help you practice what you’ve learned.

You’ll gain a strong foundation in the language, including best practices for testing, debugging, code reuse, and other development tips. This book also shows you how to use Python for applications in business, science, and the arts, using various Python tools and open source packages.

by Al Sweigart

Invent Your Own Computer Games with Python will teach you how to make computer games using the popular Python programming language—even if you’ve never programmed before!

Begin by building classic games like Hangman, Guess the Number, and Tic-Tac-Toe, and then work your way up to more advanced games, like a text-based treasure hunting game and an animated collision-dodging game with sound effects. Along the way, you’ll learn key programming and math concepts that will help you take your game programming to the next level.

Learn how to:

  • Combine loops, variables, and flow control statements into real working programs
  • Choose the right data structures for the job, such as lists, dictionaries, and tuples
  • Add graphics and animation to your games with the pygame module
  • Handle keyboard and mouse input
  • Program simple artificial intelligence so you can play against the computer
  • Use cryptography to convert text messages into secret code
  • Debug your programs and find common errors

As you work through each game, you’ll build a solid foundation in Python and an understanding of computer science fundamentals.

What new game will you create with the power of Python?

The projects in this book are compatible with Python 3.

With GitHub Copilot and ChatGPT
by Leo Porter and Daniel Zingaro

Writing computer programs in Python just got a lot easier! Use AI-assisted coding tools like GitHub Copilot and ChatGPT to turn your ideas into applications faster than ever.

AI has changed the way we write computer programs. With tools like Copilot and ChatGPT, you can describe what you want in plain English, and watch your AI assistant generate the code right before your eyes. It’s perfect for beginners, or anyone who’s struggled with the steep learning curve of traditional programming.

In Learn AI-Assisted Python Programming: With GitHub Copilot and ChatGPT you’ll learn how to:

  • Write fun and useful Python applications—no programming experience required!
  • Use the Copilot AI coding assistant to create Python programs
  • Write prompts that tell Copilot exactly what to do
  • Read Python code and understand what it does
  • Test your programs to make sure they work the way you want them to
  • Fix code with prompt engineering or human tweaks
  • Apply Python creatively to help out on the job

Learn AI-Assisted Python Programming: With GitHub Copilot and ChatGPT is a hands-on beginner’s guide that is written by two esteemed computer science university professors. It teaches you everything you need to start programming Python in an AI-first world. You’ll hit the ground running, writing prompts that tell your AI-assistant exactly what you want your programs to do. Along the way, you’ll pick up the essentials of Python programming and practice the higher-level thinking you’ll need to create working apps for data analysis, automating tedious tasks, and even video games.

A Deceptively Simple Introduction to the Terrifyingly Beautiful World of Computers and Data Science
by Zed A. Shaw

Zed Shaw has created the world's most reliable system for learning Python. Follow it and you will succeed--just like the millions of beginners Zed has taught to date! You bring the discipline, persistence, and attention; the author supplies the masterful knowledge you need to succeed.

In Learn Python the Hard Way, Fifth Edition, you'll learn Python by working through 60 lovingly crafted exercises. Read them. Type in the code. Run it. Fix your mistakes. Repeat. As you do, you'll learn how a computer works, how to solve problems, and how to enjoy programming . . . even when it's driving you crazy.

  • Install a complete Python environment
  • Organize and write code
  • Fix and break code
  • Basic mathematics
  • Strings and text
  • Interact with users
  • Work with files
  • Looping and logic
  • Object-oriented programming
  • Data structures using lists and dictionaries
  • Modules, classes, and objects
  • Python packaging
  • Automated testing
  • Basic SQL for Data Science
  • Web scraping
  • Fixing bad data (munging)
  • The "Data" part of "Data Science"

It'll be frustrating at first. But if you keep trying, you'll get it--and it'll feel amazing! This course will reward you for every minute you put into it. Soon, you'll know one of the world's most powerful, popular programming languages. You'll be a Python programmer.

This Book Is Perfect For

  • Total beginners with zero programming experience
  • Junior developers who know one or two languages
  • Returning professionals who haven't written code in years
  • Aspiring Data Scientists or academics who need to learn to code
  • Seasoned professionals looking for a fast, simple crash course in Python for Data Science

Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.

Creative Coding with Processing.py
by Tristan Bunn

The perfect book for first-time programmers, Learn Python Visually introduces the fundamentals of computer coding within a visual, graphics-based context. Tristan Bunn’s creative teaching approach will help you visualize core programming concepts as you make cool pictures, animations, and simulations using Python Mode for the open source Processing development environment.

From the very first chapter, you’ll produce and manipulate colorful designs as Bunn walks you through a series of easy-to-follow graphical coding projects that grow increasingly complex. You’ll progress from drawing with code to animating a bouncing DVD screensaver to creating interactive programs. Along the way, you’ll encounter skill-building challenges on topics as diverse as video games, coffee, fine art, amoebas, and Pink Floyd.

You’ll learn how to:

  • Apply basic coding theories and concepts, like variables, data types, pixel coordinates, control flow, and algorithms
  • Write code that produces drawings, patterns, animations, data visualizations, user interfaces, and simulations
  • Use code to explore randomness, handle CSV and JSON data, and generate animations that employ trigonometry for periodic motion and Lissajous curves
  • Define functions, reduce repetition, and make your code more modular
  • Write classes and create objects to structure code more efficiently

If you’ve ever dreamed of coding for data visualizations, computer-generated art, games, or other creative technologies, Learn Python Visually is the entry point you need.

A Python Programming Primer
by Daniel Zingaro

Computers are capable of solving almost any problem when given the right instructions. That’s where programming comes in. This beginner’s book will have you writing Python programs right away. You’ll solve interesting problems drawn from real coding competitions and build your programming skills as you go.

Every chapter presents problems from coding challenge websites, where online judges test your solutions and provide targeted feedback. As you practice using core Python features, functions, and techniques, you’ll develop a clear understanding of data structures, algorithms, and other programming basics. Bonus exercises invite you to explore new concepts on your own, and multiple-choice questions encourage you to think about how each piece of code works.

You’ll learn how to:

  • Run Python code, work with strings, and use variables
  • Write programs that make decisions
  • Make code more efficient with while and for loops
  • Use Python sets, lists, and dictionaries to organize, sort, and search data
  • Design programs using functions and top-down design
  • Create complete-search algorithms and use Big O notation to design more efficient code

By the end of the book, you’ll not only be proficient in Python, but you’ll also understand how to think through problems and tackle them with code. Programming languages come and go, but this book gives you the lasting foundation you need to start thinking like a programmer.

by Mark Lutz

Get a comprehensive, in-depth introduction to the core Python language with this hands-on book. Based on author Mark Lutz’s popular training course, this updated fifth edition will help you quickly write efficient, high-quality code with Python. It’s an ideal way to begin, whether you’re new to programming or a professional developer versed in other languages.

Complete with quizzes, exercises, and helpful illustrations, this easy-to-follow, self-paced tutorial gets you started with both Python 2.7 and 3.3— the latest releases in the 3.X and 2.X lines—plus all other releases in common use today. You’ll also learn some advanced language features that recently have become more common in Python code.

  • Explore Python’s major built-in object types such as numbers, lists, and dictionaries
  • Create and process objects with Python statements, and learn Python’s general syntax model
  • Use functions to avoid code redundancy and package code for reuse
  • Organize statements, functions, and other tools into larger components with modules
  • Dive into classes: Python’s object-oriented programming tool for structuring code
  • Write large programs with Python’s exception-handling model and development tools
  • Learn advanced Python tools, including decorators, descriptors, metaclasses, and Unicode processing
Build Apps with Voice Control and Speech Recognition
by Mark Liu

This fun, hands-on book will take your basic Python skills to the next level as you build voice-controlled apps to use in your daily life. Starting with a Python refresher and an introduction to speech-recognition/text-to-speech functionalities, you’ll soon ease into more advanced topics, like making your own modules and building working voice-controlled apps.

Each chapter scaffolds multiple projects that allow you to see real results from your code at a manageable pace, while end-of-chapter exercises strengthen your understanding of new concepts. You’ll design interactive games, like Connect Four and Tic-Tac-Toe, and create intelligent computer opponents that talk and take commands; you’ll make a real-time language translator, and create voice-activated financial-market apps that track the stocks or cryptocurrencies you are interested in. Finally, you’ll load all of these features into the ultimate virtual personal assistant – a conversational VPA that tells jokes, reads the news, and gives you hands-free control of your email, browser, music player, desktop files, and more.

Along the way, you’ll learn how to:

  • Build Python modules, implement animations, and integrate live data into an app
  • Use web-scraping skills for voice-controlling podcasts, videos, and web searches
  • Fine-tune the speech recognition to accept a variety of input
  • Associate regular tasks like opening files and accessing the web with speech commands
  • Integrate functionality from other programs into a single VPA with computational knowledge engines to answer almost any question

Packed with cross-platform code examples to download, practice activities and exercises, and explainer images, you’ll quickly become proficient in Python coding in general and speech recognition/text to speech in particular.

An Illustrated Guide to Exploring Math with Code
by Peter Farrell

Math Adventures with Python will show you how to harness the power of programming to keep math relevant and fun. With the aid of the Python programming language, you’ll learn how to visualize solutions to a range of math problems as you use code to explore key mathematical concepts like algebra, trigonometry, matrices, and cellular automata.

Once you’ve learned the programming basics like loops and variables, you’ll write your own programs to solve equations quickly, make cool things like an interactive rainbow grid, and automate tedious tasks like factoring numbers and finding square roots. You’ll learn how to write functions to draw and manipulate shapes, create oscillating sine waves, and solve equations graphically.

You’ll also learn how to:

  • Draw and transform 2D and 3D graphics with matrices
  • Make colorful designs like the Mandelbrot and Julia sets with complex numbers
  • Use recursion to create fractals like the Koch snowflake and the Sierpinski triangle
  • Generate virtual sheep that graze on grass and multiply autonomously
  • Crack secret codes using genetic algorithms

As you work through the book’s numerous examples and increasingly challenging exercises, you’ll code your own solutions, create beautiful visualizations, and see just how much more fun math can be!

Finding Stories in Internet Data
by Lam Thuy Vo

Did fake Twitter accounts help sway a presidential election? What can Facebook and Reddit archives tell us about human behavior? In Mining Social Media, senior BuzzFeed reporter Lam Thuy Vo shows you how to use Python and key data analysis tools to find the stories buried in social media.

Whether you’re a professional journalist, an academic researcher, or a citizen investigator, you’ll learn how to use technical tools to collect and analyze data from social media sources to build compelling, data-driven stories.

Learn how to:

  • Write Python scripts and use APIs to gather data from the social web
  • Download data archives and dig through them for insights
  • Inspect HTML downloaded from websites for useful content
  • Format, aggregate, sort, and filter your collected data using Google Sheets
  • Create data visualizations to illustrate your discoveries
  • Perform advanced data analysis using Python, Jupyter Notebooks, and the pandas library
  • Apply what you’ve learned to research topics on your own

Social media is filled with thousands of hidden stories just waiting to be told. Learn to use the data-sleuthing tools that professionals use to write your own data-driven stories.

Code a Space Adventure Game!
by Sean McManus

Launch into coding with Mission Python, a space-themed guide to building a complete computer game in Python. You'll learn programming fundamentals like loops, strings, and lists as you build Escape!, an exciting game with a map to explore, items to collect, and tricky logic puzzles to solve. As you work through the book, you'll build exercises and mini-projects, like making a spacewalk simulator and creating an astronaut's safety checklist that will put your new Python skills to the test.

You'll learn how to use Pygame Zero, a free resource that lets you add graphics and sound effects to your creations, and you'll get useful game-making tips, such as how to design fun puzzles and intriguing maps. Before you know it, you'll have a working, awesome game to stump your friends with (and some nifty coding skills, too!). You can follow this book using a Raspberry Pi or a Microsoft Windows PC, and the 3D graphics and sound effects you need are provided as a download.

Check out the Escape game you'll build in Mission Python!

An Introduction for Scientists and Engineers
by Allen B. Downey

Modeling and Simulation in Python is a thorough but easy-to-follow introduction to physical modeling—that is, the art of describing and simulating real-world systems.

Readers are guided through modeling things like world population growth, infectious disease, bungee jumping, baseball flight trajectories, celestial mechanics, and more while simultaneously developing a strong understanding of fundamental programming concepts like loops, vectors, and functions.

Clear and concise, with a focus on learning by doing, the author spares the reader abstract, theoretical complexities and gets right to hands-on examples that show how to produce useful models and simulations.

A Practical Introduction
by Yuli Vasiliev

Natural Language Processing with Python and spaCy will show you how to create NLP applications like chatbots, text-condensing scripts, and order-processing tools quickly and easily. You’ll learn how to leverage the spaCy library to extract meaning from text intelligently; how to determine the relationships between words in a sentence (syntactic dependency parsing); identify nouns, verbs, and other parts of speech (part-of-speech tagging); and sort proper nouns into categories like people, organizations, and locations (named entity recognizing). You’ll even learn how to transform statements into questions to keep a conversation going.

You’ll also learn how to:

  • Work with word vectors to mathematically find words with similar meanings (Chapter 5)
  • Identify patterns within data using spaCy's built-in displaCy visualizer (Chapter 7)
  • Automatically extract keywords from user input and store them in a relational database (Chapter 9)
  • Deploy a chatbot app to interact with users over the internet (Chapter 11)

“Try This” sections in each chapter encourage you to practice what you’ve learned by expanding the book’s example scripts to handle a wider range of inputs, add error handling, and build professional-quality applications.

By the end of the book, you’ll be creating your own NLP applications with Python and spaCy.

Master OOP by Building Games and GUIs
by Irv Kalb

Object-Oriented Programming (OOP) is a paradigm that combines data and code into cohesive units, allowing you to think differently about computational problems and solve them in a highly reusable way. Aimed at intermediate-level programmers, Object-Oriented Python is a hands-on tutorial that goes deep into the core tenets of OOP, showing you how to use encapsulation, polymorphism, and inheritance to write games and apps using Python.

The book begins by demonstrating key problems inherent in procedural programming, then guides you through the basics of creating classes and objects in Python. You’ll build on this groundwork by developing buttons, text fields, and other GUI elements that are standard in event-driven environments. You’ll also use many real-world code examples and two pygame-based packages to help turn theory into practice, enabling you to easily write interactive games and applications complete with GUI widgets, animations, multiple scenes, and reusable game logic. In the final chapter, you’ll bring it all together by building a fully functional video game that incorporates many of the OOP techniques and GUI elements covered in the book.

You’ll learn how to:

  • Create and manage multiple objects using an object manager object
  • Use encapsulation to hide the inner details of objects from client code
  • Use polymorphism to define one interface and implement it in multiple classes
  • Apply inheritance to build on existing code

Object-Oriented Python is a visual, intuitive guide to fully understanding how OOP operates and how you can use it to make your code more maintainable, readable, and efficient—without sacrificing functionality.

by Dane Hillard

Professional developers know the many benefits of writing application code that’s clean, well-organized, and easy to maintain. By learning and following established patterns and best practices, you can take your code and your career to a new level.

With Practices of the Python Pro, you’ll learn to design professional-level, clean, easily maintainable software at scale using the incredibly popular programming language, Python. You’ll find easy-to-grok examples that use pseudocode and Python to introduce software development best practices, along with dozens of instantly useful techniques that will help you code like a pro.

Test, share, and automate your projects
by Dane Hillard

Create masterful, maintainable Python packages! This book includes pro tips for design, automation, testing, deployment, and even release as an open source project!

In Publishing Python Packages you will learn how to:

  • Build extensions and console script commands
  • Use tox to automate packaging, installing, and testing
  • Build a continuous integration pipeline using GitHub Actions
  • Improve code quality and reduce manual review using black, mypy, and flake8
  • Create published documentation for your packages
  • Keep packages up to date with pyupgrade and Dependabot
  • Foster an open source community using GitHub features

Publishing Python Packages teaches you how to easily share your Python code with your team and the outside world. Learn a repeatable and highly automated process for package maintenance that’s based on the best practices, tools, and standards of Python packaging. This book walks you through creating a complete package, including a C extension, and guides you all the way to publishing on the Python Package Index. Whether you’re entirely new to Python packaging or looking for optimal ways to maintain and scale your packages, this fast-paced and engaging guide is for you.

by Matthew Fowler

Learn how to speed up slow Python code with concurrent programming and the cutting-edge asyncio library.

  • Use coroutines and tasks alongside async/await syntax to run code concurrently
  • Build web APIs and make concurrency web requests with aiohttp
  • Run thousands of SQL queries concurrently
  • Create a map-reduce job that can process gigabytes of data concurrently
  • Use threading with asyncio to mix blocking code with asyncio code

Python is flexible, versatile, and easy to learn. It can also be very slow compared to lower-level languages.

Python Concurrency with asyncio teaches you how to boost Python's performance by applying a variety of concurrency techniques. You'll learn how the complex-but-powerful asyncio library can achieve concurrency with just a single thread and use asyncio's APIs to run multiple web requests and database queries simultaneously. The book covers using asyncio with the entire Python concurrency landscape, including multiprocessing and multithreading.

by David Beazley and Brian K. Jones

If you need help writing programs in Python 3, or want to update older Python 2 code, this book is just the ticket. Packed with practical recipes written and tested with Python 3.3, this unique cookbook is for experienced Python programmers who want to focus on modern tools and idioms.

Inside, you’ll find complete recipes for more than a dozen topics, covering the core Python language as well as tasks common to a wide variety of application domains. Each recipe contains code samples you can use in your projects right away, along with a discussion about how and why the solution works.

Topics include:

  • Data Structures and Algorithms
  • Strings and Text
  • Numbers, Dates, and Times
  • Iterators and Generators
  • Files and I/O
  • Data Encoding and Processing
  • Functions
  • Classes and Objects
  • Metaprogramming
  • Modules and Packages
  • Network and Web Programming
  • Concurrency
  • Utility Scripting and System Administration
  • Testing, Debugging, and Exceptions
  • C Extensions
A Hands-On, Project-Based Introduction to Programming
by Eric Matthes

Python Crash Course is the world’s best-selling guide to the Python programming language. This fast-paced, thorough introduction will have you writing programs, solving problems, and developing functioning applications in no time.

You’ll start by learning basic programming concepts, such as variables, lists, classes, and loops, and practice writing clean code with exercises for each topic. You’ll also learn how to make your programs interactive and test your code safely before adding it to a project. You’ll put your new knowledge into practice by creating a Space Invaders–inspired arcade game, building a set of data visualizations with Python’s handy libraries, and deploying a simple application online.

As you work through the book, you’ll learn how to:

  • Use powerful Python libraries and tools, including pytest, Pygame, Matplotlib, Plotly, and Django
  • Make increasingly complex 2D games that respond to keypresses and mouse clicks
  • Generate interactive data visualizations using a variety of datasets
  • Build apps that allow users to create accounts and manage their own data, and deploy your apps online
  • Troubleshoot coding errors and solve common programming problems

New to this edition: This third edition is completely revised to reflect the latest in Python code. New and updated coverage includes VS Code for text editing, the pathlib module for file handling, pytest for testing your code, as well as the latest features of Matplotlib, Plotly, and Django.

If you’ve been thinking about digging into programming, Python Crash Course will provide you with the skills to write real programs fast. Why wait any longer? Start your engines and code!

A Hands-On Introduction
by Yuli Vasiliev

You will discover Python’s rich set of built-in data structures for basic operations, as well as its robust ecosystem of open-source libraries for data science, including NumPy, pandas, scikit-learn, matplotlib, and more. Examples show how to load data in various formats, how to streamline, group, and aggregate data sets, and how to create charts, maps, and other visualizations. Later chapters go in-depth with demonstrations of real-world data applications, including using location data to power a taxi service, market basket analysis to identify items commonly purchased together, and machine learning to predict stock prices.

63 techniques to improve your Python code
by Yong Cui

Have you ever asked yourself, “How do I do that in Python?” If so, you’ll love this practical collection of the most important Python techniques.

Python How-To includes over 60 detailed answers to questions like:

  • How do I join and split strings?
  • How do I access dictionary keys, values, and items?
  • How do I set and use the return value in function calls?
  • How do I process JSON data?
  • How do I create lazy attributes to improve performance?
  • How do I change variables in a different namespace?

…and much more!

Python How-To walks you through the most important coding techniques in Python. Whether you’re doing data science, building web applications, or writing admin scripts, you’ll find answers to your “how-to” questions in this book. Inside you’ll find important insights into both Python basics and deep-dive topics to help you skill-up at any stage of your Python career. Author Yong Cui’s clear and practical writing is instantly accessible and makes it easy to take advantage of Python’s versatile tools and libraries. Perfect to be read both from cover to cover, and whenever you need help troubleshooting your code.

A Desktop Quick Reference
by Alex Martelli, Anna Martelli Ravenscroft, Steve Holden and Paul McGuire

Python was recently ranked as today's most popular programming language on the TIOBE index, thanks to its broad applicability to design and prototyping to testing, deployment, and maintenance. With this updated fourth edition, you'll learn how to get the most out of Python, whether you're a professional programmer or someone who needs this language to solve problems in a particular field.

Carefully curated by recognized experts in Python, this new edition focuses on version 3.10, bringing this seminal work on the Python language fully up to date on five version releases, including preview coverage of upcoming 3.11 features.

This handy guide will help you:

  • Learn how Python represents data and program as objects
  • Understand the value and uses of type annotations
  • Examine which language features appeared in which recent versions
  • Discover how to use modern Python idiomatically
  • Learn ways to structure Python projects appropriately
  • Understand how to debug Python code
Build robust and maintainable object-oriented Python Applications and libraries
by Steven F. Lott and Dusty Phillips

Object-oriented programming (OOP) is a popular design paradigm in which data and behaviors are encapsulated in such a way that they can be manipulated together. Python Object-Oriented Programming, Fourth Edition dives deep into the various aspects of OOP, Python as an OOP language, common and advanced design patterns, and hands-on data manipulation and testing of more complex OOP systems. These concepts are consolidated by open-ended exercises, as well as a real-world case study at the end of every chapter, newly written for this edition. All example code is now compatible with Python 3.9+ syntax and has been updated with type hints for ease of learning.

Steven and Dusty provide a comprehensive, illustrative tour of important OOP concepts, such as inheritance, composition, and polymorphism, and explain how they work together with Python's classes and data structures to facilitate good design. In addition, the book also features an in-depth look at Python's exception handling and how functional programming intersects with OOP. Two very powerful automated testing systems, unittest and pytest, are introduced. The final chapter provides a detailed discussion of Python's concurrent programming ecosystem.

By the end of the book, you will have a thorough understanding of how to think about and apply object-oriented principles using Python syntax and be able to confidently create robust and reliable programs.

What you will learn

  • Implement objects in Python by creating classes and defining methods
  • Extend class functionality using inheritance
  • Use exceptions to handle unusual situations cleanly
  • Understand when to use object-oriented features, and more importantly, when not to use them
  • Discover several widely used design patterns and how they are implemented in Python
  • Uncover the simplicity of unit and integration testing and understand why they are so important
  • Learn to statically type check your dynamic code
  • Understand concurrency with asyncio and how it speeds up programs

Who this book is for

If you are new to object-oriented programming techniques, or if you have basic Python skills and wish to learn how and when to correctly apply OOP principles in Python, this is the book for you. Moreover, if you are an object-oriented programmer coming from other languages or seeking a leg up in the new world of Python, you will find this book a useful introduction to Python. Minimal previous experience with Python is necessary.

Write Concise, Eloquent Python Like a Professional
by Christian Mayer

Python One-Liners will teach you how to read and write “one-liners”: concise statements of useful functionality packed into a single line of code. You'll learn how to systematically unpack and understand any line of Python code, and write eloquent, powerfully compressed Python like an expert.

The book’s five chapters cover tips and tricks, regular expressions, machine learning, core data science topics, and useful algorithms. Detailed explanations of one-liners introduce key computer science concepts and boost your coding and analytical skills.

You'll learn about advanced Python features such as list comprehension, slicing, lambda functions, regular expressions, map and reduce functions, and slice assignments.

You’ll also learn how to:

  • Leverage data structures to solve real-world problems, like using Boolean indexing to find cities with above-average pollution
  • Use NumPy basics such as array, shape, axis, type, broadcasting, advanced indexing, slicing, sorting, searching, aggregating, and statistics
  • Calculate basic statistics of multidimensional data arrays and the K-Means algorithms for unsupervised learning
  • Create more advanced regular expressions using grouping and named groups, negative lookaheads, escaped characters, whitespaces, character sets (and negative characters sets), and greedy/nongreedy operators
  • Understand a wide range of computer science topics, including anagrams, palindromes, supersets, permutations, factorials, prime numbers, Fibonacci numbers, obfuscation, searching, and algorithmic sorting

By the end of the book, you’ll know how to write Python at its most refined, and create concise, beautiful pieces of "Python art" in merely a single line.

Geeky Projects for the Curious Programmer
by Mahesh Venkitachalam

Harness the power of Python as you turn code into tangible creations with Python Playground, a collection of 15 inventive projects that will expand your programming horizons, spark your curiosity, and elevate your coding skills.

Go beyond the basics as you write programs to generate art and music, simulate real-world phenomena, and interact with hardware, all through the use of Python and common libraries such as numpy, matplotlib, and Pillow.

As you work through the book’s projects, you will:

  • Craft intricate Spirograph-like designs with parametric equations and the turtle module
  • Generate music by synthesizing plucked string sounds
  • Transform everyday images into ASCII art, photomosaics, and eye-popping autostereograms
  • Design engaging cellular automata and flocking simulations
  • Explore the realm of 3D graphics, from basic shape rendering to visualizing MRI scan data
  • Build a Raspberry Pi–powered laser show that dances along with music

New to this edition: We’ve expanded your playground with five new projects: you’ll draw fractals, bring Conway’s Game of Life into 3D space, and use a Raspberry Pi and Python to create a musical instrument, an IoT garden monitor, and even a machine learning–driven speech recognition system.

Whether you’re a seasoned professional or just getting started, you’ll find Python Playground to be a great way to learn, experiment with, and master this versatile programming language.

Simple, Rapid, Effective, and Scalable
by Brian Okken

Test applications, packages, and libraries large and small with pytest, Python's most powerful testing framework. pytest helps you write tests quickly and keep them readable and maintainable. In this fully revised edition, explore pytest's superpowers - simple asserts, fixtures, parametrization, markers, and plugins - while creating simple tests and test suites against a small database application. Using a robust yet simple fixture model, it's just as easy to write small tests with pytest as it is to scale up to complex functional testing. This book shows you how.

pytest is undeniably the best choice for testing Python projects. It's a full-featured, flexible, and extensible testing framework. pytest's fixture model allows you to share test data and setup procedures across multiple layers of tests. The pytest framework gives you powerful features such as assert rewriting, parametrization, markers, plugins, parallel test execution, and clear test failure reporting - with no boilerplate code.

With simple step-by-step instructions and sample code, this book gets you up to speed quickly on this easy-to-learn yet powerful tool. Write short, maintainable tests that elegantly express what you're testing. Speed up test times by distributing tests across multiple processors and running tests in parallel. Use Python's builtin assert statements instead of awkward assert helper functions to make your tests more readable. Move setup code out of tests and into fixtures to separate setup failures from test failures. Test error conditions and corner cases with expected exception testing, and use one test to run many test cases with parameterized testing. Extend pytest with plugins, connect it to continuous integration systems, and use it in tandem with tox, mock, coverage, and even existing unittest tests.

Write simple, maintainable tests quickly with pytest.

An Introduction to Using Anaconda, JupyterLab, and Python's Scientific Libraries
by Lee Vaughan

Python Tools for Scientists will introduce you to Python tools you can use in your scientific research, including Anaconda, Spyder, Jupyter Notebooks, JupyterLab, and numerous Python libraries. You’ll learn to use Python for tasks such as creating visualizations, representing geospatial information, simulating natural events, and manipulating numerical data.

Once you’ve built an optimal programming environment with Anaconda, you’ll learn how to organize your projects and use interpreters, text editors, notebooks, and development environments to work with your code. Following the book’s fast-paced Python primer, you’ll tour a range of scientific tools and libraries like scikit-learn and seaborn that you can use to manipulate and visualize your data, or analyze it with machine learning algorithms.

You’ll also learn how to:

  • Create isolated projects in virtual environments, build interactive notebooks, test code in the Qt console, and use Spyder’s interactive development features
  • Use Python’s built-in data types, write custom functions and classes, and document your code
  • Represent data with the essential NumPy, Matplotlib, and pandas libraries
  • Use Python plotting libraries like Plotly, HoloViews, and Datashader to handle large datasets and create 3D visualizations

Regardless of your scientific field, Python Tools for Scientists will show you how to choose the best tools to meet your research and computational analysis needs.

50 ten-minute exercises
by Reuven M. Lerner

The only way to master a skill is to practice. In

Python Workout, author

Reuven M. Lerner guides you through 50 carefully selected exercises that invite you to flex your programming muscles. As you take on each new challenge, you'll build programming skill and confidence. The thorough explanations help you lock in what you've learned and apply it to your own projects. Along the way, Python Workout provides over four hours of video instruction walking you through the solutions to each exercise and dozens of additional exercises for you to try on your own.

A Hacker's Guide to Solving Problems with Code
by Lee Vaughan

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.

Detailed Solutions in Eight Programming Languages
by Jan Goyvaerts and Steven Levithan

Take the guesswork out using regular expressions to search and manipulate text. With this updated cookbook, you have access to hundreds of proven recipes for today's most popular programming languages - including C#, Java, JavaScript (including XRegExp), Perl, PHP, Python, Ruby, and VB.NET. As useful as regular expressions can be for programmers, their power doesn't come worry-free. This guide will deepen your understanding, no matter how much experience you have with this reliable tool. You'll learn powerful new tricks, steer clear of flavor-specific gotchas, and save valuable time with this huge library of solutions to difficult, real-world problems.

Understand the basics of regular expressions through a concise tutorial Use regular expressions effectively in several programming and scripting languages Learn how to validate and format input Manage words, lines, special characters, and numerical values Find solutions for using regular expressions in URLs, paths, markup, and data exchange Discover the nuances of more advanced regex features Experience how regular expressions' APIs, syntax, and behavior differ from language to language Write better regular expressions for custom needs

Black-Belt Advice on Deployment, Scalability, Testing, and More
by Julien Danjou

Sharpen your Python skills as you dive deep into the Python programming language with Serious Python. You’ll cover a range of advanced topics like multithreading and memorization, get advice from experts on things like designing APIs and dealing with databases, and learn Python internals to help you gain a deeper understanding of the language itself. Written for developers and experienced programmers, Serious Python brings together over 15 years of Python experience to teach you how to avoid common mistakes, write code more efficiently, and build better programs in less time.

As you make your way through the book’s extensive tutorials, you’ll learn how to start a project and tackle topics like versioning, layouts, coding style, and automated checks. You’ll learn how to package your software for distribution, optimize performance, use the right data structures, define functions efficiently, pick the right libraries, build future-proof programs, and optimize your programs down to the bytecode.

You’ll also learn how to:

  • Make and use effective decorators and methods, including abstract, static, and class methods
  • Employ Python for functional programming using generators, pure functions, and functional functions
  • Extend flake8 to work with the abstract syntax tree (AST) to introduce more sophisticated automatic checks into your programs
  • Apply dynamic performance analysis to identify bottlenecks in your code
  • Work with relational databases and effectively manage and stream data with PostgreSQL

If you’ve been looking for a way to take your Python skills from good to great, Serious Python will help you get there. Learn from the experts and get seriously good at Python with Serious Python!

"Serious Python contains a considerable amount of judicious battle-tested advice from an experienced developer—as well as some insightful gems from the guest contributors—making the overall effort a welcome addition to the limited number of books aimed at more advanced Python programmers." —Michael J. Ross, web developer and former Slashdot contributor.

by Ted Hart-Davis and Guy Hart-Davis

A simple, straightforward, and hands-on roadmap to the world of computer programming with Python

Teach Yourself VISUALLY: Python is your personal guide to getting you started in programming. As one of the world's most popular—and most accessible—coding languages, Python is your gateway into the wide and wonderful world of computer science. This hands-on guide walks you through Python step by clearly illustrated step, from writing your very first Python code in a terminal window or the VS Code app through to creating your own lists, dictionaries, and custom classes.

In the book, you’ll learn to:

  • Install Python and the tools you need to work with it on Windows, macOS, and Linux
  • Work with files and folders, manipulate text, and create powerful functions that do exactly what you want
  • Write clean code that makes decisions effectively, repeats actions as needed, and handles any errors that occur

A must-have resource for aspiring programmers starting from the very beginning, Teach Yourself VISUALLY: Python is also an indispensable handbook for programmers making a transition from another language.

81 Easy Practice Programs
by Al Sweigart
  • Download the resource files used in the book

If you’ve mastered basic Python syntax and you’re ready to start writing programs, you’ll find The Big Book of Small Python Projects both enlightening and fun. This collection of 81 Python projects will have you making digital art, games, animations, counting pro- grams, and more right away. Once you see how the code works, you’ll practice re-creating the programs and experiment by adding your own custom touches.

These simple, text-based programs are 256 lines of code or less. And whether it’s a vintage screensaver, a snail-racing game, a clickbait headline generator, or animated strands of DNA, each project is designed to be self-contained so you can easily share it online.

You’ll create:

  • Hangman, Blackjack, and other games to play against your friends or the computer
  • Simulations of a forest fire, a million dice rolls, and a Japanese abacus
  • Animations like a virtual fish tank, a rotating cube, and a bouncing DVD logo screensaver
  • A first-person 3D maze game
  • Encryption programs that use ciphers like ROT13 and Vigenère to conceal text

If you’re tired of standard step-by-step tutorials, you’ll love the learn-by-doing approach of The Big Book of Small Python Projects. It’s proof that good things come in small programs!

Build Dashboards with Python and Plotly
by Adam Schroeder, Christian Mayer and Ann Marie Ward

A swift and practical introduction to building interactive data visualization apps in Python, known as dashboards. You’ve seen dashboards before; think election result visualizations you can update in real time, or population maps you can filter by demographic. With the Python Dash library you’ll create analytic dashboards that present data in effective, usable, elegant ways in just a few lines of code.

The book is fast-paced and caters to those entirely new to dashboards. It will talk you through the necessary software, then get straight into building the dashboards themselves. You’ll learn the basic format of a Dash app by building a twitter analysis dashboard that maps the number of likes certain accounts gained over time. You’ll build up skills through three more sophisticated projects. The first is a global analysis app that compares country data in three areas: the percentage of a population using the internet, percentage of parliament seats held by women, and CO2 emissions. You’ll then build an investment portfolio dashboard, and an app that allows you to visualize and explore machine learning algorithms.

In this book you will:

  • Create and run your first Dash apps
  • Use the pandas library to manipulate and analyze social media data
  • Use Git to download and build on existing apps written by the pros
  • Visualize machine learning models in your apps
  • Create and manipulate statistical and scientific charts and maps using Plotly

Dash combines several technologies to get you building dashboards quickly and efficiently. This book will do the same.

by Naomi Ceder

This third revision of Manning's popular The Quick Python Book offers a clear, crisp updated introduction to the elegant Python programming language and its famously easy-to-read syntax. Written for programmers new to Python, this latest edition includes new exercises throughout. It covers features common to other languages concisely, while introducing Python's comprehensive standard functions library and unique features in detail.

Ace the Coding Interview with Python and JavaScript
by Al Sweigart

Recursion has an intimidating reputation: it’s considered to be an advanced computer science topic frequently brought up in coding interviews. But there’s nothing magical about recursion.

The Recursive Book of Recursion uses Python and JavaScript examples to teach the basics of recursion, exposing the ways that it’s often poorly taught and clarifying the fundamental principles of all recursive algorithms. You’ll learn when to use recursive functions (and, most importantly, when not to use them), how to implement the classic recursive algorithms often brought up in job interviews, and how recursive techniques can help solve countless problems involving tree traversal, combinatorics, and other tricky topics.   This project-based guide contains complete, runnable programs to help you learn:

  • How recursive functions make use of the call stack, a critical data structure almost never discussed in lessons on recursion
  • How the head-tail and “leap of faith” techniques can simplify writing recursive functions
  • How to use recursion to write custom search scripts for your filesystem, draw fractal art, create mazes, and more
  • How optimization and memoization make recursive algorithms more efficient

Al Sweigart has built a career explaining programming concepts in a fun, approachable manner. If you’ve shied away from learning recursion but want to add this technique to your programming toolkit, or if you’re racing to prepare for your next job interview, this book is for you.

How the pros use Python and Flask
by Doug Farrell

If you’re new to Python, it can be tough to understand when, where, and how to use all its language features. This friendly guide shows you how the Python ecosystem fits together, and grounds you in the skills you need to continue your journey to being a software developer.

Inside The Well-Grounded Python Developer you will discover:

  • Building modules of functionality
  • Creating a well-constructed web server application
  • Integrating database access into your Python applications
  • Refactor and decoupling systems to help scale them
  • How to think about the big picture of your application

The Well-Grounded Python Developer builds on Python skills you’ve learned in isolation and shows you how to unify them into a meaningful whole. It helps you understand the dizzying array of libraries and teaches important concepts, like modular construction, APIs, and the design of a basic web server. As you work through this practical guide, you’ll discover how all the bits of Python link up as you build and modify a typical web server application—the kind of web app that’s in high demand by modern businesses.

How to Think Like a Computer Scientist
by Allen B. Downey

If you want to learn how to program, working with Python is an excellent way to start. This hands-on guide takes you through the language a step at a time, beginning with basic programming concepts before moving on to functions, recursion, data structures, and object-oriented design. This second edition and its supporting code have been updated for Python 3.

Through exercises in each chapter, youâ??ll try out programming concepts as you learn them. Think Python is ideal for students at the high school or college level, as well as self-learners, home-schooled students, and professionals who need to learn programming basics. Beginners just getting their feet wet will learn how to start with Python in a browser.

  • Start with the basics, including language syntax and semantics
  • Get a clear definition of each programming concept
  • Learn about values, variables, statements, functions, and data structures in a logical progression
  • Discover how to work with files and databases
  • Understand objects, methods, and object-oriented programming
  • Use debugging techniques to fix syntax, runtime, and semantic errors
  • Explore interface design, data structures, and GUI-based programs through case studies
Learn coding and testing with puzzles and games
by Ken Youens-Clark

A long journey is really a lot of little steps. The same is true when you're learning Python, so you may as well have some fun along the way! Written in a lighthearted style with entertaining exercises that build powerful skills,

Tiny Python Projects takes you from amateur to Pythonista as you create 22 bitesize programs. Each tiny project teaches you a new programming concept, from the basics of lists and strings right through to regular expressions and randomness. Along the way you'll also discover how testing can make you a better programmer in any language.