In this video, learn how to save time by writing code efficiently. See how you can shrink a multiline C program to a single line Python program, exploiting Python's expressiveness.
- [Instructor] I'm going to demonstrate how Python…is significantly more expressive…than other widely used languages, such as C.…By expressive, I mean that Python makes it easy…to write code that's synthetic, and yet readable.…Both these qualities lead to efficient programming.…Since Python is synthetic, you will be able…to program complex algorithms with few lines of code.…Since Python is readable, you will be able…to share your code efficiently with your colleagues,…or to understand it quickly when you go back to it…after months or years.…
To compare C and Python, we'll write a simple program…to compute the value of pi, half the ratio…of the circumference to the radius in a circle, of course.…And we compute pi by way of the Leibniz series.…An infinite sum of fractions,…starting from 1, 1/3, 1/5, 1/7 and so on.…By the way, this is not the best way to compute pi.…Because the terms in the series have alternating signs…and decrease very slowly, the sum takes over 300 terms…to obtain a precision of just two decimal places.…
- Designing efficient loops
- Exploiting Python collections
- Writing Pythonic code
- Choosing the best libraries for your tasks
- Downloading webpages with requests
- Parsing HTML with Beautiful Soup
- Manipulating images with Pillow
- Making videos and drawing on maps with matplotlib
- Serving webpages with Jinja2 and Flask
- Working with Python classes
- Taking advantage of functional techniques
- Profiling CPU and memory use
- Exploiting parallelism
Skill Level Intermediate
1. Installation and Setup
Jupyter notebooks3m 19s
2. Writing Python Efficiently
3. Exploiting Python Libraries
4. Advanced: Python Object-Oriented and Functional Programming
5. Introduction to Performance Optimization in Python
Next steps1m 2s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.