12.07.2015 Views

Is Python a

Is Python a

Is Python a

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

8. Lists and Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152Lists 152Lists in Action 154Basic List Operations 154Indexing, Slicing, and Matrixes 155Changing Lists In-Place 156Index and slice assignments 156List method calls 157Other common list operations 159Dictionaries 160Dictionaries in Action 161Basic Dictionary Operations 162Changing Dictionaries In-Place 163More Dictionary Methods 163A Languages Table 165Dictionary Usage Notes 166Using dictionaries to simulate flexible lists 166Using dictionaries for sparse data structures 167Avoiding missing-key errors 167Using dictionaries as “records” 168Other ways to make dictionaries 169Chapter Summary 170Brain Builder 171Chapter Quiz 171Quiz Answers 1719. Tuples, Files, and Everything Else . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172Tuples 172Tuples in Action 173Tuple syntax peculiarities: commas and parentheses 174Conversions and immutability 174Why Lists and Tuples? 175Files 176Opening Files 176Using Files 177Table of Contents | xiii

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!