All You Need to Know, and Nothing You Don't, to Solve Real Problems with Python.
Python is one of the most popular programming languages in the world, used for everything from shell scripts to web development to data science. As a result, Python is a great language to learn, but you don't need to learn "everything" to get started, just how to use it efficiently to solve real problems. In Learn Enough Python to Be Dangerous, renowned instructor Michael Hartl teaches the specific concepts, skills, and approaches you need to be professionally productive.
Even if you've never programmed before, Hartl helps you quickly build technical sophistication and master the lore you need to succeed. Hartl introduces Python both as a general-purpose language and as a specialist tool for web development and data science, presenting focused examples and exercises that help you internalize what matters, without wasting time on details pros don't care about. Soon, it'll be like you were born knowing this stuff--and you'll be suddenly, seriously dangerous.
You’ll begin by exploring the core concepts of Python programming using a combination of the interactive Python interpreter and text files run at the command line. The result is a solid understanding of both object-oriented programming and functional programming in Python. You’ll then build on this foundation to develop and publish a simple self-contained Python package. You’ll then use this package in a simple dynamic web application built using the Flask web framework, which you’ll also deploy to the live Web. As a result, Learn Enough Python to Be Dangerous is especially appropriate as a prerequisite to learning web development with Python.
Python is one of the world’s most popular programming languages, and for good reason. Python has a clean syntax, flexible data types, a wealth of useful libraries, and a powerful and elegant design that supports multiple styles of programming. Python has seen particularly robust adoption for command-line programs (also known as scripting, as discussed in Chapter 9), web development (via frameworks like Flask (Chapter 10) and Django), and Data Science (especially data analysis using Pandas and Machine Learning with libraries like Scikit-learn (Chapter 11)).
Data Science is a rapidly developing field that combines tools from computation and statistics to create insights and draw conclusions from data. That description may sound a little vague, and indeed there is no universally accepted definition of the field; for example, some people think “data science” is just a fancy term for “statistics”, while others hold that statistics is the least important part of Data Science.
Luckily, there is broad agreement that Python is an excellent tool for Data Science, whatever it is exactly. There is also a general consensus about which specific Python tools are most useful for the subject. The purpose of this chapter is to introduce some of those tools and use them to investigate some aspects of Data Science for which Python is especially well-suited.
Learn enough аbout:
Applying core Python concepts with the interactive interpreter and command line
Writing object-oriented code with Python's native objects
Developing and publishing self-contained Python packages
Using elegant, powerful functional programming techniques, including Python comprehensions
Building new objects, and extending them via Test-Driven Development (TDD)
Leveraging Python's exceptional shell scripting capabilities
Creating and deploying a full web app, using routes, layouts, templates, and forms
Getting started with data-science tools for numerical computations, data visualization, data analysis, and machine learning
Mastering concrete and informal skills every developer needs
Michael Hartl's Learn Enough Series includes books and video courses that focus on the most important parts of each subject, so you don't have to learn everything to get started--you just have to learn enough to be dangerous and solve technical problems yourself. Like this book? Don't miss Michael Hartl's companion video tutorial, Learn Enough Python to Be Dangerous LiveLessons. Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.
Author(s): Michael Hartl
Publisher: Addison-Wesley
Year: 2023
Language: English
Pages: 782
Contents
1 Preface
2 Acknowledgments
3 About the Author
4 Chapter 1 Hello, World!
1 1.1 Introduction to Python
1 1.1.1 System Setup and Installation
2 1.2 Python in a REPL
1 1.2.1 Exercises
2 1.3 Python in a File
1 1.3.1 Exercise
2 1.4 Python in a Shell Script
1 1.4.1 Exercise
2 1.5 Python in a Web Browser
1 1.5.1 Deployment
2 1.5.2 Exercises
3 Chapter 2 Strings
1 2.1 String Basics
1 2.1.1 Exercises
2 2.2 Concatenation and Interpolation
1 2.2.1 Formatted Strings
2 2.2.2 Raw Strings
3 2.2.3 Exercises
4 2.3 Printing
1 2.3.1 Exercises
2 2.4 Length, Booleans, and Control Flow
1 2.4.1 Combining and Inverting Booleans
2 2.4.2 Boolean Context
3 2.4.3 Exercises
4 2.5 Methods
1 2.5.1 Exercises
1 3.2.1 Exercises
2 3.3 List Slicing
1 3.3.1 Exercises
2 3.4 More List Techniques
1 3.4.1 Element Inclusion
2 3.4.2 Sorting and Reversing
3 3.4.3 Appending and Popping
4 3.4.4 Undoing a Split
5 3.4.5 Exercises
6 3.5 List Iteration
1 3.5.1 Exercises
2 3.6 Tuples and Sets
1 3.6.1 Exercises
2 Chapter 4 Other Native Objects
1 4.1 Math
1 4.1.1 More Advanced Operations
2 4.1.2 Math to String
3 4.1.3 Exercises
4 4.2 Times and Datetimes
1 4.2.1 Exercises
2 4.3 Regular Expressions
1 4.3.1 Splitting on Regexes
2 4.3.2 Exercises
3 4.4 Dictionaries
1 4.4.1 Dictionary Iteration
2 4.4.2 Merging Dictionaries