Chapter 1 of 6: Before the lecture
Program efficiency in Python can be measured two ways: by timing code with a clock and by counting the basic operations it performs. Bell opens with the trade-off between time and space, citing Google's 2014 scale of 30 trillion pages. Using the time module, she clocks three functions: a temperature conversion, a running sum, and nested loops that square a number. Those timings shift with the implementation, the computer and the language, so Bell switches to counting assignments, comparisons and arithmetic as single units. Operation counts avoid hardware differences but leave open what to count, and constant factors matter less as inputs grow. The session assumes basic Python functions, loops and modules, and points toward analysing algorithms rather than particular code.

Your comment is kept while you sign up.Sign in
Bell times a temperature converter, a summation loop and nested squaring loops in Python, then counts their operations.
Program efficiency in Python can be measured two ways: by timing code with a clock and by counting the basic operations it performs. Bell opens with the trade-off between time and space, citing Google's 2014 scale of 30 trillion pages. Using the time module, she clocks three functions: a temperature conversion, a running sum, and nested loops that square a number. Those timings shift with the implementation, the computer and the language, so Bell switches to counting assignments, comparisons and arithmetic as single units. Operation counts avoid hardware differences but leave open what to count, and constant factors matter less as inputs grow. The session assumes basic Python functions, loops and modules, and points toward analysing algorithms rather than particular code.
Google data set statistics
This lecture
Lecture 20 of 25 of Introduction to Computer Science and Programming using Python.
Choose a node to see how it connects to this lecture. What comes before is on the leftat the top. What comes after is on the rightat the bottom. The ring is what it teaches. People and places are above.
Press a chosen node again to open it.