Think Python: How to Think Like a Computer Scientist
Inheritance Inheritance is the ability to define a new class that is a modified version of an existing class. ...
A natural next step is to encapsulate this code in a method called move_cards: #inside class Deck: ...
Class Diagrams So far we have seen stack diagrams, which show the state of a program, and object dia ...
The star (*) near the arrowhead is a multiplicity; it indicates how many Cards a Deck has. A multipl ...
Data Encapsulation The previous chapters demonstrate a development plan we might call “object-oriented design”. ...
2 . Once you get the program working, look for associations between global variables and the functions that us ...
Debugging Inheritance can make debugging difficult because when you invoke a method on an object, it might be ...
Glossary encode: To represent one set of values using another set of values by constructing a mapping between the ...
A program development plan that involves a prototype using global variables and a final version that ma ...
Exercises Exercise 18-1. For the following program, draw a UML class diagram that shows these classes and ...
Three cards with one rank, two cards with another. four of a kind: Four cards with the same rank. ...
...
Chapter 19. The Goodies One of my goals for this book has been to teach you as little Python as possible. ...
Conditional Expressions We saw conditional statements in “Conditional Execution”. Conditional statements are often use ...
variable. ...
List Comprehensions In “Map, Filter and Reduce” we saw the map and filter patterns. For example, this function tak ...
Generator Expressions Generator expressions are similar to list comprehensions, but with parentheses instead of squa ...
any and all Python provides a built-in function, any, that takes a sequence of boolean values and ret ...
Sets In “Dictionary Subtraction” I use dictionaries to find the words that appear in a document but not in ...
We can also use sets to do some of the exercises in Chapter 9. For example, here’s a version of uses_only ...
«
12
13
14
15
16
17
18
19
20
21
»
Free download pdf