[go: up one dir, main page]

0% found this document useful (0 votes)
2 views1 page

Dsaa 11

d

Uploaded by

farawayfromhere
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Dsaa 11

d

Uploaded by

farawayfromhere
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Contents

1 Python Programming 101 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


1.1 Chapter Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Creating Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.1 Literal Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.2 Non-literal Object Creation . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Calling Methods on Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Implementing a Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.5 Operator Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.6 Importing Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.7 Indentation in Python Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.8 Python Program Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.9 Reading from a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.10 Reading Multi-line Records from a File . . . . . . . . . . . . . . . . . . . . . . 15
1.11 A Container Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.12 Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.13 The Accumulator Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.14 Implementing a GUI with Tkinter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.15 XML Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1.15.1 The Truck XML File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.16 Reading XML Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
1.17 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
1.18 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
1.19 Programming Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2 Computational Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.1 Chapter Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.2 Computer Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.2.1 Running a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.3 Accessing Elements in a Python List . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.4 Big-O Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.5 The PyList Append Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.6 A Proof by Induction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.7 Making the PyList Append Efficient . . . . . . . . . . . . . . . . . . . . . . . . . 51

xi

You might also like