SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Video accessible from your Account page after purchase.
Register your product to gain access to bonus material or receive a coupon.
7.5 Hours of Video Instruction
In Learn Enough Python to Be Dangerous LiveLessons: Software Development, Flask Web Apps, and Beginning Data Science with Python, renowned instructor Michael Hartl teaches you to write practical and modern programs using the elegant and powerful Python programming language.
Overview
Programmers love Python for its clean syntax, flexible data types, a wealth of useful libraries, and a powerful and elegant design that supports multiple styles of programming. That's why it is popular for varied uses such as scripting, web development, and data science. You'll love Python too, but you don't need to learn "everything" about it, just how to use it efficiently to solve real problems. Best-selling author Michael Hartl gets you started writing practical and modern Python programs as fast as possible, with a focus on the real tools used every day by software developers. You'll learn how to use Python interactively, write shell scripts in it, use Python and a web framework to make simple dynamic web applications, and use Python libraries to do data science.
Even if you're new to programming, Hartl helps you quickly build technical sophistication as you gain a solid understanding of object-oriented and functional programming, develop and publish a Python web application with the Flask framework. Focused exercises 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.
About the Instructor
Michael Hartl is the creator of the Ruby on Rails Tutorial, one of the leading introductions to web development, and is cofounder and principal author at Learn Enough. Previously, he was a physics instructor at the California Institute of Technology (Caltech), where he received a Lifetime Achievement Award for Excellence in Teaching. He is a graduate of Harvard College, has a Ph.D. in Physics from Caltech, and is an alumnus of the Y Combinator entrepreneur program.
Skill Level
Learn How To
Who Should Take This Course
Course Requirements
Lesson Descriptions
Lesson 1: Hello World!
Lesson 1 begins at the beginning by having you create four simple "hello, world" programs using several different techniques. The main purpose of the "hello, world" is to make sure your system is correctly configured to execute the simple program that prints the string "hello, world!" to the screen. You start by writing a series of programs to display a greeting at a command line terminal, first in a REPL, then from a file, and then from a shell script. Finally, you write and deploy a simple proof-of-concept web application using the Flask web framework.
Lesson 2: Strings
Lesson 2 covers strings, probably the most important data structure on the Web since Web pages ultimately consist of strings and characters sent to and from the browser. Many other kinds of programs require string manipulation as well. As a result, strings make a great place to start your Python programming journey. The lesson starts with what strings are and how to create them. You then learn how to join, or concatenate, multiple strings into a single string. Then you learn how to insert or interpolate one string into another. Next you learn how to print strings to the screen from the terminal window. As part of this, you see your first examples of Python Boolean variables and control flow. Finally, you learn how to iterate over strings with for loops, enabling you to access strings one character at a time.
Lesson 3 : Lists
In Lesson 2, you learned that strings can be thought of sequences of characters in a particular order. In Lesson 3, you learn about the list data type, which is the general Python container for arbitrary elements in a particular order. You start by explicitly connecting strings and lists via the string split method, and then you learn about various list methods throughout the rest of the lesson. After learning to split strings, you learn how to access elements in the resulting list, discovering that the same syntax works on strings, further deepening the connection between the two data types. Next you learn a variety of additional list methods beginning with selecting both single elements and multiple elements at once using list slicing, including the useful range datatype, and a clever technique using negative indices to select the last element in a list. Then you learn how to sort lists, which, if you have ever written a sorting algorithm by hand, you will find Python makes ridiculously easy. You also learn how to reverse lists, a capability you will put to good use later on in the tutorial when learning to detect palindromes. Next you will learn how to add and remove list elements using append and pop. You then learn how to undo a string split using a list join, which includes an introduction to an important technique known as generator comprehension. Next, you learn how to iterate through lists using the same kind of for loop covered in Lesson in 2, which is valuable preparation for more advanced techniques covered in Lesson 6. Finally, you learn about two data types closely related to lists: tuples, which are essentially immutable lists, and sets, which can be thought of as a list of elements where repeat elements are ignored and the order doesn't matter.
Lesson 4: Other Native Objects
Now that we have taken a look at strings and arrays, Lesson 4 continues with a tour of some other important Python objects, which will give you a chance to learn about math, dates, regular expressions, and dictionaries. Like most programming languages, Python supports a large number of mathematical operations right out of the box, such as addition, subtraction, multiplication, and division. It also includes a math library, so you learn about more advanced operations such as logarithms and trigonometric functions. You also see an example of a personal triumph of Michael's, the inclusion of the circle constant (tau), to find us the ratio of a circle's circumference to its radius, which he first proposed in 2010 and which was added to Python's standard math library in 2017. You also learn how to deal with times and dates in Python, such as getting the year, the day, or the exact time. Next you get an introduction to the powerful subject of regular expressions, which are discussed briefly in Learn Enough Developer Tools to Be Dangerous in the context of text editors and the grep command. Often called regexes for short, regular expressions are a powerful mini-language for matching patterns in text. You learn how to use regexes to quickly search strings for things like five digits in a row, thereby matching standard United States ZIP codes. The lesson ends with an introduction to dictionaries in Python. Such objects, often referred to as hashes or associative arrays in other languages, are defined by key-value pairs, and in many ways behave like lists with strings, or sometimes other objects, instead of integers as indices. You apply this important object type to write your first substantial Python program, a shell script to count the unique words in a text.
Lesson 5: Functions and Iterators
So far in this tutorial, Python functions have been mentioned repeatedly, and
and in Lesson 5 you finally learn to define functions of your own. The resulting ability gives us greater flexibility as programmers. We begin your study of functions in the read-eval-print loop, that is, the REPL, and then you learn how to put your function definitions in a file for use in a simple Flask web application. The lesson ends with a discussion of iterators, which are a powerful Python object type that represents a stream of data. The lesson pays particular attention to generators, probably the most common type of Python iterator. You will use a generator to make a first definition of an ispalindrome function, to see if a string is the same forward and backward.
Lesson 6: Functional Programming
Having learned how to define functions and apply them in a couple of different contexts. In Lesson 6, you take your programming to the next level by learning the basics of functional programming, a style of programming that emphasizes, you guessed it, functions. As you will see, functional programming in Python frequently employs a powerful and very Pythonic class of techniques called comprehensions, which typically involve using functions to construct Python objects with particular elements. The most common comprehensions are list comprehensions and dictionary comprehensions, which make lists and comprehensions respectively. You'll also see an example of the use of generator comprehensions to replicate the generator introduced in Lesson 5, as well as a brief introduction to set comprehensions.
Lesson 7: Objects and Classes
In Lesson 7, you learn how to make your very own Python objects, which have both data, called attributes, and functions, called methods, attached to them. The way to define objects in Python is using the class keyword and the special init method, which enable us to create or instantiate a new object called an instance. You start with a concrete example of a phrase object that knows whether or not the phrase is a palindrome. You then build on the material on iterators first introduced in Lesson 5 to learn how to add an iterator to a custom class. Finally, you add a translated phrase object that overrides the main ispalindrome method and substitutes a translated phrase instead. These example enable you to understand inheritance and derived classes, which are key ideas in object-oriented programming.
Lesson 8: Testing and Test-Driven Development
Although rarely covered in introductory programming tutorials, automated testing is one of the most important subjects in modern software development. Accordingly, Lesson 8 gives you an introduction to testing in Python, using the pytest framework, including a first look at test-driven development (TDD). Test-driven development came up briefly in Lesson 6, where Michael promised that you would use testing techniques to add an important capability to finding palindromes, namely being able to detect complicated palindromes such as "A man a plan a canal--Panama!" or "Madam, I'm Adam". This lesson fulfills that promise. The strategy for testing the current palindrome code and extending it to more complicated phrases is as follows. One, set up your system for automating testing. Two, write automated tests for the existing palindrome functionality. Three, write a failing test for the enhanced palindrome detector, also known as red. This is the first step in the TDD cycle known as red, green, refactor. Four, write possibly ugly code to get the test passing, also known as green, which is the second step in red, green, refactor. Five, refactor the code, which involves changing its form without changing its function. Because the code should accomplish the same results the entire time, the test suite should remain green even after refactoring, thereby completing the red, green, refactor cycle. As it turns out, learning how to write Python tests will also give you a chance to learn how to create and publish a self-contained Python software package to a public package hosting service, another valuable skill for modern Python programming.
Lesson 9: Shell Scripts
In Lesson 9 you build on the foundation laid in the previous lessons and write three shell scripts of increasing sophistication. In the first two programs you'll take the Python package created in Lesson 8 and put it to work detecting palindromes drawn from two different sources: a file and the web. In the process, you learn how to read and write from files with Python and also how to read from a live web URL. This latter example has especially personal meaning to the author, as he distinctly remembers the first time he wrote an automated program to read and process text from the web, which at the time seemed truly miraculous. Finally, you write a real-life utility program adapted from one Michael once wrote for himself. It includes an introduction to manipulation of the document object model, or DOM, in the context outside of a web browser. This is the sort of thing you might expect from a browser-centric language like JavaScript, but it turns out you can do it with Python as well.
Lesson 10: A Live Web Application
As a final application of your newfound Python powers, in Lesson 10 you build a dynamic web application. The app will put the custom Python package developed in Lesson 8 to good use through the development of a web-based palindrome detector. Along the way, you learn how to create dynamic content using Python templates. Detecting palindromes from the web requires using a back-end web application to handle form submission, and our tool of choice is Flask, the micro-framework you met in Lesson 1 and applied further in Lesson 5. Although simple, Flask is not a toy. It is a production-ready web framework used by companies like Netflix, Lyft, and Redditt. Our palindrome map will also feature two other pages, home and about, which will give you an opportunity to learn how to use a Python-based site layout. As part of this, you apply and extend the work in Lesson 8 to write automated tests for your app. As in Lesson 1, your final step will be to deploy your palindrome map to the live web.
Lesson 11: Data Science
In this eleventh and final lesson, you get a solid introduction to key Python tools used for data science, a rapidly developing field that combines tools from computations and statistics to create insights into and draw conclusions from data. These tools include Jupyter notebooks for interactive calculations, NumPy for numerical calculations, Mathplotib for data visualizations, pandas for data analysis, and scikit-learn for machine learning. Almost all other Python data science tools also build on the libraries covered in this lesson. Data science is far too big a subject to cover in so small a space, but this lesson will give you a great foundation for learning more about the subject. The lesson ends with further pointers to resources on Python, Flask, data science, and other topics like JavaScript and Ruby.
About Pearson Video Training
Pearson publishes expert-led video tutorials covering a wide selection of technology topics designed to teach you the skills you need to succeed. These professional and personal technology videos feature world-leading author instructors published by your trusted technology brands: Addison-Wesley, Cisco Press, Pearson IT Certification, Sams, and Que. Topics include: IT Certification, Network Security, Cisco Technology, Programming, Web Development, Mobile Development, and more. Learn more about Pearson Video training at http://www.informit.com/video.
Video Lessons are available for download for offline viewing within the streaming format. Look for the green arrow in each lesson.
Introduction
Lesson 1: Hello, World!
Topics
1.1 Introduction to Python
1.2 Python in a REPL
1.3 Python in a file
1.4 Python in a shell script
1.5 Python in a web browser
Lesson 2: Strings
Topics
2.1 String basics
2.2 Concatenation and interpolation
2.3 Printing
2.4 Length, booleans, and control flow
2.5 Methods
2.6 String iteration
Lesson 3: Lists
Topics
3.1 Splitting
3.2 List access
3.3 List slicing
3.4 More list techniques
3.5 List iteration
3.6 Tuples and sets
Lesson 4: Other Native Objects
Topics
4.1 Math
4.2 Times and datetimes
4.3 Regular expressions
4.4 Dictionaries
4.5 Application: Unique words
Lesson 5: Functions and Iterators
Topics
5.1 Function definitions
5.2 Functions in a file
5.3 Iterators
Lesson 6: Functional Programming
Topics
6.1 List comprehensions
6.2 List comprehensions with conditions
6.3 Dictionary comprehensions
6.4 Generator and set comprehensions
6.5 Other functional techniques
Lesson 7: Objects and Classes
Topics
7.1 Defining classes
7.2 Custom iterators
7.3 Inheritance
7.4 Derived classes
Lesson 8: Testing and Test-Driven Development
Topics
8.1 Package setup
8.2 Initial test coverage
8.3 Red
8.4 Green
8.5 Refactor
Lesson 9: Shell Scripts
Topics
9.1 Reading from files
9.2 Reading from URLs
9.3 DOM manipulation at the command line
Lesson 10: A Live Web Application
Topics
10.1 Setup
10.2 Site pages
10.3 Layouts
10.4 Template engine
10.5 Palindrome detector
10.6 Conclusion
Lesson 11: Data Science
Topics
11.1 Data science setup
11.2 Numerical computations with NumPy
11.3 Data visualization with Matplotlib
11.4 Introduction to data analysis with pandas
11.5 pandas example: Nobel laureates
11.6 pandas example: Titanic
11.7 Machine learning with scikit-learn
11.8 Further resources and conclusion
Summary