Instant download (eBook PDF) Practice of Computing Using Python, The 3rd Edition pdf all chapter
Instant download (eBook PDF) Practice of Computing Using Python, The 3rd Edition pdf all chapter
https://ebookluna.com/product/ebook-pdf-introduction-to-programming-
using-python-an-1/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-numerical-analysis-
mathematics-of-scientific-computing-3rd/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-the-practice-of-creative-
writings-3rd-edition/
ebookluna.com
https://ebookluna.com/download/the-physics-of-computing-ebook-pdf/
ebookluna.com
(eBook PDF) The Doctor of Nursing Practice Essentials 3rd
Edition
https://ebookluna.com/product/ebook-pdf-the-doctor-of-nursing-
practice-essentials-3rd-edition/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-python-programming-in-
context-3rd-edition/
ebookluna.com
https://ebookluna.com/product/python-programming-in-context-3rd-
edition-ebook-pdf/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-the-speaker-the-tradition-and-
practice-of-public-speaking-3rd/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-the-nurse-the-math-the-meds-
drug-calculations-using-dimensional-analysis-3rd-edition/
ebookluna.com
THE PRACTICE OF COMPUTING USING
3RD EDITION
WILLIAM RICHARD
PUNCH • ENBODY
C O N T E N T S
•
VIDEONOTES xxiv
PREFACE xxv
PREFACE TO THE SECOND EDITION xxix
1.0.1 Data Manipulation xxx
1.0.2 Problem Solving and Case Studies xxx
1.0.3 Code Examples xxx
1.0.4 Interactive Sessions xxxi
1.0.5 Exercises and Programming Projects xxxi
1.0.6 Self-Test Exercises xxxi
1.0.7 Programming Tips xxxi
vii
viii CONTENTS
P A R T 2 S TA RT I N G T O P R O G R A M 35
Chapter 1 Beginnings 37
1.1 Practice, Practice, Practice 37
1.2 QuickStart, the Circumference Program 38
1.2.1 Examining the Code 40
1.3 An Interactive Session 42
1.4 Parts of a Program 43
1.4.1 Modules 43
1.4.2 Statements and Expressions 43
1.4.3 Whitespace 45
1.4.4 Comments 46
1.4.5 Special Python Elements: Tokens 46
1.4.6 Naming Objects 48
1.4.7 Recommendations on Naming 49
1.5 Variables 49
1.5.1 Variable Creation and Assignment 50
1.6 Objects and Types 53
1.6.1 Numbers 55
1.6.2 Other Built-In Types 57
1.6.3 Object Types: Not Variable Types 58
1.6.4 Constructing New Values 60
CONTENTS ix
1.7 Operators 61
1.7.1 Integer Operators 61
1.7.2 Floating-Point Operators 64
1.7.3 Mixed Operations 64
1.7.4 Order of Operations and Parentheses 65
1.7.5 Augmented Assignment Operators: A Shortcut! 66
1.8 Your First Module, Math 68
1.9 Developing an Algorithm 69
1.9.1 New Rule—Testing 73
1.10 Visual Vignette: Turtle Graphics 74
1.11 What’s Wrong with My Code? 75
Chapter 2 Control 87
2.1 QuickStart Control 87
2.1.1 Selection 87
2.1.2 Booleans for Decisions 89
2.1.3 The if Statement 89
2.1.4 Example: What Lead Is Safe in Basketball? 92
2.1.5 Repetition 96
2.1.6 Example: Finding Perfect Numbers 100
2.1.7 Example: Classifying Numbers 105
2.2 In-Depth Control 109
2.2.1 True and False: Booleans 109
2.2.2 Boolean Variables 110
2.2.3 Relational Operators 110
2.2.4 Boolean Operators 115
2.2.5 Precedence 116
2.2.6 Boolean Operators Example 117
2.2.7 Another Word on Assignments 120
2.2.8 The Selection Statement for Decisions 122
2.2.9 More on Python Decision Statements 122
2.2.10 Repetition: the while Statement 126
2.2.11 Sentinel Loop 136
2.2.12 Summary of Repetition 136
2.2.13 More on the for Statement 137
2.2.14 Nesting 140
2.2.15 Hailstone Sequence Example 142
2.3 Visual Vignette: Plotting Data with Pylab 143
2.3.1 First Plot and Using a List 144
2.3.2 More Interesting Plot: A Sine Wave 145
x CONTENTS
P A R T 3 D AT A S T R U C T U R E S A N D F U N C T I O N S 187
Chapter 4 Working with Strings 189
4.1 The String Type 190
4.1.1 The Triple-Quote String 190
4.1.2 Nonprinting Characters 191
4.1.3 String Representation 191
4.1.4 Strings as a Sequence 192
4.1.5 More Indexing and Slicing 193
4.1.6 Strings Are Iterable 198
CONTENTS xi
P A R T 4 C L A S S E S , M A K I N G Y O U R O W N D AT A S T R U C T U R E S
AND ALGORITHMS 527
Chapter 11 Introduction to Classes 529
11.1 QuickStart: Simple Student Class 529
11.2 Object-Oriented Programming 530
11.2.1 Python Is Object-Oriented! 530
11.2.2 Characteristics of OOP 531
11.3 Working with OOP 531
11.3.1 Class and Instance 531
11.4 Working with Classes and Instances 532
11.4.1 Built-In Class and Instance 532
11.4.2 Our First Class 534
11.4.3 Changing Attributes 536
11.4.4 The Special Relationship Between an Instance and
Class: instance-of 537
11.5 Object Methods 540
11.5.1 Using Object Methods 540
11.5.2 Writing Methods 541
11.5.3 The Special Argument self 542
11.5.4 Methods Are the Interface to a Class Instance 544
11.6 Fitting into the Python Class Model 545
11.6.1 Making Programmer-Defined Classes 545
11.6.2 A Student Class 545
11.6.3 Python Standard Methods 546
11.6.4 Now There Are Three: Class Designer, Programmer,
and User 550
11.7 Example: Point Class 551
11.7.1 Construction 553
11.7.2 Distance 553
11.7.3 Summing Two Points 553
11.7.4 Improving the Point Class 554
11.8 Python and OOP 558
11.8.1 Encapsulation 558
11.8.2 Inheritance 559
11.8.3 Polymorphism 559
11.9 Python and Other OOP Languages 559
11.9.1 Public versus Private 559
11.9.2 Indicating Privacy Using Double Underscores (__) 560
CONTENTS xvii
APPENDICES 753
Appendix A Getting and Using Python 753
A.1 About Python 753
A.1.1 History 753
A.1.2 Python 3 753
A.1.3 Python Is Free and Portable 754
A.1.4 Installing Anaconda 756
A.1.5 Starting Our Python IDE: Spyder 756
A.1.6 Working with Python 757
A.1.7 Making a Program 760
A.2 The IPython Console 762
A.2.1 Anatomy of an iPython Session 763
A.2.2 Your Top Three iPython Tips 764
A.2.3 Completion and the Tab Key 764
A.2.4 The ? Character 766
A.2.5 More iPython Tips 766
A.3 Some Conventions for This Book 769
A.3.1 Interactive Code 770
A.3.2 Program: Written Code 770
A.3.3 Combined Program and Output 770
A.4 Summary 771
Appendix B Simple Drawing with Turtle Graphics 773
B.0.1 What Is a Turtle? 773
B.0.2 Motion 775
B.0.3 Drawing 775
B.0.4 Color 777
B.0.5 Drawing with Color 779
B.0.6 Other Commands 781
B.1 Tidbits 783
B.1.1 Reset/Close the Turtle Window 783
Appendix C What’s Wrong with My Code? 785
C.1 It’s Your Fault! 785
C.1.1 Kinds of Errors 785
C.1.2 “Bugs” and Debugging 787
C.2 Debugging 789
C.2.1 Testing for Correctness 789
C.2.2 Probes 789
C.2.3 Debugging with Spyder Example 1 789
C.2.4 Debugging Example 1 Using print() 793
CONTENTS xxi
xxiv
Other documents randomly have
different content
Fig. 24.— Fig. 25.—Kernel Fig. 26.—Indian Corn.
Sprouting of Indian Corn. Caulicle at c; roots emerging at m; plumule at p.
Indian Corn. Caulicle at b;
Hilum at h; micropyle at cotyledon at a;
d. plumule at p.
The Root System.—The offices of the root are to hold the plant in
place, and to gather food. Not all the food materials, however, are
gathered by the roots.
Fig. 32.—Tap-
root System of Fig. 33.—Tap-root of the Dandelion.
Alfalfa.
The entire mass of roots of any plant is called its root system.
The root system may be annual, biennial or perennial, herbaceous or
woody, deep or shallow, large or small.
Kinds of Roots.—A strong leading central root, which runs
directly downwards, is a tap-root. The tap-root forms an axis from
which the side roots may branch. The side or spreading roots are
usually smaller. Plants that have such a root system are said to be
tap-rooted. Examples are red clover, alfalfa, beet, turnip, radish,
burdock, dandelion, hickory (Figs. 32, 33).
A fibrous root system is one that is composed of many nearly
equal slender branches. The greater number of plants have fibrous
roots. Examples are many common grasses, wheat, oats, corn. The
buttercup in Fig. 34 has a fibrous root system. Many trees have a
strong tap-root when very young, but after a while it ceases to
extend strongly and the side roots develop until finally the tap-root
character disappears.
Shape and Extent of the Root System.—
The depth to which roots extend depends on
the kind of plant, and the nature of the soil. Of
most plants the roots extend far in all directions
and lie comparatively near the surface. The
roots usually radiate from a common point just
beneath the surface of the ground.
The roots grow here and there in search of
food, often extending much farther in all
directions than the spread of the top of the
plant. Roots tend to spread farther in poor soil
than in rich soil, for the same size of plant. The
root has no such definite form as the stem has.
Roots are usually very crooked, because they
are constantly turned aside by obstacles.
Examine roots in stony soil.
Fig. 34.—A Buttercup
The extent of root surface is usually very Plant, with fibrous
large, for the feeding roots are fine and very roots.
numerous. An ordinary plant of Indian corn may
have a total length of root (measured as if the roots were placed end
to end) of several hundred feet.
The fine feeding roots are most abundant in the richest part of the
soil. They are attracted by the food materials. Roots often will
completely surround a bone or other morsel. When roots of trees are
exposed, observe that most of them are horizontal and lie near the
top of the ground. Some roots, as of willows, extend far in search of
water. They often run into wells and drains, and into the margins of
creeks and ponds. Grow plants in a long narrow box, in one end of
which the soil is kept very dry and in the other moist: observe where
the roots grow.
Buttresses.—With the increase
in diameter, the upper roots often
protrude above the ground and
become bracing buttresses.
These buttresses are usually
largest in trees which always have
been exposed to strong winds
(Fig. 35). Because of growth and
thickening, the roots elevate part
of their diameter, and the washing
Fig. 35.—The Bracing Base of a Field away of the soil makes them to
Pine.
appear as if having risen out of
the ground.
Aërial Roots.—Although roots usually grow underground, there
are some that naturally grow above ground. These usually occur on
climbing plants, the roots becoming supports or fulfilling the office of
tendrils. These aërial roots usually turn away from the light, and
therefore enter the crevices and dark places of the wall or tree over
which the plant climbs. The trumpet creeper (Fig. 36), true or English
ivy, and poison ivy climb by means of roots.
In some plants all the roots are aërial; that is, the plant grows
above ground, and the roots gather food from the air. Such plants
usually grow on trees. They are known as epiphytes or air-plants.
The most familiar examples are some of the tropical orchids which
are grown in glass-houses (Fig. 37). Rootlike organs of dodder and
other
parasit
es are
discus
sed in
a
future
chapte
r.
So
me
plants
bear
aërial
roots,
that
may
propa
gate
the Fig. 37.—Aërial Roots of an Orchid.
plant
or
may act as braces. They are often called
prop-roots. The roots of Indian corn are
familiar (Fig. 38). Many ficus trees, as the
banyan of India, send out roots from their
branches; when these roots reach the
ground they take hold and become great
trunks, thus spreading the top of the parent
tree over large areas. The mangrove tree of
the tropics grows along seashores and
sends down roots from the overhanging
branches (and from the fruits) into the
Fig. 36.—Aërial Roots of shallow water, and thereby gradually
Trumpet Creeper or
Tecoma. marches into the sea. The tangled mass
behind catches the drift, and soil is formed.
Adventitious Roots.—Sometimes roots grow
from the stem or other unusual places as the result
of some accident to the plant, being located without
known method or law. They are called
adventitious (chance) roots. Cuttings of the stems
of roses, figs, geraniums, and other plants, when
planted, send out adventitious roots and form new
plants. The ordinary roots, or soil roots, are of
course not classed as adventitious roots. The
adventitious roots arise on occasion, and not as a
normal or regular course in the growth of the plant.
No two roots are alike; that is, they vary among
themselves as stems and leaves do. Each kind of
plant has its own form or habit of root (Fig. 39).
Carefully wash away the soil from the roots of any
Fig. 38.—Indian
two related plants, as oats and wheat, and note the
Corn, showing
the brace roots at differences in size, depth, direction, mode of
oo. branching, number of fibrils, colour, and other
features. The character of the root system often
governs the treatment that the farmer should give the soil in which
the plant or crop grows.
Fig. 39.—Roots of Barley at A and Corn at B.
Carefully trace the differences.
Roots differ not only in their form and habit, but also in colour of
tissue, character of bark or rind, and other features. It is excellent
practice to try to identify different plants by means of their roots. Let
each pupil bring to school two plants with the roots very carefully dug
up, as cotton, corn, potato, bean, wheat, rye, timothy, pumpkin,
clover, sweet pea, raspberry, strawberry, or other common plants.
Root Systems of Weeds.—Some weeds are pestiferous because
they seed abundantly, and others because their underground parts
run deep or far and are persistent. Make out the root systems in the
six worst weeds in your locality.
CHAPTER VIII
THE ROOT.—FUNCTION AND STRUCTURE
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookluna.com