%!PS-Adobe-2.0 %%Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %%Title: top.dvi %%Pages: 288 %%PageOrder: Ascend %%BoundingBox: 0 0 486 666 %%DocumentFonts: CMR17 CMBX10 CMR12 CMR9 CMSY9 CMBX9 CMTT9 CMR6 CMBX12 %%+ CMR10 CMTI10 CMTT10 CMSY10 CMMI10 CMR7 CMTT12 CMEX10 CMMI7 CMR8 %%EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -T 6.75in,9.25in -Ppdf -o thinkCSpy.ps top %DVIPSParameters: dpi=8000, compressed %DVIPSSource: TeX output 2002.08.30:1556 %%BeginProcSet: tex.pro %! /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72 mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{ landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[ matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin /FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array /BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get }B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub} B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr 1 add N}if}B/CharBuilder{save 3 1 roll S A/base get 2 index get S /BitMaps get S get/Cd X pop/ctr 0 N Cdx 0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx sub Cy .1 sub]{Ci}imagemask restore}B/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn /BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put }if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{ bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{ SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X 1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N /p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ /Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT) (LaserWriter 16/600)]{A length product length le{A length product exch 0 exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot} imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M} B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{ p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end %%EndProcSet %%BeginProcSet: alt-rule.pro %! % Patch by TVZ % Makes dvips files draw rules with stroke rather than fill. % Makes narrow rules more predictable at low resolutions % after distilling to PDF. % May have unknown consequences for very thick rules. % Tested only with dvips 5.85(k). TeXDict begin /QV { gsave newpath /ruleY X /ruleX X Rx Ry gt { ruleX ruleY Ry 2 div sub moveto Rx 0 rlineto Ry } { ruleX Rx 2 div add ruleY moveto 0 Ry neg rlineto Rx } ifelse setlinewidth 0 setlinecap stroke grestore } bind def end %%EndProcSet %%BeginProcSet: texc.pro %! /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72 mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{ landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[ matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin /FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array /BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get }B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub} B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr 1 add N}if}B/id 0 N/rw 0 N/rc 0 N/gp 0 N/cp 0 N/G 0 N/CharBuilder{save 3 1 roll S A/base get 2 index get S/BitMaps get S get/Cd X pop/ctr 0 N Cdx 0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx sub Cy .1 sub]/id Ci N/rw Cw 7 add 8 idiv string N/rc 0 N/gp 0 N/cp 0 N{ rc 0 ne{rc 1 sub/rc X rw}{G}ifelse}imagemask restore}B/G{{id gp get/gp gp 1 add N A 18 mod S 18 idiv pl S get exec}loop}B/adv{cp add/cp X}B /chg{rw cp id gp 4 index getinterval putinterval A gp add/gp X adv}B/nd{ /cp 0 N rw exit}B/lsh{rw cp 2 copy get A 0 eq{pop 1}{A 255 eq{pop 254}{ A A add 255 and S 1 and or}ifelse}ifelse put 1 adv}B/rsh{rw cp 2 copy get A 0 eq{pop 128}{A 255 eq{pop 127}{A 2 idiv S 128 and or}ifelse} ifelse put 1 adv}B/clr{rw cp 2 index string putinterval adv}B/set{rw cp fillstr 0 4 index getinterval putinterval adv}B/fillstr 18 string 0 1 17 {2 copy 255 put pop}for N/pl[{adv 1 chg}{adv 1 chg nd}{1 add chg}{1 add chg nd}{adv lsh}{adv lsh nd}{adv rsh}{adv rsh nd}{1 add adv}{/rc X nd}{ 1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]A{bind pop} forall N/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn /BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put }if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{ bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{ SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X 1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N /p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ /Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT) (LaserWriter 16/600)]{A length product length le{A length product exch 0 exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot} imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M} B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{ p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end %%EndProcSet %%BeginProcSet: texps.pro %! TeXDict begin/rf{findfont dup length 1 add dict begin{1 index/FID ne 2 index/UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll exec 0 exch 5 -1 roll VResolution Resolution div mul neg 0 0]/Metrics exch def dict begin Encoding{exch dup type/integertype ne{pop pop 1 sub dup 0 le{pop}{[}ifelse}{FontMatrix 0 get div Metrics 0 get div def} ifelse}forall Metrics/Metrics currentdict end def[2 index currentdict end definefont 3 -1 roll makefont/setfont cvx]cvx def}def/ObliqueSlant{ dup sin S cos div neg}B/SlantFont{4 index mul add}def/ExtendFont{3 -1 roll mul exch}def/ReEncodeFont{CharStrings rcheck{/Encoding false def dup[exch{dup CharStrings exch known not{pop/.notdef/Encoding true def} if}forall Encoding{]exch pop}{cleartomark}ifelse}if/Encoding exch def} def end %%EndProcSet %%BeginProcSet: special.pro %! TeXDict begin/SDict 200 dict N SDict begin/@SpecialDefaults{/hs 612 N /vs 792 N/ho 0 N/vo 0 N/hsc 1 N/vsc 1 N/ang 0 N/CLIP 0 N/rwiSeen false N /rhiSeen false N/letter{}N/note{}N/a4{}N/legal{}N}B/@scaleunit 100 N /@hscale{@scaleunit div/hsc X}B/@vscale{@scaleunit div/vsc X}B/@hsize{ /hs X/CLIP 1 N}B/@vsize{/vs X/CLIP 1 N}B/@clip{/CLIP 2 N}B/@hoffset{/ho X}B/@voffset{/vo X}B/@angle{/ang X}B/@rwi{10 div/rwi X/rwiSeen true N}B /@rhi{10 div/rhi X/rhiSeen true N}B/@llx{/llx X}B/@lly{/lly X}B/@urx{ /urx X}B/@ury{/ury X}B/magscale true def end/@MacSetUp{userdict/md known {userdict/md get type/dicttype eq{userdict begin md length 10 add md maxlength ge{/md md dup length 20 add dict copy def}if end md begin /letter{}N/note{}N/legal{}N/od{txpose 1 0 mtx defaultmatrix dtransform S atan/pa X newpath clippath mark{transform{itransform moveto}}{transform{ itransform lineto}}{6 -2 roll transform 6 -2 roll transform 6 -2 roll transform{itransform 6 2 roll itransform 6 2 roll itransform 6 2 roll curveto}}{{closepath}}pathforall newpath counttomark array astore/gc xdf pop ct 39 0 put 10 fz 0 fs 2 F/|______Courier fnt invertflag{PaintBlack} if}N/txpose{pxs pys scale ppr aload pop por{noflips{pop S neg S TR pop 1 -1 scale}if xflip yflip and{pop S neg S TR 180 rotate 1 -1 scale ppr 3 get ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg TR}if xflip yflip not and{pop S neg S TR pop 180 rotate ppr 3 get ppr 1 get neg sub neg 0 TR}if yflip xflip not and{ppr 1 get neg ppr 0 get neg TR}if}{ noflips{TR pop pop 270 rotate 1 -1 scale}if xflip yflip and{TR pop pop 90 rotate 1 -1 scale ppr 3 get ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg TR}if xflip yflip not and{TR pop pop 90 rotate ppr 3 get ppr 1 get neg sub neg 0 TR}if yflip xflip not and{TR pop pop 270 rotate ppr 2 get ppr 0 get neg sub neg 0 S TR}if}ifelse scaleby96{ppr aload pop 4 -1 roll add 2 div 3 1 roll add 2 div 2 copy TR .96 dup scale neg S neg S TR}if}N/cp{pop pop showpage pm restore}N end}if}if}N/normalscale{ Resolution 72 div VResolution 72 div neg scale magscale{DVImag dup scale }if 0 setgray}N/psfts{S 65781.76 div N}N/startTexFig{/psf$SavedState save N userdict maxlength dict begin/magscale true def normalscale currentpoint TR/psf$ury psfts/psf$urx psfts/psf$lly psfts/psf$llx psfts /psf$y psfts/psf$x psfts currentpoint/psf$cy X/psf$cx X/psf$sx psf$x psf$urx psf$llx sub div N/psf$sy psf$y psf$ury psf$lly sub div N psf$sx psf$sy scale psf$cx psf$sx div psf$llx sub psf$cy psf$sy div psf$ury sub TR/showpage{}N/erasepage{}N/copypage{}N/p 3 def @MacSetUp}N/doclip{ psf$llx psf$lly psf$urx psf$ury currentpoint 6 2 roll newpath 4 copy 4 2 roll moveto 6 -1 roll S lineto S lineto S lineto closepath clip newpath moveto}N/endTexFig{end psf$SavedState restore}N/@beginspecial{SDict begin/SpecialSave save N gsave normalscale currentpoint TR @SpecialDefaults count/ocount X/dcount countdictstack N}N/@setspecial{ CLIP 1 eq{newpath 0 0 moveto hs 0 rlineto 0 vs rlineto hs neg 0 rlineto closepath clip}if ho vo TR hsc vsc scale ang rotate rwiSeen{rwi urx llx sub div rhiSeen{rhi ury lly sub div}{dup}ifelse scale llx neg lly neg TR }{rhiSeen{rhi ury lly sub div dup scale llx neg lly neg TR}if}ifelse CLIP 2 eq{newpath llx lly moveto urx lly lineto urx ury lineto llx ury lineto closepath clip}if/showpage{}N/erasepage{}N/copypage{}N newpath}N /@endspecial{count ocount sub{pop}repeat countdictstack dcount sub{end} repeat grestore SpecialSave restore end}N/@defspecial{SDict begin}N /@fedspecial{end}B/li{lineto}B/rl{rlineto}B/rc{rcurveto}B/np{/SaveX currentpoint/SaveY X N 1 setlinecap newpath}N/st{stroke SaveX SaveY moveto}N/fil{fill SaveX SaveY moveto}N/ellipse{/endangle X/startangle X /yrad X/xrad X/savematrix matrix currentmatrix N TR xrad yrad scale 0 0 1 startangle endangle arc savematrix setmatrix}N end %%EndProcSet %%BeginFont: CMTT12 %!PS-AdobeFont-1.1: CMTT12 1.0 %%CreationDate: 1991 Aug 20 16:45:46 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMTT12) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch true def end readonly def /FontName /CMTT12 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 67 /C put dup 71 /G put dup 72 /H put dup 76 /L put dup 77 /M put dup 78 /N put dup 79 /O put dup 84 /T put dup 97 /a put dup 100 /d put dup 101 /e put dup 102 /f put dup 103 /g put dup 104 /h put dup 105 /i put dup 107 /k put dup 108 /l put dup 109 /m put dup 110 /n put dup 111 /o put dup 112 /p put dup 114 /r put dup 115 /s put dup 116 /t put dup 117 /u put dup 119 /w put readonly def /FontBBox{-1 -234 524 695}readonly def /UniqueXX 5000833 def currentdict end currentfile eexec 9b9c1569015f2c1d2bf560f4c0d52257bacdd6500abda5ed9835f6a016cfc8f0 0b6c052ed76a87856b50f4d80dfaeb508c97f8281f3f88b17e4d3b90c0f65ec3 79791aacdc162a66cbbc5be2f53aad8de72dd113b55a022fbfee658cb95f5bb3 2ba0357b5e050fddf264a07470bef1c52119b6fbd5c77ebed964ac5a2bbec9d8 b3e48ae5bb003a63d545774b922b9d5ff6b0066ece43645a131879b032137d6d 823385fe55f3402d557fd3b4486be79011d1f5b667eed85fade30ab2ec4e1c2f 4fe750cf9a69506458071de8896261c001b1c290937fa42a1fa87de406e9f86a 4c9c0f03f69fba719114f8ae51040a4c03a58b6f3de027f6726f32743dce7395 14c2c6f3c2de1aeddcfa8eed7da56dd68dbcde33c29ff7a694769049e4325ec9 61b2df16add2ad46f18781fbd63eec62c26f1db41e6a666a09886382dceba91d 8ff7cedd64ddc8a2f15fe34076a064c46febd1f4dc3707aede0ce8af161bcb8e 4ada202d0954baca5be71c28ab8bf32fd72029aa07f27d658a68f454a4bf386f 6314224d16c7f0a8624f6b86319a4e2fd178f596f3b20db032ea28c157a68a69 fad2bc88881658d2286c0d4ef061bc070c3145f2a37ebec03f51de7cda34cd97 7eeebd86b00f9758b3a496f41d9a74279ef3c6322dc54945f95062c5f37a1e51 cf7eaf45f2b3634b2d7d01ec3b298ff35b6616cd3020e096f6c6aa2bf04c4a93 61c19f3c67a28d936ffc8120f1e46980b29bf54047c5f1fa48e67611a74fa434 3384f802a4079b28b94681e119ab0c1692de5bbf426440ad1023506cb80732de c64d9061869cb34de924d2c26e404b7dbd9be55b9c0c5ae3095c15d278adbb49 12df1484ed2d73128e5d9c1f1a3b9ac19e2ce5366c96644f5b3d3eea589caedb 586fd9b8f4df32ec910e9b7434d5bbe57e03892eb03890567df5b811afa0da5e 929d456af362fda0789aa0cff464e238029294fde86cfc8d7d33d5c98b18c76c 319811e4d3d49560f2ac39103594ec513e0b1377c2c3e22979866c19b61448d5 a7201ca4b7538aa370f6347253b0853d4c5d575a7572f93cb73a598e2e26b11a d46a1126e44e7e1795dff01562316b6ccc6678663e66a73db285746df3f4405d d51714679581946ef72235d36341c10471df108e518543810add874f6ff1e123 52aa8cf79b4bfb972ee7d213aec64e791ad5458ec3dd01398d37f6f076f30b3e be0187890f99b33d14ad79492d22eb17c428919b2069d6a4e4a6ecc66b152066 1341aff7e2dc0918c3659920899e52663b07cb3d7aff417d864cf36eddf0c2b0 227ad0b3b1442a4115911647c0c07807d76837163d39abb56185485636eb11f5 48f1325c2243877ba243a69acde3b803c6bff1e6702594b6d928623636184d37 9d96aca9621dca1d2bfbcfd97e0d9f3999301c886e2b85edf0203a7774567d66 1ada60c7aaa43d837d390bbcb3bbf518531fc664ccafbd8c07551a8807a128ba 0eb90fff6a2d47fe82970a96fe8772dd7cfa1b6fed7007b3d715c6144ff3c8f1 357e4ffebd6a18bd1a1753e91729314c99c0184f2e73eea514e0b964bad87971 70a15a5e6c9ef5596611a0c0807b6c3f422b11b49c8f12108e5b67b44863bb97 58cced2d14b0d7395fb5f04547ff88977f341ceb685efab64843ec7e8afcd16c c5589bef394cc0d715ebb66be01e9b74156e7fd1bf19f257dafb4f5b63ad50b1 2e33e6ae50236e1ae6739a16b12f2d4bdc6ec7021111cd445ea33c1ecb8b2ffe 1770a7d2054ccfbf8158cc5bb3e3574f0e82e77e62579d474ee6cfa8b9745546 aeb3d15f11fb2858352d16b1f9f9a7f9cf8a0fd9fc1c1babbe25c02392495626 97102caa0f5e35e06fee8a5f5ff0b80a4dced0f23cbc35359b1d47794b6d6b39 95972db422cbf50f482f99c9d7ff8753865fb5297d13cf9337202c0637dbb40d 6fbfdabfc82e8ccd86eb2336d8f515e34522c021a8c93e8e99ba9e7ef9f1ef9d 8fc19253837567b7e87b3a728760dcbe1de57a667b1c1a704bf5cb37fd76a7b6 63d41367d7a0a133622a117e5dbef2b8d1ed9ff0558f004d72cc200383450699 5e32badcf83954865085439157b3a089e3c59196ec5e28009a16f89b2bcce839 0854f569e7d9a22cb3221ad162152b9883c6242f9620cb4c0b38c588b496dc92 62e7921e3b36d8998bf5cf570a67a51f0fc563c1dbdabff60facbbfa8d3eae36 74b6d6d7d4aacf31993d9e0bf29cf8106a39b5bbf7ea17965330b89f259cd6a7 5fffcead536472aafdbc3866225c66f81d1e11338793f8daaab220bd0dace4a5 d5bfe0d60a5f6dbbda7c0734d1e692c16e7c39553ab68e1bbbb7d3ff04d497a3 a2501806b807ebcab144b849b02e91141f28856e8ba2a4ee37941d85f33bffd1 9c5d27d82632a4713dc20daa647b9c94172471f5598568d0024e475f41857ec6 00d3c314d82fb0ffed90de2c344044ea0fa278f0e23cc6d2c2e12429936f9eec 640a46ae1606fda1dbda45edff70f3a655389fcbd852f6c67c48417b54916c73 44bb36921dc2d845c6304ec742b1415be60fa3c0fb4c34750c8f04372c738439 02bca3db091b92d8e04e34e68ac8b123e46e1804ef1eb4814c3f60e37a6fc734 9dffdc74de7265aa259bdcb8c30b4b31c969864e72a8fe0a2ba4361e07ccad05 45c92a31031126378f4f675e2f1c7436d9d09d9b06f49f5fda79d338f9d69ecb 27308e8db21ddee0c7d0a35a92673a600d9969dc410d0f80a3d08edbbaf1e797 4929624e8e971db4c5bbaea96c3a87b2e8b335959754535e6be3087e46c40fef 8b930a116f161abe3f2f6c32f68d4a7b1f7b8b5401aa61bf63dfe37e4b09af64 543f0fad9705a8812d30459e6682d7cc246b9d1e2a2e28ec6c23a386dddd7476 b82eb0dee9b63a163dbfb7814beb8258cd1ea10facbf1a23b03b10b4c47a773b 03af0b565805ae18047a4c914b4c6397ed5e8a742cf36351102a66e58c898e8b 0fa82edf25fa84e9d73627415827abaf731ecf2325b58cb7393254f37eabae13 994cb91e3b8d8c78affe5e08a8c4566afad6c3df200c71fb891131b8613e2598 2e2a0d90378d80f36c74527f6855890f3163549fd3b1063405e9f4e465454b4f 70dfd9e0ddebb503131a23e5ccc4f3c7e48e6befea88a58e22e79802785507b0 4bbd32ce840b34cb98dcc6eac737e84b6d6ae2b5858825841ec9438d750fd437 24efb97306e495acb643e369a55865c105de400f5e43b8994fdc553110bb2bd9 92edcf1390326a792e59b3b1e25e191245cff000a7e6f3a5ab2d4cbb8c7bf9cc 7d5401a5faa608ac13844cf9d21f7de532192e521ef4c3d12a0e7f3f95c05e9d 080905eb3eb742017315dd3aa16b2d44189e6c0bda371d7630a67adbed187651 e6a14abe28f96bf79a472d14751814bb20dc620f62b85a357c945350fd83bc1a c3dd95f2ca0c4d141351a44a6b912fa3a36c4a9e7f85600ec1174f1e9295dae5 e031631bd245a599ed279f518919b97b4253ca282b9dc06fd4d08354418e0e23 1cfec1c47b943cb5b204eb2d44732cd8641b4b1e508bcceeb8e2638d47e24777 f1a5a8d88d0351a84c3c2ce100312ac35ce6d76d77d6126d49400930d647490c 4e2419a786cc9f326ffb975d83b09d93fb2a9740fe295017ac1b1c58b6e0be2a b5e5b5b80b415d70bd70aee4caff4feb86d5e1bbed4ac2a29e12b7e9c36ab02d 1efde87e55d4444ea79fb953f18a620aa102cad03e86a965cd8c48ab1ce62f4c b710b622b322073a3dfd6f6d2765dfbc0865873c782996c6b00bb24ce37d762b 8fa7b3301ca9d2a1518c26dadb5c876522e93c6eb53849f7ece1e320bebf71d6 aa5d7dea29d5f7e2990906a014fd3ad1bf5ae48c00a8489aa7d23ab4faad1a80 a70bf4443a47c0eb9bb20a122dcb77bb912b9b39d345ed9484f1502cb53f2718 b48906abbd9b132b934843591c0614d0d1406bc6b3d6d56d5a134cdee29685c7 31977532008ab33bb0d5055f0f47c69d7217ae8aed60db9272ef1e4f7b04c4fe 0f996472980e2203a5598c045fad3df701c7d54d5e4f2b63ca964660b9cd7c75 fd29e071c4d906d3d3597bb14c4e6ff8a7fca7cf0bdd94645ce98b20615d3a07 309e891342716c5749978653eb2a81a4326446ebf19ca48e1712cf5e6ee6e16d ccfc48435553e0e373a9ed29637767aa80b6533b80e8bd1b36174efa2fbb95a9 2ba9ed405dd4363e46ff316f2eb3d6f6c8ee11951ce9b522655cef1a6d150c6d 2da60af514d489cae3f39157ddaedb49f3552e713ae4adb26a8123a80d662903 1bbb42980f78c7d47b784ef82ee43714798b690c0ada4c730bcccc11642e00a3 1b205ff2ac8004d000643f520877aeba4cea0a9aa235608433a65b491068feca 6f572b714036b1b09333e2304c4f873adb00c9bac6ae6fb6fe6fc14c916941fc 9dcda9e0f157a06fe852fe94f35284934278b84f8cf510a1a35f362ebe7852e5 b03aabd32b12172ff42fd8d2512fd1fc7ce0c9dcde4f1bfbee030fdf0dbafd81 3cf49bf9b56f5fe599d5a211cd741b4540415b05fc339c196f42f24b8bc6899a 5757863d6ce8765bc243d342c1e201f74f18811017535a3d99619d7853d01d74 0035a169f7b3ac1943c4090388eb30fb5e1c971647347f5664a034d64f06a27d 14853f0cb4361af0e675b52748b6651bb3931cc3fdedd349e63ff41c51c7edcc 74d299c582064d5b3a4a8a7733d3950c489f5a9171ed3fcf80f14c872b39e13c e42c273f9dd31452766eb9dbb5fdeb69e0a7754614c72f46659a8d381b329063 5c604d8463c6eac8a94771cdef98ba5fb86974f21a58b8fff876ac7379276c5c 7cc742327c24db205728ea265e19746ba88ad78a9c4d50ea6d018ca8b9c68fb3 d6359a8edf070c344c853930acd008509520100e68df54b98975af882743ef57 83d0d961afa1a53be4cb9e7b294714375f0acec1aa70d2cef7c098247db9d34d a8e665d5bad2519e40e1892b0ebcc7c60d8de76674c8594a868ff04f10875c51 6f977b872fb4d3f7a0cab858630709c79c7302dcfc4fcd79eeb9d38039151c66 198a75dd5434bdedd1e00bb1b6737b7a4dabafc07fe770716673bd7f2cc23175 400e2d4726c878b1f0724d2c2e10c33510fc39d09fbb0b7bf3c4aac51314a8f4 e61d773294abde97ac3d779df391fd5e5b3c2d70c29e742d1c86ecfc434d63e1 b56e4c466ecf6920af7f30092c1d6857529d66cec3656be16c9ed912110f46b4 7867ec1670312c807f8be4881294e140707c9767da347a83db402f94f4962fb5 3b5242f1189b741ddbd114bbc5693c6a4b74df9608404a9b9d5d7c637e3d2823 532ba4cf63e16cc7516daa5f612a1011794670131dd8e3d377bb668e92094251 825edf51c8ba34edf2b654d7492e1b9c6e8714118e4c1e5b7186885eecb9cf8c a7c3f0819b9fe37a80b90995c54a6f683b0152c1ed0a11de6ba54ee27932776b ff6b35e72f9f84eef65d4117661db4b17f271b5c71294681aecafe74854e4129 8a407a3fa82601a58657a7d888b485d727d8739f62da38b607111f3822c71eaa a66260c30450828347bbefd23e9c9b9398fe487b7ec755063643ab47a03e6997 d73f0651785cec6e36b8540b15ce30f7de9093bbc367400a75a8deebda933756 7d085e0431a5ca23ee4c61c515603842f4cf75f10c2dbb523d9f7bd435c9b614 745dfddb71c2ac7612ed11f42a6b602b32e3f9e9d2aa9e893c3d67d8d87793f6 bd0c9bf2b70ced9134898288789c074ca3f7c1ac772e216cf3cd999816b40682 eb1720fdd0bba02f8eb163ddbecf41f70a85d69a41320626a24c6d7997a3dab1 c09c4cc649568978f9b86205ee59fcdded4f47d0712d80d9ddb6e9dcca8a1266 e89f2e2af91ca98822dc12ed4c4684f62283c53faf78ee4dae7cb98a679fe891 8cf00751eab87986d227ca2ccc8675776052884bbfa450d639b72800c12f1df7 15a98f4937fb4db6d02b7029239e200df4978ed3a69f16ca7c90b9149191969c 1c0d311c00cdccf69eb575a6c4409cff1e15b94c48fe8b325610ca42a872b864 c9144b3bfa4e3be514620cc7cd7a7d8f891d821a88dd020e7606c254cbc976f0 dd9966aa80526b01101b130dc3e316dc5865d61ddcb5361dba2c32d6fe4efaca e800551904b87d110cfd047a7738fd066ee483b224e4864cee7a26ec154382ae 1e6c0f08c51c66297063e3757b511452281265e1fb6e2b25001d50ac250577de 258f0314bfb93412ab50613927e310c065b7cc5bfb5d75f4d8a1b7c2b62ea5b4 1af4173d2a1877e36be794680640ed1e939c01962080fc4e54440a5b5d52948f bb8ce4549b8129c2990a9154f186c8b74acd00ea36509eaeae0021a7d077b372 c41b2d69e1c1082b2ae844ea8efacee90447ed3b0c8b50ad7978833d922a2be5 1c8e2a7e93deb9d305e0531533fb18b2e4eb44bde67eb4961ace238a162c5301 f0da53757d30c13280d718b25317c0cfd0e51768c78877869105e67c98c89e98 8b1f8a053af2f2a515c43f26d024b042c0f8c351d9df42db5a8ec09647f8701a 4e52b3c58c0c5479110cd8a575982e2276712ddf9a452b8f1196bfb90f861970 73d0dec7289139ac7bc97f08c38611fa4dc6c79a085ec301509cf5c6c935e7dd ef2061de5036b314df09d8f5b95d37805a26275c717328d820b2af11b85e1edd d9bab6063b141f8b9fdc7385b99f860b1f6b4a3c5e86a53b9a5c6db0203943d6 5785b769d0ab3ca8227a6d0177757d1400bbad5dcb7b593481791b2acae9c110 07074653c77e9e68f379da10ed8c943379f53398e90ae7a4cc0e0e60c56b77e8 151aecd5032cddb8041a4e3f5715d3ffa7b86be3e358439a61cb65af53097829 97bdb84ca552507b2c9d12595e356776fd4110ba3c9c0c3cae864de52a28ea9a 53342e6efd539f0261d396c7ee362c668285cc8a5a040803499884a0311b4d18 f885e011877f54b62ea1d65310e138eccc2659fa169f4e1191b456c486641124 836eccd193240424f381c26aaccec0ed6a179bfbbf23399f9087d64ffd6ace61 240f1b4bc1 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMR8 %!PS-AdobeFont-1.1: CMR8 1.0 %%CreationDate: 1991 Aug 20 16:39:40 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMR8) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /CMR8 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 174 /ff put dup 34 /quotedblright put dup 44 /comma put dup 45 /hyphen put dup 46 /period put dup 65 /A put dup 70 /F put dup 71 /G put dup 77 /M put dup 78 /N put dup 83 /S put dup 92 /quotedblleft put dup 97 /a put dup 98 /b put dup 99 /c put dup 100 /d put dup 101 /e put dup 102 /f put dup 103 /g put dup 104 /h put dup 105 /i put dup 107 /k put dup 108 /l put dup 109 /m put dup 110 /n put dup 111 /o put dup 112 /p put dup 114 /r put dup 115 /s put dup 116 /t put dup 117 /u put dup 118 /v put dup 119 /w put dup 120 /x put readonly def /FontBBox{-36 -250 1070 750}readonly def /UniqueXX 5000791 def currentdict end currentfile eexec 9b9c1569015f2c1d2bf560f4c0d52257bacdd6500abda5ed9835f6a016cfc8f0 0b6c052ed76a87856b50f4d80dfaeb508c97f8281f3f88b17e4d3b90c0f65ec3 79791aacdc162a66cbbc5be2f53aad8de72dd113b55a022fbfee658cb95f5bb3 2ba0357b5e050fddf264a07470bef1c52119b6fbd5c77ebed964ac5a2bbec9d8 b3e48ae5bb003a63d545774b922b9d5ff6b0066ece43645a131879b032137d6d 823385fe55f3402d557fd3b4486858b2a4b5a0cc2e1bf4e2a4a0e748483c3bcf 5de47cc5260a3a967cac70a7a35b88b54315191d0423b4065c7a432987938c6b edad3b72ad63c2918b6e5a2017457e0d4ebc204b094541f345ec367ae85ca9bd 24568a01d3b9f8095f7420e6c423c414b3dcce6da48dd1c89a56d078e0d0e2f2 62a13640a06d17e44ee3866c3471fb58fedf5a3b77294517651c16bdd7267d39 a54e7171752dbde63ac19bb4b3021ce95eb5fe67390b09ae4d9ed4d704a67443 f55dce17acd996c1f5e023c9e5a18cbeecc3097f23763acb86cdd7cd13381ae7 4e48495ec7fa520539d87f8a8dcb3c826275469b6800876a457e7d1e5be867c7 b1ccad69742a8c9b0ad943482bf2a4ad0aed40baeb69a0233bad36b4ca2d2da7 322956c70375d152653500b2f22d2ab6990cadde2da14b4917f7515e64bc3d96 bf775258fc7dae4e42a4c9b6da8eddec4a800c8aadc8d75e48cae52137e05c03 677f5d6a82fa46d9f2fc7f56d62e5c605a1b7898b8d1401c2cac1a0122a2c8a7 aae09607f2c5f29293a09b9959399283be89051452898238b777db9830ff4318 a298b221c4a820c700ca964fc99e6b1d9eb0bafc39be9aa9dffa2fa326b2a466 1e67261bb3dbc85844e76f9313ab533ee16bcb478166de5502b68e6ec1ea6110 f53206cf1cfea419571b0243244b32ea38b828a01e62b03bcf476a32c2341cec b8a0fa2a3f3f339315d5f3aa7704408f6617d026ffee4925aa48537a4b2e556d 225be09392546ad561cd46cf766f0ba14c6854c5af1a528c3842b0c5aeefefcf 19f19cbce5d967153c4f88e51c776cfbe10d39328466f7a3b83d85601ef4d1ce 0cc136610fa6a74d9676e4e99291d565cad27b9eb2337b0eba4148efd0eb2866 ebf0a4209ba135ad1376cf9cc2d4110f36121055caa3f2e7e90e9af65960d780 0bc6b2587fd5b9c7510e02438becd44e71d56690f7deeed6061adaf69d9c7e47 baf445063578da619b16ca4e3d8792c82985d7012b48604a6ae13059b83b8b0a e85421ac262c654026a5858152cb0f10add125b381a38797fad55a7b093ea104 b88a1d3036abee5d9ce92c4bbe5a3e72c6ffa0ef84832c75423af3b28c4171bf f1b81868a45b2d8439cab6bb2547a155f89babe1da73b67e80cfe4a5e35f45e6 70729ab885efd85593a4dd9ec3d9a98ff198e443efa423ae0bff15fbc866de18 22abfd3170fb06b61696602e7fb51170624760802271600b3f5ff40b3c755972 ca16966ec517c73d4994a43d8bf4bed9c1db178a521fba5584334b5c7c4c3a94 37671a23c4ea7796763daa7dd2283118ff61635f05f8ed2512abe08517647842 03de4bc49dae9484ef43ef62e6b345f50ce62b54db82de468b438f23749b41fc 41a44d0468b60b9f636b6e8e231f697102abac629a7771591412065c600abc34 cbbb00340f09c710d8743720c0f75e0f3137603e7283c0ce2cb930d28645b0f5 9df8226df9d37ce19a59e5ed2ea54933c6b70d6c458317068ea122133e4754db 736822c32bbf5dc872e88b6a9318d45410d0032f014a8834b7645d393a85fbb1 2c58c7c4cf1ff5cf6118d792faa4b77f200f40eba68352db3a2d84231886a6a2 51928be021d88aa82c318b2d486528071e864cad51da641d303f28e02c66e141 da81a2dcfeacce9996339c37d13827600a9872dddf4f0e030730e9bbd0acba84 71e4266916aed9e3f637ee742669b759e44b0fbda29ae79a580f531c7db46587 56c958775784e1ba927bca70696ca2e129e8db1994856e21d97f4cb1f76ef079 7e4bc5c3fcd30b1929753d16c0678efe56e3bbba91341290fafdabcffd40d04d 369b640c60406b8a52c0e628a548affc8f2080e606c44f33707d81f4fad3ad19 808c02f6fbfe8e178d62e4360fb0a7315a4c99599c56e229fffd8f6d4890e02f 35260d88e7d8f228866bbabaf1916a6b0f22503975ce413e629d258e6a9100a2 52e5ddff9d0e8e073b18bff57fc6fe6656c5d0eb4d5819f2f17b87abf4e08c84 350a7680463da395dec683a0714e6cd1b217b620cc8ee9f4d7ac3cf6e720433a 50a612423cbe9170619fde8bfd3e465cfa62ada11af9ffe0e0f9ad85e25fd1e8 bcd3e16d9230d3d2611fe4bda368b560c3cc4ff3e9971ad57285c4ee889ab319 e16b9bba783a4541c430ea33228df0c42b0af6828091618488116f9af787f747 f25f89f12152610000209cd23d717120ca826c8d8a068a6e7610c0379e44b672 6537ae62e7284f00658c40adf2c107eab7803e5dd20108a350c722af364b5b67 78b43e57bf2bafed45eba4f2f07a7fedb348d5a67b9155d0a44fbf0555a5de89 bac6f654d958757af95d86107e9c60291f203b55ca6df02039a7783757e0d888 5469d426d7f70dc48c1c5e75dfef391e7389abad4db140b697ad147b4e52f86a 4b07ae286f482d7d6f906e3a3e8a53d745ed7ae6e0231a12850a860a4457e57c db04f9e2757d23d5089eb1bbb589b0d5419591882446a6001394abc81e8a3e60 916a8f7867f6f4642c638a8f7c7761846b34451788cf37d14b2da2ab7264d6ac 716598ca396890df1559a3cf3bad72d9ed856e4df8650f199fcbf4bfdbb76837 4f9699c20e9fa1d587349ad4d0bf88f408d591ee012b07972b2ac06ec107b492 fecbbe5f82d81603210ba8b2c2983ce04e376dafbb12c08b359a6fc3a3020e7f 7210d1c3491d8cb4b614fb851c1754840f624b0666271fa3d9914c868f1bd8d1 aaed5867fe705f59705af7d05bba87b2df07754bda5b27a7d687a77659483fad 6f66bd1c8cca0d826a9a19dd91e2b13d577ab7aaf9959068c35b003fd1dbd68c 892412ed62e6556dd3f6972d6c7b97cbfbf7e6af01127cda7f7ed168400498d0 a2fd93deacf69abd1ca826a09403d6694ba791a92b17a37fa03a242339ba1631 f926f0b3f6a6c666e66b196b808ec33b439c4e25a1af461f747e4f74f1d085eb 1aeaca0d95ea07926752d9522daa1d86837acbc8437b7581bc030ef5d34b572b 553c659e666349915c73b3507e521f0b36956fc582c8f9bef837aea15e132166 44a7951ca605cd61afb09336ac400ea97eeea6333aae509187a263230b289b65 f160f4c5d22a7535086b522d77fc91787e2ad60ce0bfb94d2e50dede3084d7a5 449668dc726fbbe5c315c1ff08446e053d2552d4a54e2fcdb5029b37bac52b69 a10b27bead44a1c769d8ff7e2530890f0603d23f7ded175f1be626f45129a00c fc8a370cb0e59378bbb7a98a9e8f4b355bc7347e8ee26eb581e40dc9a7202fbb e2d3591de14fb8b183ed96122b3804383b24bd4ea153d68bcb37920089c70306 3ea6b2ed1866faf8fb0e0322226a02b874da28708674ef279e7b0fd461ac4c6b 37fedc4e85da2abcd632fa767c52c01dccc52152eb36fafbbe4b353b2882f8c2 ffe47027964a2f2811b0410f26b0c1c6a61edba55a529e445aa09f946c020ba2 fd1efe3da8ad82c97f829fc71766ec681009888855967b6d74a5b809c72d4209 7b2e18875c1c098cd42b9c106f9958e92598fce04de6ecbe403da664a32ef389 a7bb2f8e7fd7479f87ba65caf4b35353f5ccad570345d95491b97c19eeaa89bd 03e4a7d0d8791f92d2910a16f08271ee46a01ba96dcaabf9b1b46689f874c5d8 fe154c218aea6dc35cd14e323c9ebec55bd1654182054fdb440dab9f5594f234 e7362697748f6fbdcbcc92e48535bf9709c1d37211c7313b5ef7fe7918848e85 6d9cb4294420372f46a3bad79dfa81d0453373273880f5d08940ec10bfa868f3 126169c81fc4304dfe6d1c4b6f2769e6b0bdd43347fef21558738198df1dbcf3 e4092ed109476e52d3e66c07460f2dac19a20769016dbde8238ecc7a2bbd54bc dee0f751b423482277e711d6d247044bc1b70fd38d7ceeadf40f51b4cabd024e d8bf0a1e0ec098d7b45e73637b3df2a87654b7ddb163bae8a984127c77d65570 3f22b97468927b1b4b3eac6d5c638b56ea4f95087b8948920ab9372b5edb97a9 8e80df8e5b221fbcf6ad400472d159a628e9c2d8cac42d6460f8d8fc858015f1 6ffb585c34facc74dad0fffded63b915dc355ab74ef15aac3eee9cd2d6c425a1 494a9530f1fb486130aa5347de37ce465b1479c8099a15dd2b812350cd905f88 0c67315ee2593c543a43e4c92ebfc6fb36bd4ffdcaf6e76fa2eb90df8b5a1aff d85a1aacdbadbf71824fb98be4d49ede26e7d2a11fb3315dd4e67aa67b4693e8 6e8f843160acf30a51b2b74ed398f0272d6310f2ffd270c01cfbb68e3d19029b 01d18375f01fe750bf8d60e6a16d1c1a41f5c522117424e16a43bcbfbe00f0ea 4b1af07e21759c086c11e0483d377da7a555d84377c72eb24ab2a66593b0453d c5a76696340813a88deb5336f25c60ecb228fcfc0547acd98da7e7b78783d577 9d2ab01a5e2cffb207825fbf871e1f661f4751c67703081e379b9f487d8ea351 b66d03164830bda64264d9dec06b8aafeb2e059b27ccd726c92530907e946fa9 0a6556b5f410b937ea1423c469bb05411848ad492b1b530f32a1cdb0fcfb6bd0 cc1b574190a3ec3014007ef8e13f602b62f296986f4fb5d873e4dc246e9adff8 b7961291a047060ca4fe834765445a0b2de7acb371a7705a89a844801210cc4e f1479561b0f292b5bf37da73d81753697a1764118fd5cad62ceda154b66343e6 aecdd0ea76d2b422b798bca9a4fdd41d5c2981f28d1e327eef6cfa75c6d2d4ed a1807ffbcda1eef72f213e4da4e7f34c62b817a476fd6ca245bd15300d55dcef a6f7083171d66691cae3ea57251c3d740afe987b11bf0c7a20c6e09df442621b 54dedc99037f98d4235410f299541e37f02c9783fa3fde79c1e185f6eade4541 1630a42cf52a89e6942623e3eb3cfc2e4f5cb1d40729d4b0baa88390aabbc2ad 751365d730b81de1dc67fbb6aeb31c4cab42daa8919dfa1802b08f93faf3e90b 9a8ef4976ae99369cadd9c1db695b85cc7c09db1f35f2763891359d5f343a766 4300c170b555fde44b7d39675a833562a212ca31e9b60888c7a33c9d6f0d8a33 ab30df0ad47433a234287ab57e5b1a2732ffd178c12dbcb4e3f2f6c8781708cc f688f4695da3ac148d066713b04d944faf410bd7bacedd6249ad392dc3a343fc cc18cae012cba5b78f2cbae0bd1933e1a7318e5a231459d751c698f5faabae02 fd185d58c5407fc725a25f981225308f3624b523b87c536e2be83dd72fadeba3 3b29b1d490be30eaed5b30d581235f9b6b7fee909cd4a4f6558f3f2dea7e027b 2d9f768257d4dc32ef554707f859a6ed624194e387fab3ab168573a5be1e4797 354445e27cb39d1d458a04229e6b7f8a923adde3e3561819cd688d29b7ba4a7f 49a32a6ee4823107bbc4ae72e3ef8d07983e74526714d3e33fc74df3e937e9dd f92aa7ca2cf6a5f439388cb3d0a694f92f0955379da4dcb0110452f52e86cbd7 b47e411e64204b792b43a4208392daf96a9307d0045aed45df47b855a41d8de2 25d8f71feb98d92f6052834562181a9e080de71a7a75c369bd3384839f92f229 2697c952d2e4d316f2007730d3b693c820de4b9ee36e5f423566e9aba920a682 f84260451c496f1cc652a3df553eabbb72f304e162bc70509637bcc705e5d06f d7cceac37fa4f2667d38253f95051b33e9da6f7c423b96e02a2d90a3084f5d90 c0b500b1d17aaddd8ead22ea2487a0411dc6215c75c824331a4130a879d55b38 fa0b78d98740a909a4f55dc8b82f31672da3c6538ae3f96e05c580e029af6778 91ca311c0e03bc27cd9187d39dc1495eb25ccd578f6587771bb3c11d39936f4b b4c9076344b8c698492978eebf52f9372c3fad1cb9055e95f1ec1a7b0610d986 fea5ff26d8c45b41196bb157923d538a7f8c78b7f8e6c73f7a6dec69fadcad59 92617a55b564b8fd381d25e5649970b8b1e01fa0540a696666c235d0ca715c0f eb97e03a6409387ddfae554de707e93fa41c29a9406b2b120a3f790d930ab3dc 8d6b08f576ec190f97ab3dcdc7d7c1816aca202a5f2989fa95a64e2b0051c2e4 80611f31898869be6a4be42c3e18d971310377cba3d26be3665be6f8ded1b077 37f1972d863c2a6ed295364b8df0e060826a56553426de9cfd150072c9fb480e 602bc8d957086da0e6cb6abeb018db8d65cf1db1a50f1a6fa2c86639825a54d8 8d4ac05d30754b25cacfe73f5e25279bae7e6ef958ac43a0164279ca0c289c94 98801e1b6054a9082594bb27945d50535e8e3eb06d3c8708dd53a493216020c8 5a5e2246f0812c83baf01dfa1ad00d8af61ad99903a34f1166e3f446ddc51b0a 444eb568cdfa855e1099816c0a807fa8bfa3c18eea4f362e341d2401681a57bb c5988378fa19783b00775af85fdf81de2302065cc6411497e915bcbee0b76d43 0486f842069855a51c5a1bd1652e0d2e11012fef6f810f668660d8043b58eb35 53a10d6d55bbfe104b7cc6de42eead176b7899ac458386cd4704f7ed705c64d3 2776ec98dd3bdc1dafe57e5173198aff75566e703ba26675801476d449a085fa 51b000f5626827c2b0ba6f7afebfc4e9fc57da89302746d19c987387b268a568 f06f85532cd599f2abbf94570ff87a7d2c7f85802a172042347db59ba7091e52 48e49f474fadac371263a255bd905fbb33f9216c108950bcd6d26eea8af0d20f 9a802b4572a2b816026ab94798793e3c1b9e506a11e8094212890c71e7e36276 28355e032e4709bc96680be3d9a0f157ffd64601776d90a2b8ee53cf40a402bf a553e4eaeb37a93bf93ed80d115977719efb26f658f54f9bfe070d29b32b270d 4f7371d02dcb4fdc72db824555808bb45b8d73c0c753cbead977b8faf70b9d8c fa43e4295ca466c30e379031c42f0cabe70b19e7c86a715f762f43500d2f02a5 150c5b3aaf2a094b2bed9b9e8a55fd56e9e65dfe137a058729afe16818bb1936 038a3c1930b7424a076a139e2f21e71a2d8275b57c1fe4b9ad5af350ae7b101c 5b4fc129f9083804fed90ca31b734851b39bb997c89d7ca3aa8fd36d6b723238 81191d808e473c2fefbcd0d04533a46772fc01b840d811874755e074f345eb58 98c68dcd35c33623234705ab518eebd8fb28a3f6d3f0a052d7b742a270c193b2 6a1421b74ed318a200c9269065b134908c87eea403998fe5ef69a79c66169292 1ae831461193cb9404b436ab908b2e8b2bbb4a4c32477f88633ab842d06d919f a8f160efd473b79222046fbdcfc0e5ee890c1c467976c3a273d6cad6dcaa4611 33e7eb7d3f56e2733020366a97c0b55265e0641507629225e7a1d7865dc7c459 9fd731aeed5c7f52431788a913020e4c9280a05ad38214acbc12dacdb267132f 73c330bb823ed7c578fcde89dff3b6248cba25597c9fb65b7273ed9a0cd8ff6b 2e46afc330a38aa482f0d7058804ed218a6c05f5a20e5666810014c4e4448a85 0674286e26e9caa3bd81a9e78942aa1b9b4ae0427a8260d9a008da247167ce17 e940833f256019f2279cb2c6c655c4e640a52b16f439c1d60b323e2731839c96 1072a666cde5b45e5b8a13360f05506d0dcea5ed3cfc15756022d9e252bb9206 688b2020e1f027573da2a410da156cd4d6891dd93c6d43eb5ddc2f0347ca15f6 20568b81c2d139174ed8df84f630b51c296c79a23605a79eb3c5c4f0c8cbda1a ac1fdabb9e03b216994abb7e75bf6352dfea19849ea3121ec22e4910bc171375 431824b33b40289eea70df69b2d616b5945eb4c922cb93a1ae4b44258a060cf0 0e4b03b5fc8a62749430fcc0239ba70c56e3525d259adb5d3e0b545440a9d522 b8a4a34ee85a88b3dc609e65e8483a8f1d9f014098791c3f98d4d80168d11fa3 a684352d1a6f4d6978dc7d46390fb8a982fea3798e3b915e37212437f387e886 d845b5dce29a4bebd1cb0f69d710add28dd7ed7b37bc5f6944e417a5a6d42ba1 afbd1de3be0dd46bc8e1b01972a238fd59e41524557446ae390a6842178d4360 ea87ad4f6e96e82cb97e41aedd0faae8b731205f0eafe336b570e95d9adae7f9 47c0b9ab355bef532ec98170fd784b1ae1a7a2367175f4f8700c305629968e0f 0aec4fc3df0e86fc56a31a6ddb6587358c3ac7db80b9c6a5fde5236c5702a590 4683024e5ca9e249b96cdd7ed0f199aa2edc6ea0a5c3c62c4403e28fb0ee5b97 0246bf547578b7975dada6bf68b34e67edc538169cd803d0bae10a3856ea4fe7 2d1f9b5bff317e6e9f71d506c306dc094be127380b4af06a29e3e4b5eebf97a6 4ca904c5852c2fc797607898d84f3356561336098ea2da76fc0c149a8bb6ebb0 588b864521a3ccf22dc42d2b39717a0341b144b69f0c5b626ab8fe75bef7c799 c082de29eaefa143cdf4f8a66f9081c213d77f08b2cda43cb7df864dc6129f2b 5075b81c88a8e84535627fa1e4c500e5d3fcc3660fb6fad213043e05a5834e89 ce5f6097d0edfc0cdb093bec5126429859d306cdc1c4d728f1b259063b66efd8 96fc564bf5fe97c5a160cf69f759ba5072379b60d432cbce6097b6f2f7f9850d ea98f75742f1144f93a05f80bb2938c8dc5a08289441abaa622dad703c0b6b60 c6ed82d8ec929379338f1726cc292f1743b4e106075107f69037d1ef2f1e03dd ec5018559dd0a1b5e559456df48af3b776bb4b3fed2133bc98353830891444c1 5aa7fdb092aebc05f8a520029aece68876111b160d04bd8041e3c2c9380d25cb a6309e22a4c42b154eb95cae1fbee220b2388fb55dcde02d2799ef5f9feda6be 8ccc437f5ab80fe395baacb19734839ac221462fcb1b883cffc772e03bbd95de 637a175f358b88a21de2 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMMI7 %!PS-AdobeFont-1.1: CMMI7 1.100 %%CreationDate: 1996 Jul 23 07:53:53 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.100) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMMI7) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle -14.04 def /isFixedPitch false def end readonly def /FontName /CMMI7 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 174 /alpha put dup 188 /pi put dup 101 /e put dup 120 /x put readonly def /FontBBox{0 -250 1171 750}readonly def /UniqueXX 5087382 def currentdict end currentfile eexec 80347982ab3942d930e069a70d0d48311d725e830d1c76fba12e12486e989c98 74c2b527f0925722787027f44470d484262c360cdfdddf3657533a57bb16f730 48bfbbfcb73a650484015441fdc837add94ac8fbd2022e3ec8f115d4b4bb7b7f 15388f22cc6198efe768bd9fceb3446ee4a8dc27d6cd152485384ef5f59381ff da43f2d20c8fb08aa27ab2015b774db10dacfdcd33e60f178c461553146ab427 bdd7da12534ba078ad3d780414930f01bdaae649990604a33aa9eaffbe5b5489 e5c7c9ff9d9be01b08220832c41caac64816b53bbc087ae4b621d2b44b21ae5e 3f7fe4ddb05c675abfe30510eee4a7c874bb57b2ffe521a6875eddfdfd18c781 25bfca5a097aad361dd94df46f14026c25ea988194899b95001209cb7009cead 4b4ea03473ea120e7a7e341d4e3926796347fdb3a124c29660ac09f4648b313c b58e824884382f24ce08d2edc686923acace1201c16a07a42803288cd0b946f7 546510e95b1fa1cc96f0bf72aa823d8e83d7c68c752c82a54c752eed2b1e699d e9db1830272ffbf2f4996ccc2d6fe2ae272798989525ef3b67b0d09bffcef749 a805e5f76578222b9c4a8a09b13189a16ab746ddef7875f1ecf83e568f493d82 ff729baa1e0834dbec30a35d3c49c9b10c5e1d90c6e3c8fb737df5ceb3299d96 0fb79632f91f257753b4d2e34e3f54a26c7b950981fb7fe4dee3315db63e75b0 24b4d318baec8aac9cde186f6d65767df1dba35124287c2e805bc660a3a22772 0ae4fa097f1d75107441c0a0fbb9eec17d5516fa03b98756b7df7ac7eff9c7a2 364b9f691ed5cb692dfff9dd80c761e9c4d5d6061782b327302c053ce1cd09ba 0605ebf761cf9b730524e1994e7dfaa956799d522ec53d5acba27a35c4d28279 617771938ece58c5ab664aa00c1bc4efba2d15504247a68e3af0f9bd59a387b3 80db88cca083b06f5af70d768d1699826fb12ce12efc2b4c70923e052dbb964f 5fa957c3ce225c0fda64d9b5321ee1ade207c1cc93105096cc73118f4082594c 8ecddeb0d7bfde6f70bc62f10407c26a476ed88be7999d64a15912493829a9de 62c71f5a34fbf5a843e311873cd98817dc9f8a4aeb7e0738b5de10043f5cfea7 14784c4fe6a8366586afac2d60fa6428ed028beeba07a6c9d5f02b3d6d1c0fb8 c9096cc296daae9a6ea3edeb8f09b18797be115e4f27b04e2d75765248d655c2 a73bfe8c7a7419c6a952bf85aa8638063ca83c87a73f5ad05ca91a89e76e9d8e 103a7e47021c2cd3b7ec903c52e9203478da7c3bbc291d4494cea0878e39ff33 a16f2d532d4a00b9c8a202ee1f24b8946fec38b8f32631b164a53bc73f5534fa b1afbc2fa76b952b44ed33ccf68a9d2c153d3b2c528f16df435a013504ce1dc6 d80354491558ef5c366fd3b6b945e29cc76d8f76be789fae8cd1969e03aa54c8 07409240ad0db41ee7502c0dd0e1e7622f1c7d5cde404b96cfebad08c084b445 bf1b8be54bad28781d2b60c6f2d9de90c76809ea96ca5c107f93f840f0fb4a80 4a36093ef64148ad34f061b6676589a5c9f25248d512643972e8754688175f2d 013b8220f2bcbff29159815c80acbbbe923d21ca9141ea112a43f6081c1bc08a 169e182248ecd6fb8b18af16a900e7b14cb19c4191ab4f6dc7e24bb885a9ba92 4735bd0cdd5feba298449bcd2a382a4aaa8d27a3364ec5d9b841be62cad78408 224666bf66f2f8eeb7a648becd58f981fc0227e8c6e7cd90cd4c645c3b1c2a68 9a91af79efdaaa97d301daf77f52f7281f5e6b20f0d7b8b23d2ba32df8b71ee6 65034fafedc58c9f0e8813a3d81d174b9f22fb998be32ee0a4a2f27c8fac032d 9fa22e50bf11bab0bee316809265a3841860106332290eece2cd1abe3fe87817 9c443b824d12c7d098ab67217d8c1a21d2bb4d37d893e7f639c88866561c7f0b f63636d9824a67a17eb4c23b322a7236e04586b1531c39161317e8fcd4c1bf52 72ee0ba619a060fdc96c6768814501d6f22b593be7c31952dae1c70681e2b804 bb549c7f7c2b880a5e63541112efd5c0d6e9dc349c544e3d79d8de88663ce0a5 367354e93e51cf53e85cc7fcb8b2286fed895af8ffc9c5b734316088b073c005 a56b880793e2075e3a48dcbdb19811c0a2022a5f631003f7870b3e4b5740f257 2e552503e16d7fc1bb02b8bb55d7fac53007826e8a35ea831fa1ae6c94fc1762 2c210d6b50987a83aec6601469ce8438206d9bd3b346d8bf38ec3087f6eca7e3 98e149b6f862427a736ae23a335d6482c3de69522fc3ba502654e8593eeee086 15428b07b66007221eafc4015cee80ee308ad81bae57626989641875c71d7b4e 80e64db365dd952d1ee19d636d9732515da989f69a65f5ee1039145a31af6f89 d9ecf899a7cfb1c1addb95178d3ddf8ee99eb0819d6dc6c435 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMEX10 %!PS-AdobeFont-1.1: CMEX10 1.00 %%CreationDate: 1992 Jul 23 21:22:48 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.00) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMEX10) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /CMEX10 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 174 /angbracketrightbig put dup 188 /ceilingrightbigg put dup 112 /radicalbig put readonly def /FontBBox{-24 -2960 1454 772}readonly def /UniqueXX 5000774 def currentdict end currentfile eexec 80347982ab3942d930e069a70d0d48311d7190fa2d133a583138f76695558e7a e9348d37cac6651806d08527c1bb4a062a4835ac37784cc39ad8841404e438b4 d52d3901e47a1de4f7924e0fb3daf442499175bab1226edf692a4956739f8828 e80592f450c5d5c22ac88bcfbe9748f61d18243a16f4a4467f084e8e2be46ef4 7fc51c3a8199e3cda62ff9c4fb73956dab8b6683d2156377808cb35026073e80 523f59a30d195fcf9b9fce4ffafc6d5649664203ab24acb938d58d246707ffe7 d62f04bec4b70c21ef75beb2b812622b3c74e969d72d3cd11bd7106294a99caf 0b1629bc7d4de6b96ca82930831d64575f23f4ad06a0e45e315b1d392411be8d 6d73c998789ff258a07a3c8c2057325784514c845500bfd1a971310cfc11d41c 1a167dbd5ff012c60add4e87325f6e5299032a839de65fb1473a166aae1876a4 414a434f22c1d241591fb36f857df6fa930608750ffc0c54f44994662b1f00f1 400bf752ea8d83ffc4cb77a290bc2d99981ae59a191748ba5c7ba1a9d2583fd2 1398452b6ff5d83a059f7eadcd2ef744e9dd22bdf9c79d049bf06835e878c32b 7765c69bdd8ef4deb4ea7cfff4cf9354a4ddffa689de961d16772491c7afbd7f ffde42400764c68e954ee5c455a5687959829bc3b319b2147deaab3628662c80 30c5e02fea09609abe4eaa12e217bc3af673f1bc36a7039eb13fcacb4218fe0f c5a3f9452d4edf46cc91db67b624d4f2d37502fb9f11af4da18ca40b61097f95 d44329375467ed13c5cb585ec53f62b83ef9502cc755af44bf32b87b8ae9f3f2 f8dbf72dab90acafbacd280db6aaffaefdff6d5eff26669bac56280a950560e3 d01714ba38659b0e4e28bf8cdc1f15ff7e3ea9d95a6afbbe3d8e6905aa6d531d 6b6dcab89e2036cc492c65f76ddcc3cfcff33fde3d9ffd10f7a90530fd5c7683 4329baa902e701ca42717476298c9ff511b1941244bb1dfd0e5cab92a43970cd 1bdb292eadd055c97972844fdcdb0aa06401e7b2632b9d134f96bce0064860f3 9859da7a9a82be0a840672a1331212752ae1b521b693b384a72dba8d37a86eaf a0341e7fc5f6ef7a8c566aacb91e8bf5005c18837894c4eacff41dba54e071ca 83f80e7f256d4fe2fde6e2408ec819f8fecbb87409eb72939e096ee82990e599 95ebc936aa9830b12e32d1cb46d3a96069ab55ace5feb16463ef46ce75e336b4 c1e8e045cc1e58d8043541ea94929983436dc2aa39d4c0a36b67e5eb99d862af ca00ba18ac13c997a0c4d446f1743bed3bff5ad20858bc1690d33fe0e8e755c4 351ea19a9a32edc1a88d24abf88ffb49a9cc707c24af002e5d29802e7bb16657 87b8dd6a1d1a7e8016f4358cc6409a867628a3e274e2500404e146c648d283e3 8437d19c2ba6183dc693859ba3aa67dfa75410b75b553c06f7dfef40ea84ef0f 2bb650fbb4a3996e21eebb2aaa91a43968b060b2329dc4faabee0baa08e4304a aa15e29a63c5eb99e586779494dafa87b73e32b732181d33b1e162e90b945cd7 00baa7da011c8d653f9a792a05ef9134e288cd7959d977e4fad69d6a97d1716d 998874ce1daba9795b37e87c35e822c801f875920b69e1b1f08937d13cfb18cf b9788f473dc3352152c61a8c96a7105b199cb080367ac76b9c1912a64ba1e0ae 5c7b657796a2ed15ffa7d363265a69909321560c825e15e6bb7ab61d5a24a8ed 59ecda41be8f2d0544e9be6c64cb48051644f9e2e91cd672741f4185ed972d53 b38ee13aa7a583e515b2221302e83d03a127a384f22c 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMR7 %!PS-AdobeFont-1.1: CMR7 1.0 %%CreationDate: 1991 Aug 20 16:39:21 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMR7) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /CMR7 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 174 /ff put dup 188 /germandbls put dup 49 /one put dup 50 /two put dup 54 /six put dup 65 /A put readonly def /FontBBox{-27 -250 1122 750}readonly def /UniqueXX 5000790 def currentdict end currentfile eexec 9b9c1569015f2c1d2bf560f4c0d52257bacdd6500abda5ed9835f6a016cfc8f0 0b6c052ed76a87856b50f4d80dfaeb508c97f8281f3f88b17e4d3b90c0f65ec3 79791aacdc162a66cbbc5be2f53aad8de72dd113b55a022fbfee658cb95f5bb3 2ba0357b5e050fddf264a07470bef1c52119b6fbd5c77ebed964ac5a2bbec9d8 b3e48ae5bb003a63d545774b922b9d5ff6b0066ece43645a131879b032137d6d 823385fe55f3402d557fd3b448685940729e6e22f4be0e08c6505cba868f7950 93f556b64b808dd710eb936d3ac83e5783b5f7e56d363a59a026a5619a357d21 c4e77bea121eb24b09027d1aad93158edf912940e91cd2f17922b35885894644 7773730bb19af9e70453e1b78d5edc123b273a979891d6d5e624f4a388f3897e 13b045e34b4ee2f5e4fc5e996d3549640010c671de14d18b0b3cd300e57dac03 22e59bfbf7b29422230870f5897fcfaad4b50c7c1c58edcd119218163d6f6e56 25ccb882db7b6d09a1586508e8cb642a11c29a46915e4a96e282079cb21922c1 c2e360b487a45302fd22ec8c5fab63e54b5e844d4b17ca2fff37c69c366dd72a d02922c14c0932f65ed03e4219c117962edbad2dcdeaa9c10ce8af38a4ae52e2 b377245b0be19a77d6c936e7530cc4d0b78d0cc4a92698fa2870fa54f2d8503e 2d17b3d52fb2febb09f2b2af0c2a1892039ebe19a690098799a858e3d39631bd 6925a154d161df3918074ada6bd52baddd0adc3f07e2d9f15e27cbf7fe8b98c4 07205c811121fa91e059f2f99322fed63f359ac9da97aec383f067f23e5de331 51e80f0a88ab50fe8fdae4a5de93c1ae2fdca06150b37246140c0e87cb2325a6 0d2349162ae3ac93144eee1e665a1289105318fdfe86b6e76251cb25adc967d3 d0b97fe5e279e1161736ab22b4ca510b964342383a840defd38f96a7280e6ac1 34e48d740607ff2e7804164a16d47735864db8456cbe4233242eb3b447f7ad44 4dc16cfb69ab1e515b3c3579f0e84748810799d7f2833db6e76f6ad8c924532f 8f5afbcfd939544bb7da501d8511e37090f3a56d06fbc17a49c373426bc6d94e 829a8cbfff9a2502c915e2823aeae70e39f00ba99f8e6094a024e3c485032a06 1769d7629d2b46399ce5b0790f61b00c31cad6239366477ddae4ed01aa82bc7d 1916908d984638a585d4f28fad469c9c952ace93265c2d857f255a431b3e2db7 6bbc164bdd6b9ed02c17132e3c02318accd3def47ed0290afb0a54722b12c887 a8939575d9ecf53e8d7fa68b02353a1904755f8c7bd5d4f300252136b881eda1 f0fad705c63238fa4ece9495a52e62ecc62d825e06a0586264bb7dccde320e12 e123e5ee5136d194393a425276089bdeea4e6a6886bc0110a152b9c2fd7f8c4c 28843ca09de09c6eb01b578e04c15afc976b5d4d04ceaa5352db023bd08ed4f9 43e21a1c1bd297c8fa44a71ea42740346696dfbfd6fdbc53f8305c3266f021d3 c4d9db54decdfd1d205a7c8a423b0be2398a4cbc3147d93fd9496297be702201 465e271a2d230162014fd4c1d598306289770d2eb23bdbd4d953550f6717f9a2 619ad8093336c58fecd33161381b70a1be737437e053bca1a4cb677fe1a3cc54 2a545b55dbe88cf2d1bfe9ffa6c0882b94c713d8cb0492e4a3dc10c869c9f932 b4840a4b9b2d8baa7f9f3321d11808927445983d7706bd56eb87f0e6a2cde67a 3629a04571ac0a841f16b29d0685e9e43aec956a9b1b332c66d9b208fe3793ea e5a239d3ed17edb06c0115ad7a4c0f517ba4edf55872872b00c8d62638c202df db3980422f70d9234eef500ec6649702726ad3e654c43c3997e476e2384ff90e 324019cc6be1e22a12af0159838e2979e8a1e7d771181870e48aa7fdfb502339 b8ff9a496a35111d491ecc18f0a7e0dae5eb20fb3af3a5391fbe6497a946a4e7 38f018ff43e20945560ffeb677662676f0dfdea65ca2b93ab3695cff17291613 1a9c465948757bea7aca3b741ad8dd8466aabdf6511902e1a0717a219dd7e8c7 2ad7a6061501aaced759cafa73dd3dbc5be036ac1122118b016224651dc84081 7092168a30e12c81f529b814e544532308d9df9bb87bc4c7bf2db77effee48f0 f0206adc9ca152124bda73524bd26f4fe9ae3150ba9decc9a7c101907eff3436 ae8f3704d2c7eebc2144e7b1835317de674d7ffe23bedefbba9db29e60d48c38 614c422af7b8c6aaafc2f3ad72d1d12db1d502a9c7a46d3780d98c14d47c3ec3 482ca3b2b23d69bb7cb404bd377fd405842de267efb9ede4623949f5b6f000b0 16390731ce03daaf73ad6160bad8b8735d21b2f9a7540579ac29db6ab3895c7c a0927c2d6da23c46d65757b47b91ffbc6de0d74c7f42520c64fdaf42c7175a79 70e26600165c49581fdd6f780f295f9c4fee2737ad88eb91c08d24dc1027c50f 09aac19d57f484e20da06197b4ec1f2c217e7e6b5fbce07004555ca1ee229ca3 376ff8e8ae86002fb4ce606d2c519081c2070cca37f20240712d5b4a724662a2 18b9f83f3ad4c9c57ba14979383fb0fe3c099e35c31670ed8df7995b59f61c37 4b75e73419de3bd7b55372a0a138eb43ae470a879772a6c6f6c9ee38b53e2522 8ca88460c29facc29f490c4a632baf985dd4f642cbd3ed9b6263c6552007b0c0 457479e9ccc9a36e99cce0196b106309227f1bc06d44af7d153f4fbdc454b29d b8cacb679b0e0e8d5eab084c211e977a79323b647834c67701d51e9ecded4975 f3eb5ee486204b7ad1b60f193d3737c1ae8053dd3b3bddc7d131a22ff2c2e4bc 3b40391d51c139ef70bf150939e709f2744ae89365fdefb73f9989cbaf1bd677 cddd2d22c1d05f8fd14ec3649261e41c9a44d45488607bb9430fb99803028b1a fdf0a454e6293b43e862523275d685e2ca31868094508329be470d10a65cb55f d652eeff1af31b757dc00246ab543b61a094 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMMI10 %!PS-AdobeFont-1.1: CMMI10 1.100 %%CreationDate: 1996 Jul 23 07:53:57 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.100) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMMI10) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle -14.04 def /isFixedPitch false def end readonly def /FontName /CMMI10 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 174 /alpha put dup 188 /pi put dup 59 /comma put dup 61 /slash put dup 62 /greater put dup 72 /H put dup 79 /O put dup 90 /Z put dup 97 /a put dup 98 /b put dup 99 /c put dup 100 /d put dup 101 /e put dup 102 /f put dup 103 /g put dup 105 /i put dup 108 /l put dup 109 /m put dup 110 /n put dup 111 /o put dup 115 /s put dup 116 /t put dup 120 /x put dup 121 /y put dup 122 /z put readonly def /FontBBox{-32 -250 1048 750}readonly def /UniqueXX 5087385 def currentdict end currentfile eexec 80347982ab3942d930e069a70d0d48311d725e830d1c76fba12e12486e989c98 74c2b527f0925722787027f44470d484262c360cdfdddf3657533a57bb16f730 48bfbbfcb73a650484015441fdc837add94ac8fbd2022e3ec8f115d4b4bb7b7f 15388f22cc6198efe768bd9fceb3446ee4a8dc27d6cd152485384ef5f59381ff da43f2d20c8fb08aa27ab2015b774db10dacfdcd33e60f178c461553146ab427 bdd7da12534ba078ad3d780414930da4f8d58abefd45db119b10eb409dd89792 3c6e705479464a4b310b58348c4b42393988fef4925cf984423aaf65fea9f0e6 4629953bcf50b919d968d99bd185f83112b2759cc411764e9bde677f57c5ee5a c555448d5f81a16259ded1e11bf4119d53e8ab07a802df900d3a2d5ccc1c6876 d29c5e9effb7af3ef83400b0910c07873a8c56fa7b1eb1ba426043b00cc95dbe dc6e136cbbbcb3f67509964f9f281ebf81fe5b018122eaf66c4a838487e82e18 6e006093042848a903efb3469ab6b4049767aadb95c30408dfd58d8a10f4cb22 168decd9f3ee100f07b49aa44c92139b669cc312ba20192454eb2375be6284b0 26659d964b96ae82d4942e758027fcf23c25ed01115af27ce7f20efe2a822bb6 84004f20243a49c9e93301fc21b80815c033c3e2ba58ef53da2157d524b395f2 b37abca13bc6a2f42e824ab7e47106176b0d6db267fbb795ac7425582df2e3dc 55863468a9200742bd7b552c48f8cf58bc21343bd3b95abfa140f33f37c6f3f7 8b0d8a5154eb7c1f62ec598267f13e841a3e64172663935ac8b665d86540d316 ddece329c008049c5e74b27d59022c5515059bc3b89370b1bc6a169c888bb325 e0b74282d6f053a50da4024ed1e433271a32ab8c17d41c632b41cf9f3ecd5fe1 24daf7aea7ce8a63047b245822930d517df7baaafa69d2d17f7d93cebd45416d f3459365434123a76ccf883a4973bab19807e1f0c4bab03a45f7ed69ff2660ff 3963e4def11001eec4238c368a39d874fd30b3c14f4186ec7700fbce22abe468 eb32baf7b0164f8f21a9b5e706b91411faaa44467cb2180ab03de375c1ab93e9 76e11ab92fdd4a7280a6d1a8dc65c4c89d04c8ed6988045a2a3de9a4c7b1efd3 75b788255adb8b108285db827957adb0b64b68aba5b54ffbf7a1f0733d4c5291 fa4070be69da8e7bc062ffdfcba77e77371741f52cd190fe8658a7fbe53be2a3 c1cb05a4684e4267edba147e9f81bd809f88e94065192ab6e717b7b13a3caed7 1b69381e7abb22bb94421a69d802a522387eb677d1d40a893fe9359f57e0cb75 579b08932e661822dc4b1b1350ea9fe37cd07c46805344a48a38b22c3af8073d d348f20fe9be6bfd16b217bb01a01dc1731cd1607d82358cff2185ae7484c43d fe2106a251b360ce095546b69c6a95e4a1205cfce8619cc0d1be83e14734a0a9 d5932b089f96a76fe59264e89ca709d96de25ad1f37c28c6be65b9da0061943f b86c77a00eaaf0e9bbfe52cfa8a5e8e55658277c34e26dc21b94c1d9353f98e9 b03397752d103214d7c50dd5111d46a813de5139908f9d3abc4266eec426b2ea e9cbc8ddf3c985cf74f934097bd9c79a9645fb74ba117413a8fed024a0facd03 adf073f2d8656c63d6c68bd60f3bec7b46b9e67ab9014d50988a0a13c8d37afb ae2dff3cb98d966101e4b5d8b6144b8c8243e1cfd25e5f3a2b8538fd55fea0d2 28b3a76e2fa829f7d0cc1981cc96ec3385ec9f52a4810d56cb0ea4ce0fd391d2 f692f2fd997e0ad9f7946673915baaefe570a745c3820a36112cc6389cec1693 34df0858433eb61968b96ff659ba6c5a0fc94f2376d0d7ecd6e8f025a4e7c324 3221c2c68c1aeaed2eb8934235d7f7a968b34feb20ed8747ca62358f911aab31 3b98433a92bea34681ea46562031e88ddbb0873d1387c773ecc53f97d7773e41 08e764d697d28ee5881db5f233d1b5037b4a888796aa98952e4920b85fd4d23e 3416ed2068793bce56e92828d7851545bfb2954e157d29a580b8bb6312d7fd8f 993a17905017a392669829b08189f1312acf39a77194d0feb0ee41917b57fdb4 aadabdb4a18abcedb2ae79609d72c97562ac68dfa1441097ae46565fe88299a6 138ddd0f6a00ddfc512b1a95edb859a99c6602a8ff032e2878dccef8a2d23095 f597752e000224eca80649beb46b1b2596a39165917634766dafa7827fe6133e b4a6374a60730a106d71de740bf1eadd1d9b6a38ef815560578e3f2c4fced920 82864234efd84a46fe615b7deb46ece0f656061304d391f0b6e900c0540cc373 0d7cbbe403d9de440ea70d70608b6fc70dbeb72ff17a47a4d112d9afe124b7c7 07064c7bbd7884fe6345df68a8c518ea64cced311d020f390e522fc6ac35e499 a1ae237260f2aa606548cd22a6510a855e42dd42920ab0d2fcce8d405ed4bffb e2c47da582c367845f3399bbc746ef09d9e8695ac2b4b42769e2a40c02b21a91 0f7bbf48260c8feb1c16d9562ed3919122062a482df7c6b9a55bbbc247fab829 391916e70a5a39d35a6203a7275a80013d864e497b7ada5d4df628613207367b fa05517536a1414dee9507845c9da3ced891a91240346cee6438c06637f345b3 5da9e3456ee9a2971fc0b14967e63e526e38ec391580ee354b00101ac0932185 43ddac82dd7cffec09afcac399b5d410b2740e7dcee86330ade2e1571d2f24f6 8c4611b53b6134586ee865ba6b46bda7bf25a6ac5895a210a881c9179997e3ed 732bdabc0f434714e0fa55b14ab2fce8ec2372fc810df438454ab254bc3034e6 8b51a390bb3c2036f1983c123f561f898e80ca241c0075781eaf8399902f0e46 cd680708a0960d9aa9bef568799d389131660454522bf8ca77e9db9faabd32f0 6734bb842791f45b1b6806ecf4c66f0347c330a63d9f9c0274b2b5f47d3ab9c0 aeb27113fe6a87a95b4e8d02031445120d1861ee6d81f31b32840e8577e86961 e31e6992ceed7b7121442414b5f4d453adee9db65997ebbbe68178379d19988e deec66cb335e695bd6e6550895773817fbf18c7dbb0364d53f9c999efd18cff0 1a54b7b51824bf5431bc4b1296cb06f74adb642c2bfd86eeeecc3172a8aa6985 b8a8bb6c62558fff787a16e30a26d5453cc7ae90f2df8a852ee6a576dfd40304 96e8961411aa182888a051f4bf189ae9606da9a07e77ad475d2f34e825165b56 07f435ae6f2b15c22631e232f53d5f15a8c09d27b0153187fd3dee92284bcd99 4a67070b66e2bb1c88e16b6a8e63415b016fc1a2f95aa2677654b8e55b584caf 5e8d4e23db44795baab11cd5cc22813a48706d6f87213e2fdc7a72a56d9ca41e 002556c430d7c954d6b0d49d00f0cfa44c551d8cd28289a011503b12fe826eb7 dd7eea7738d9e49aee3a86112fe8c6bed0b8d58e62858e07eb3f03943c20b064 2f1b7c03e195660548914a58609b8ebecaecc8ac8e22b208c4bbf11b9df86b4a d1f35731ac1e6ddaa2063100e5ee6032fc1ec65b419e1bef5c70905254aee16a fe8461ad122e91f35f732f040c9b29c3b66ca84c9e34323fc46559fa7ea4138f 5a05d61850adb7165d246faf45f3e3c3ed5cbc2158a972b4930e5bb1e246471e b556b80a05825349e722d23ca52f7ded2b78721a877139b2250295b982f94c30 7c717b12d5248b1ee92166ede8ef98961cbf344a56356c0d0a44d7168656f3ff 54ee19e6a135a4d878b62d07b7d59ac608e3cde3c514f29300ddaecde7078bcb 11237c73c67eef548cb4bdc8a252883dfe223c89c03c17a502a1ef3e4d5cb474 01a8ba6c023deb8007bd801cd0f107d10772eeab6a956411518eae3851058bd9 1e02471aff1837151e8a7eae0cf689cedc7d0ff2ee9cbd53c4ff54cd2245cc0f 2b89e9ec3daf5dd9cb8846c74c5002c38179a242fa2d7f2560c23130104e04cc f82e49338cbf0d843dbf6d4d9b7a37e38db80f73a09424b9e2a90389670fee1f d6dbac039eb1ca8545d72087f617cd5cb19d93bf161b1883a0be01ff7cfc7977 721579d8509212e39d4288f9f857453c5c6a5ce29bf9b80a9205e945b1471f72 e5792a4f5475ac26819d31ebeb8e63cd3e379257dc7ded7174bf042c7429e9d0 7f663a0d37de2c822af58944147ce12a95ab45cfedb79be17438a71626456c4b 9f35d868d1c4994c0fa5b5a2fe7b98581cf6bfd7cbe0aa732674b4d782b5148d c234a5138f58ad3c635ce9c84e9cfe2ee553eba6f689c1a6ae742ba94d7073ad b85a0516177fdb9d3bcdbe8db9be73c3b67f996d0b420ffce716b483bd417e30 01b2099dd00db9b91973bfa1f2a52404000b585e8e1b66dbee41e9b51d4e6ada 02789b8bea27d193dc983f96d525ad8e92ad17f0b91c187561ad749b26c08597 9f8b54e44ce55b261d796bafc0098face4ffd2e5a49914c8ed06809fb064b5d5 3b17e0de3016a03f4cf060ac82bf1aadd2a18757f17423f2f06594023438e1c5 a2c44c01ee14b1546a41b6e5d06188c8e0100f2263d6562e7ce3c7dd6397c577 ae77e0c5be1ed3a18b7e1afe6cc90b3399c2ba4d1c0d8187a9b8b9baadbacde7 957fe957ec08748d6500e94ac075a2d1102af81b93b1544c1011375f00250458 d3752f69dd76f114c111fdb0975e415d59aa9c4b4963d6e876f55c44e1338717 0bcb159712aac89f7fd41bc487d73a021e90d7bcab5602f362a9d15439fe747a 69c60776fe39f62477553774db50e09e7961217ed8b130fecd9fe80b3f73769b 3dbe2fee6b59fbe106d2aa7e582df7358ab0e7e019e41c144b73060288d592cb 383ee1331fd2b4cea74cb368ed24aad5699d2436a304206042bb8742d8fba9f3 031c51a6a48c162604dbe8be75a346b3d09ab23e1b213fc53c88bf37f62e0100 61b6cf29452428ba6f0909048d67307e904f030e68df1f978d837205c2c41f2d 527c1662d8b62b67106a89468ae61478ae846f5cb5614a31bb5f1593379bf2a8 35e1ade6a5e75108af532dd4683ea614c94e16edab4588f01274cefd89a969ab 80073be510872b6331879d6ce546bb9aa52d78647017f6624284cae3a2e68a9a 133e86ff6914db737b8a2c42ad6c45d23fa7fd86911d04a3c4cfada7ae6b7e22 3a597a9f72d78d1ee8b02f52871aadaa2ef193d948bb59462f869f13bfb8aae4 90ca155a7c5b023c374b1b0c33188d028f4776be346084549d506c768b179515 1d6f60402a4d7fe9fc3d673d6f2dab4c174c076efe9a152c0690142d81d2cbff 085aab5f9f6eb96ed871dc93c587e7500ac870eac894ef5fca41d4be6b731574 c683c53718ccac248c5ff3480bf55adbc42a758e8134682e8d6bc78552f40a3e 28fdb91d2df6f2fcde28ea794100ce4fe2a19558e03b08c1372d58b963e1d0ca c27aef0429013b15478889edd12d74e444090c38f0be973a3e86bad71c16b4af 20ed01a0c8398876dc1277a5695e54d5fa11e3d234070ceed27a7c039501440a 4abe11532257aa7cb5bdbf236a433a512ea52824ed48d9ce878aaa12da70b315 08f78572e2730ec1a67f6b6faded7948a9b013966b3c6e69325e2b9935bb923b 9813df9102f92de7a07319333f3002ecb1283509e745ce5fc9dc162ce4524cd3 d8fd22703e86c08a642b5f5e49b3fec3c8e568900a3fc95f84f82a66668571cd c91f6421f7a5279cb8c3f82a7068edc5016f7896b6cdcb9b078d4ae51efa57d6 704c26680bce98b9a8a7d555eac4e4d8c431855f98f2f0e39316cf082d27d642 55d2751c106e3c39e1d2dc01ee2a892fbe83ea33beb3cdd80e4ba31159ebf0e9 d384823ad567bfbd1e0f933670c9f51430699f2423d3682a14ad82e0699ff376 1b04fc5f7506ad2297d8cc07bed809f5fa8b8553d4d4b01fd30ccad9a3268e2d 8d19337aa2d881a414afa27a2ce200404b5e430cacb7b946d988903a686ea85b 83105a4faca09272ae77470f99d7dbaff48bf913ae11fb0d63ee668cce0e5cc0 569143ea38011495a1cc627ede030a45aaff043cb150f3da951432a8be95d19d 36dd0f79f5007f49e0197a9d28c1ca6049bc38848ed67ba4c303bf518d893a32 b12aebb17b57d155ecfb8de3835da1e71dd5e0f90dd5598fbb94b04576479c03 63d0ceae6fec09da3a440a4e2dd8d16a62c1cd4cf697ea22a01e4bf7ee3ff331 3603f9cd7939a8a3be2d2e3f302cd4dac6fd2fbb925516da2931467331c7f2ca cb86dbca642e6f871f947d6a3ae2014fbe1b4806098e35e0ba566efa5cdef5b0 3b99580585dc8280ed86d54eaafbe949c77659a4f9a626eaa4903055d5705455 6fd12ef7b1781c43fe8283290657d6bd79196814b688dc18cb91a74c9c40be04 c8b7109310feb4184e32d3f41f1ea30d93d9c138c90e651f971424553c2cb44b 9f8d8e284dbe3faad805e96235da445c7f7e1f0a19ab14c008851f9c5acd39a0 2c24390f24a8ec918713241c4b35b93c5777306b6d57dd384df6b239b5be5c60 43c4c27832ed4b795806890d83089b918cf7e80f9fc815f00f451f311b874fd9 2bb57e2ddc3d94b97579eaa76d4348d31ac637e1e20d88dbfe768241b6106dfa fa2891b165d7ccfce94480f660683d3270c0ca071f556b4121463886ee8a4e53 d5da20e9d7acdfb49c06735c751db92a751dfaebf8b2a41a0b67391d78d4a787 3fee0291edbe1db4d83fc1ba660fd2f6fc0285b6070e7c6e19a29511a53cd1bf 6a3a98ef8719f33846629d2da3ebd8aeb98d0a9dbb23c444ff9ef37140713581 33b993ff3685497290f9efbca0c47fc05360fabe228befeb6d09b018973e88e0 de9c8d7ec2978ae19889035f7a6f18a528045b093fcf7d5a8fdba7219aa6eb51 b8aecd153e9ce1520fbc1b88317d2c14ff4c4eb03e1fb6d48877f7b849227082 4f930fd13f670096d3495c02e101ed25103d629be8f12e034235c58441401fbc cd2dc8637b16038887cc2d36b770a9e3517c58a6c8ca748e20e794f6a61f7641 64dea610516fa17031da0f72af0981e86de4441e78cc11df1eeac5a7fe8047c8 2b47e87475cc85c8226078c326d5e904d006f5a519d726bc779850ac0c795c0b f5317b70dfb390315acf74f1505f4a8c107985e723ca7b1faa89dc807248e9d6 dbf694e80b58fd5ffee481ad0c0d20bd453a1ff8a5cc828c978ca25f561a1c2c aae768c740d9fe72ff58e5b018b2904cf1197ca9cf50d3e745d65db64d852581 c3622d1406a95ec58afd6960232f7f527e66c8b7361c4c3e2a25eee7853013d7 c33e4857aa8c24754448f17c495dcd16a1a4200a5b8e62ce9cf156a3b70abc75 d8fe63f5a0c7f3b1472e7696a47d8526b3b5db3503ddb40e72be6651432f7bd2 a242febb6fb1e0654c22a36ead5d26762beb621cdad600d806e5c43f2ad7204c 9d1cddc350555e37e72f54f66eda8bcf1e523fef6d0969890c00f1280976b31b c2779f19baa8864f53e9d1f8bf22893c3107ccf8033c8eee24a70a55bbf89c96 94f9184bb9cbd5a0152d3cd3e997679f419486f43b655d3b488a1e2d7b00b93f 93b22e184b799a6bee1a56aead24a91ee63779cc76e1d8b35b79a0fc3ac922a1 491bc5942d02d1a2d2b5c085954ce95229101f134a9a27174cc39a4ef3165965 716bf02eac6e609464ec6d3345584ec07f5095f0138f086f711dd5091db8857d 8ba6c7aeb297788496578b82dd12ae2c9b59762217c15704e47549b2702f94c2 0e303a1de4c4bab0b5df8e9bb4f4af92c5088f4d0f48c32592bc11a0ea064f06 13d5217a6c2da496f42a336847f2e5cfa1f2ed3e85c5ae1943c8c9889c20b03c 77d3f12db36d9f6ae2601eefc228b999b7e69dbee395449c56dcb1e2342f21c8 5b1c12339f8abfb05440e4ae0a2245dee38b74b1138a43f03b078117615b46ab e3d2d91febf1565614747b0a6c04ad3e1a0c2351c412008ac8dcbf2db9 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMBX12 %!PS-AdobeFont-1.1: CMBX12 1.0 %%CreationDate: 1991 Aug 20 16:34:54 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMBX12) readonly def /FamilyName (Computer Modern) readonly def /Weight (Bold) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /CMBX12 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 174 /ff put dup 175 /fi put dup 178 /ffl put dup 188 /germandbls put dup 39 /quoteright put dup 44 /comma put dup 45 /hyphen put dup 46 /period put dup 48 /zero put dup 49 /one put dup 50 /two put dup 51 /three put dup 52 /four put dup 53 /five put dup 54 /six put dup 55 /seven put dup 56 /eight put dup 57 /nine put dup 58 /colon put dup 63 /question put dup 65 /A put dup 66 /B put dup 67 /C put dup 68 /D put dup 69 /E put dup 70 /F put dup 71 /G put dup 72 /H put dup 73 /I put dup 75 /K put dup 76 /L put dup 77 /M put dup 78 /N put dup 79 /O put dup 80 /P put dup 81 /Q put dup 82 /R put dup 83 /S put dup 84 /T put dup 85 /U put dup 86 /V put dup 87 /W put dup 89 /Y put dup 97 /a put dup 98 /b put dup 99 /c put dup 100 /d put dup 101 /e put dup 102 /f put dup 103 /g put dup 104 /h put dup 105 /i put dup 106 /j put dup 107 /k put dup 108 /l put dup 109 /m put dup 110 /n put dup 111 /o put dup 112 /p put dup 113 /q put dup 114 /r put dup 115 /s put dup 116 /t put dup 117 /u put dup 118 /v put dup 119 /w put dup 120 /x put dup 121 /y put dup 122 /z put readonly def /FontBBox{-53 -251 1139 750}readonly def /UniqueXX 5000769 def currentdict end currentfile eexec 9b9c1569015f2c1d2bf560f4c0d52257bacdd6500abda5ed9835f6a016cfc8f0 0b6c052ed76a87856b50f4d80dfaeb508c97f8281f3f88b17e4d3b90c0f65ec3 79791aacdc162a66cbbc5be2f53aad8de72dd113b55a022fbfee658cb95f5bb3 2ba0357b5e050fddf264a07470bef1c52119b6fbd5c77ebed964ac5a2bbec9d8 b3e48ae5bb003a63d545774b922b9d5ff6b0066ece43645a131879b032137d6d 823385fe55f3402d557fd3b4486be79011d1f5bfae5c1f476ee6f05eb1d2caeb 269958b194521197b312fcced4867f3c8fbd030bd715d8ffda1dcd454b174e7a 1a97b59fe770e67702519d9d9b23d61ac08424d555242a8ca08c49aef300945d 99b999a79ce74804ae6bfde623f4463371442f6523a5f6ce19c839a708c02513 2e22c696c8ccade45680e5197189d0f98e7f0d5f955e353970b392cf530a68cc 56b0035ddfbf206c3074beeb0739dcbca272a6e629fb7aea2c5ba7bae50c7b4c a595df78200c352997ec3ee564df229fbb5473f5e8ccb1cc0153e9a7e299a8ea a29b69d1b622b1f0cffc58291248759607d91150cb0651120970dc9f743bebef 44f6ae92facec57658999c8bf01f60611560043962c0695e1bb87d090e0fdaab 659d6557208a660be9aeef8ae55f71b8bc76394d792967e41bd8023b6e7f8c3d 9987d5e54c53bf2bbb32855b946473b44833bd78873df8e4c7e668ffff25aabb 8da4148f744b9d0524d6cb8281247b3052cc5d66f3f1bcf8a56a3fb446ea587b d8be30257652cee035628aeddfd8283b5ad21b8b1480ad24d898970ac8a1e33e 543ce4e3c48f9ee621c5ce3e8ae930f890011b630866c988606068d9e92396eb f51bb3db204505fc3d09d4701ac703a14d92bbfe27bd7411b363a88e33a8e9a8 025ac31f21e73dc52b333b918d0b1270c54873a490222d041a66e0192612be6d 2c88958a8f70c10390146ee5091df020ab97675e8e6901226eed50125d36c221 be8f20647442444b13f0325f899b8fa15e1414119b45f920f73dc3496f6de0dd 4418a1181e791b49a52866c79d377494beff7f1b444111bca4fc2bfb7279fa29 38fa9be2de762f20d470813c4ee0034371812efb9f87014528b7a09be4f01f1f 84de922d6c66d7f6ff96a49233b2396d9c19b85b132ff565893ad3a11ddb88e4 69fc1decd51e5b3fadfd1e3e50914839dee5d5d2b63f83e8a7953833efe2492a 30314f32e2bd9a758f2abda8107618eef886f13905eece29e3a0267fa506a772 71c89450b6cb4320e4079ad2a46b0a9e74e7fe0a323da30d5a3b4b7c7968d43b 4b6502e3372a4d83bfaff127a895c967e55e7abfa869149864eaf1e03436e72b 704733c1ee132837039dc199b21fef28006d38c3d7802c330b93e544c59dfb18 e8b7afee57073ab6d51f85d4d5a9f5a3faf2059aa99e44c968b3223876ed20f8 141d8d539c147ae02d18da03332266e47702184fb7bfe1d1c56710c2e1c1ef57 0c71f963931acbefe170f410b0a49427a1f8e8f37bb1795c90caa175a0f97a30 077908cddc1bcae73e360adb1e5e1cf09c66f970fab9cfe9d547d0035b30d28f 2aec9e332c302497770f8cc8f2e5b73ec013e1a3a613b28331e16c20d41e1f70 ae0ffa79356805ec518a26b17a7071c0f1914919b5270d554081fc7a7793ceae b97fb0498f91568855398abb12603ed1df85be9832333ce02ba2bc920f8b6be8 970baf7dfa092004b424566036b78b63c440cab2ecc9d56429c990232eae157f 5cf731dec917c65181dc3e8845ff6142f3337dea6fd9e3bdfa3b12a1fb65a174 932e4b31a0a2695092a2aa3951465f2ba0ca12cf671b4ded9fdcefacdddd2796 3d0b4670f7f9216a276aef01b6574261c9b6e14423f3825bc54e8be0ed649041 c59e52e30e95fbd3030a16ae4d91b1c0493f95cf755e71918d010a04f9aed4ad 4456b78d086f8b96e810ab8254b15273ee5b73c3a7740f8a0b8784622b78137d 729e62b5a80d29a3f7b6d3192df6e5b47f0e8ffb2263136c5b40591c2a294526 c69ef41033d1b7b72fa6f123e87a2544cb8c88b681c4cc0e94c741f77c6658f6 d81f0e8943e646919ecca991c75d2da1fb65b3bac1d0c2dd6ca0bd8f213cb1cd 1e2adcd989a8486372e627717eba13a116d141d706cb894e50c6b3328b8a1ade 3f832155ae5f8664972532de2f3cd20661802098731b756cf57b0faf37cf325d c6169de31f8b2d0f6561bb6d6d39e2d8314161b6f68b5d0ee99b42b8fd4322b1 05267e49e3e22fb5404bef65d72d8dfeff5e80e62737e1128031ec6c23de479d 55b4ae6246b55e6790722f669b54720b0fa9f24d6b66ca6bb6d57e0ca46156a6 de6338709ea1756d44d0bee437dcd992e269d0dc053c1c410d5bb35f0d3f061c 1b2e9e0a6db95ee0004f7e777a5adca140fc1555ee1eeebd56f5f149ea93ee93 1f405914180e7ce05c1fc852fdb1c3c5153ae13c72ee934727e5dca0a33f7ff5 abfdd8bdf01ddfb2e5f694ed3576d8e4bffb1411f50b321251edca7ae64496a6 76aa0c2c9b6ef12fa48f1b1c9cd5bd883b680ff701dbb789f6987390ec40a160 3c15abeed01be65ebb2aa4057db68e1356853a267b21df506dc9aef6e8509c94 84adf2771383a691f7bac8942972717cd8c464a129587d55053652ec77d132e8 e5cdcd9bac45f94d6b587b2c03caf6d6278e2e39c66fbf65806a877324c4d041 e8328cb8dd276754f01a220be3b580de92fd318204aa2e73a4f5e5f74b4db81f 3e513c75d08d505d2e1205cba6a9d432fb1024262759e197e504083fcfb27e53 592a6d1ff65cded546f955e4f8416771af93b71c715c9e8290ad7abb497aa26b 0b8a2a0690adf366968405549f97ebd536f43efd863b166c5ed1c552d64ceb83 a737a653289139ac7bce02002288ce2fe49ebe614d4b8e44ce2b817fe8e8935c 7b8efa2add93fa5edc838ca2641f173fceb75cead39c3ebf6898db8c3b5a7a65 631e325bdfae94ed7b64916ca6be20d0404fb79587fe07c7f432bc5a02327ef0 d5235623c30577745a88f2504049af3673ea5ee3a609aec07b9d3b66683b1842 bbbf26716fdf2aa3b9a00276f3d71fb65229d4b221a865030ff5a4ab48f15d79 6ec471da6b7924c99d636fc291c60266a50f61faaaffdf62e4847a385923ae98 0bb68434724f60593ca4d800314a9fb742e414f37db7a87f57f7077d23f30889 0d36d9e36a7c1dccbff3b727a23b3192046503e86e79392a441dbb81adab3a83 1dc50bb1cfaa01638d412e8c1bf04fa1f187d4d46ef6a1648357d264dafc2c7b 2baca4f9f081b5c3a32d3d949076b5b433fff372413e811ecda0b87cd4e5ede0 f539bfb4e5e9315b380253c6f10266d66e610912512ef64bf1b1fa81b248819d ec4bfbb144800ce77718ca25941ebd251e08fb7dc00ca7b55f6a5cfd6b48a29b f614a8fa9586071ee3b96aa1ad3619d1b56a273b50d459f63729f10b7913d05c 44243b273517cb6ce53f68e5a278cfc9dff58dd922cc2e47a8cba90ceb5e1d75 4b2093181e8343b22057728eb392ad8891858379bfd455b90d76dfec90669c56 1728f5de8442f526664c1ebba9cd1a7ec547e1dac78e405e094d6a21d098cb7a aedb95589b7199ea00a753a1a3adf348bb5a42ba7193112e4ee1c7d4d1f22c23 b156682d62ae486e4dc5626311c39807ca8770d8c7221db531d3d8140e2f690c f6344036b9e2ef19daf3ccb9e7d26bd066971f7a79d2d4449b00898eeacd8e33 8c48d4589d4abac0f45e1627a4f58fab7e088d63285fb9daf9d1b5edd44820c4 6f1b1f9616bf8ab951d9048bff27bf6d1e6d08913322ce152d25d53826876ddb 963f67fce0fda755b8f56244a7951cb8b00f63343574a268068d1b690c0c225f 807667d2db9c133e0d816f9f18b94f8ad5dc51c1364804ea4203605cd2ca830a 0560662c5f087b515c8e3de1b9da8c66577aaf3f34321cfc246f32e4a7d64d57 bdc07c3df11c929d9ee75235333499a21e779f06104d574f2adfba6c4ff63904 03fd79281d007f7739b0273034df63bff9f0fb64da00db8691a3b3e1c8cd2769 8f54f2e06ac067eabfc80e795ec3c3255bfbe151b52f87a963a510c0a2685665 ce657146ed8913d523be0db80aceb675a3552910aa9e45e4b3443653f409238a ac8f549ff775ccaf9e77b92efe51b801f9df1efd8be30585cb67cd2bef989c89 17199ce0574ae0ad512c1f03f2f0aeb50efef1e815359b3e0fe1c1d1bc2c1c96 129a2661de3f35270725629e9997667b50307ba071ea544b8b3a9704951af29c 2b1ea8c494dc1753c0d92d28f1ec61581a2848e01ea6754ac9bcf060a8372d6e a7da4fec76bd2d3bc5a9b2081d1ba9339e880ab3eb821c4e2a5de07594e2549b e939c4254b665f12e14fe863dd727db1dd713a2457d1460bb016ba7bd5a70614 a53e78f2fe512f086e0ff720d3d5adc4b9b9a6909b038c0fa9d8cb393d48b452 ff445b24a9b9edfaeca0d884f5155d2d4652f7ef53796a815e5af4c3c2536497 cc37f909aa942a3e9062c670963f37fba0ab2d7306ce9605b27a2b8833ff6131 d4aa5f6711c016e5b769a343901ea5d189456e8128098c95d0c392dc2adbe605 566aa1fa706afc0ad09862ec6e01d8a2c3706763646ce9c23af44455295e0e43 d65295f76a97cfb7bf34bdb10148dbe5d8cf43850fb5178f7bc9e80eee4e2956 70edbb00bed823d713bfb43e84194ff22a9de467fc4fc193339d05cfb940648f b5666d6660ec04f7d163fc05e6a0e00e1ce320cf1a598d382c6b5144181d4277 6f7037cf8b24e04c01e9fdefae1b1dcd2369354d4c0ae63abcf96f52ea7cb60e 6673b6dc9f64fd28fccb8b422862583d61b214775613f8a3309e921320fa710a e1e5cccdf5dc3f78e15f3a31ca53d6b2efcf0167a28f16ba5bab0fd76ecb6e70 d88f37bec84ec687bef438fb792abe5b315506796a736be6e0d6906f75ea1e0e b7c3b972cf1e6651cae74fc204ac9cc7bc51726c0aa3b4f7c9ab7c502f535b46 96c8de2ea4df3b02896d8b407736eb25c18dfe2c8b00b67e3440a3ff35add1fb 1fc3fc133eb1cfc53f0d33513c4bbc555c4e2945f9e664b6b852c2c543776af7 3c926db408da2858bec50febbd3a130a7ca8697c6a9c8ee1a58402d640e043a6 168166d0f69289fc411df65d16f59658bfbbbdaa6739a2427b5336d23cb723bc 3798cd30a0476c041f69deeeb0f5ece049c8b2e64ac56b3402815e4c32c45907 e9811b2898aca46c1a26e2ed47c068216cdb769c999a2cd8849dd8c99dfd7e61 67896e8c1592e0101f005c36458c9e96fd99f6ea632280d31f29ab5e536c2b6b e260d22d52318ab4a2a6acbae4f4d64a93619bfb1a58790ac09fe1db6b60ee0c 64922dc4a00732ae4c897e5b36df63043614574a4687eb1f2848796c60d3e684 a803c22cca80b1eb239f3a2be003648facaf3a54072f4e825281fbcc312a88d9 8c1d4b6237b93deca7d47c2627eca053e6107a858f594c4b632ae3247c985245 9e17f1d2b0de9c13de5d17570ba3b2e28cdcb4531baac40a25df05d6f30aed2e 6de8153d17fae072a629fc8605bc9005497cec705aa765231cfefe6040d49911 2554af23b281b0972bb2276517212fab23d9ce382a770ff87e797390ada1ed35 f4bcbe03dcf3cc5dfe43045cc45ccd073f4d796e83c71426ab23bda6679997f7 ebddcbd1e3c8b5a989f42ac1472f4c174ffb878d1291d3a7df9435c8fd04a183 94422a3ef9faba355eb19b20fdd736b43cdacf3cdeab5d3df2e42dade62448cd abede343bd6b5ea04ded6280432a23ea16e82dfd5f31c6691c712d4f37504b1b 15a72b449a5a4c0afcb00c5253ee83d2923a2bc1f68c90257707128fa1706f59 3f63ef3e1068d4e75e84a64e22096c6278a95a86c4fa01c2fb2edeee190840a8 32fe2a4dea4b07ad8555e3242b4dd5409623f1ee9c3997661de6f0dfd25e32e1 d7488e856c05c54474dd7cbe9560910f53b879e883d6a5150f33e0b9e4d8d7d7 a51d3e7b6c853978ee760b8742734118efb02088289cccb760c3bf0b2cb15833 3483ce5791f55586fafe875f4b12f3e0e3f1086e18d4e67b2116926adccbd781 b9f32dbd4f3a1d44691e61302346207a9505bd064e697abb3388a33c46938550 c5fdbfab7025e4bc6a25297d06e3ac75a79b25db4a7c8a8b20cd977c9c3fbe19 e5f87398cafdfd9f3b8c3145078340d2187b6cfda9384762d998ac7db82355b3 4b4c4c9cfaf9fd644bdcbccbe7af3bee8f7e42741e5e1497533ebb0aebb7db92 a400fb7ae61289c21e61afd0fee7c6f500b434f44dae39a4a061f357d8a7a318 f0eeafeaa23c3af6dd6cf98e0231741321978686198edc8df9285eeb0c3913ad e21ed892438320e0ee6829a6c3f8a953061fe673446cab06a81f1187340d8c23 2575dbb9d2ab6061cef40ff3b00dd24acb57217bfd683d6ff85a8be185383ce6 34cba24ad65f468a5b72c0c4a11a3837fe6bef538edebf95764da8c44fa86dd4 60061a5867194f8a23c8e50a8f68a7b94935700dbb49e4706ec6d8b88602fe81 a9ef5cbea7d75ec0189d621091ae28ae4db540a5a5638bb517810cda503c529d f4086372f7ef9dd4fb6cacf04a100f132a516139a337a3dc6d9d7bf787876140 9c38e3b93e014b1e08f85c156217dcc814092d98fcf28f0f56229a4307e13578 ff99d574baf7174536796ad77866933d03e9bc90231bff567fbe9f17aeefae9a ae961f30f5e1acfd38dc3b824086cb427a2c8cdb2cf2a24ec967e645659d93b7 49a7c3c6a2646deacb5179856db1ec438b7685d977f7f7598c74073651aaf1e9 ac4ad6718a94e57865184f1e82b0825b8c26a0f797322b12c64a089705883245 cbff195f214c83144358b237cbc1edfb4825c3460441b8d240957c2bde8b011d 189ffc4e43e52ac8a2d965b49b505dd164d840e736ac266b92a1ec688a95718a e27edbf65d6ad3e78c1b264f2ef71ba154a35a097c2c38880ed13f500b3d2f36 19389f5b8fdbde4e14303f9fc729efda5e0112f52ae3ddb2e0e51219b2623d5c 96803de46cac9f212d61189519b3015219fa89a00d4c6e1ede153f91310f07bb b370882e3a803abe6b3095b71b8fa23bd725be780ff355506098781dfcf0e4c0 395a9ad60dd426100dd7ed74c6aca6d52ad0a32aeab5ff69bd6af3d528c6b540 4a560a74ea5ead34123f6c8329207fb3e4d8fc8b433096a39b7af54e2505255b dac35f6c5f879a368aa92e5ec94833eba3288afa542cd7586bba531727b7eb4f 8099e1893a0baed4334e9261c8bbcf99de3e2098e170bd26240ce80f8dcda7e3 a5ef37525ef56bed041e2348a03eead0eb78b269eb08c38aac0bae0582a71819 f771b7cc29415a7b55d8c22e9375f78c5072f698c7be3e431df44fffba6e5ee1 16448ae78d81c053dad2f18617c4dd207bd44638d76cb014a123b259d3270445 50f0dcdd5509ef0fef6e8727783e8fb9523b18fc10a5d52168f17fd219fc774f 76d03bee95240342a3854b60606b146349ad39c4b687643c43abd184fa3ed813 1036c4e0b9766d7634926d3d8e8a56868c32c26652535a493b02753bff0d6c34 a6d390f6a90a3eed3e1aeb1086f4ee2fde9618e651d12f74132d9d5f4bbaa75b a49a933bac72a3fd855e4e6e605fd33e742c9ad2e0079f256f9071cdd2a1c782 16a932e4d007a5f2dfd109f4678828ec34c0607f3384a968c3a32f737f075edb 4e9be116e0b9a6442a4eef4b33606f46dc0191894020e5eb8fce66a2c007db11 a0df99f5d4df5c726227b300df2368fbc06ac032f9a8e442e7d9901b963708e3 4a9e0f2bf62e396f07ca20a9be41701754885d45713d358d68bfbe12321e0723 ea7c366fd3f98b993ec656372241c3d19bc53850493ba6601dc337084221062d c82e70d210bac08291c138e80786b45f03c17c5706df8a844570b8709864fe72 6fd8b8b0e88200ab060a5ad9d08bdbd0a516bb5504bbcaa650bebd3298e2c02f 2ac5b41c0f5a3e1ef1dfb088efa5598c7cab39266fe333b3e6e0f327fdaec16d 4ef179c8c82b7661b8aae5f057ca92383a6497d36916e073f0d0babfa4c7d02d ec2b50cfad142733461fa1e55af0d7ad1f143c944a8dd0082978bd18ea6b614e b0feb455ff7bc93b458179d2def244df128ade1270ba29dd14d220379d6b4d0d 2dd570dbd1f5d3d29e69249432b2079b694fef0590f65c1f4a33a5fb1e6f7dc2 54d8aaca31c6a7a208e62a46d44f52723fc63f65b07c9058998a850331933bd2 bba0739aa035e6788457e25a9ce1d0de2801a036855154a24b80e56fcaa9ecde eaddad23f6ca8e6d1a9972aa5138239397d5ebef68f98daa7c582247ad8cb0fb f88a7dafb21c70cae32720ff10553777026e6478a25364864e6cc0351b7c8e9e 8aa935550fc0d3d93bfd19e8b0068cbc34a3f747412f226be2d17454cba5858f bd276a588202fa2a60b86bb9f7a6e6a6af635e0e0b2bc6a43c100e1b73a66b08 1f8fec0c1dd055457990f24ec216020ba36b04bf60e93aac3c16ca4ca26f1185 6cb5feee30efbd00d7ed2d1935a88dbcf101c82d346ce0c9667bed29d7e7a092 a77b769747762d8b34eefac117187b921d194f019c4ab9a1399c7d0fbd8b2101 14b296c02c183ceaf3b88866575d91d50720a008a87701927dacb0ce4b943de0 3b39457da169256d6944b494800acb778c1449af8499d36c04b6d41b2595d20d ac79f2d7cb19a5a57ab1c4c76faed91a7dd2b179aee95a988f6beb9db552f150 50607c6b0d23b68730a0a959781a095cb2a84e150d20558d6bdb3c74445aeb66 639d399b592e848a251e38cd7dc03fc0049bde4295b081afde39d96fa1248f58 e0bbbbed1be7244906bb47ad48f0dc8c18f76fb1b487c76d2179da67505347ef 6994875e02935fcf0436e4e7e0e53297c0087f716db9e9cdc5b4220de1a331ce 056f87b1e2ec1cc685b3f0ac589201db25fda3ec66c2d6c7b100eb0675df22fc fa8f03efb1dcad7e83c67009fd5121811082f989afd29cba85f28d0b56375fea df4e6073ff3e672f8e61bc20ee2015ecff6733e7492d7757852f1f5f2990ae81 d76f6224634588411bc29552a4a5df915e3f0847d232637083ef1aaefa850bd4 feafd723c1881527cee713dbd6a6b9f40bef70490b055079885c2e7e76786dbc a3f13b56cfdb0ed1f1582829e7f9897fd44b1d3026b37b08ab5234710126f4c7 37412b7d0f9ee6c8ad1e4fd8a5efcf125c96df71a4e21e06f4cfa9390855055a 3d6247799c81f5be252f4ac691ab9f442819aa6e14dcd9d05f6191b68f979d45 28c68f6ed879234cada4a4bebe97a256cfdf3efa1a021fd9d629dcf8d9b6580b c3515c706f59170b5c43def58d9224a4b0cccba680cc522632174be0d99ce92a 8bdddbf606a23829c2b9c4aef789468bf6a844d0bd5de6ffc3e0d923b1338a71 1d4fe2bf8a26fef4e1828b7a6989b76ae14a2a8642addaeb5754b3cdb50e06d1 2e3229101532317fbfbdf4fb5f7bceeab10f1576f0dffb4e18d216d501537b83 59f07314c451f4f458ef437e40ad849f182b806cf7e9086981991a48965dc346 dcf9281ff5394440f2b872fde9d0d3a2bd7cadb4ffa4163bb10926e9b19053fa a0b91a831cbade7112495bda6a8068443ac9c02dc641fc6a202e961a35e42817 66f67c0d8b78e3f397c1344a08fcc5e02a4784064f8022327be80e740b3c5f58 2ef29bb8e96b9fe475a718f22fd743d8c3b96597ffedae7cb28f8fd3b393ef62 0658fb6a3880d5cc5cb94af14a67d704535564b0e4ef8498830daea3c2d340cd d0f8326205eeabff34d0151db64916a73ed4b23e7c1d7a971e529cef0838c657 b7f0799447a394bef8232dfca37b401fa150a6fd4d0bc45c8917cc90aff6bf07 9384e97111c2fd00f1707992785f23b57d85af6c4c93fd97761e46ec4d38816e 820ca922964f164896aee22a84d0db313bc7854b52b26128dbb17638174ddc17 fcd5775f8229f0bd3edfb48e6efefc4372fbb9c5262cfeb037f0b0fb206bc7a9 5b3f2723629337d8e1a835104f8d84fe1e1dbc321cbc3408dbc58ed887d96656 a543dfc89ce7c787d50c61c1c5913d6ba67acafaf2b56641146fef18e43171b6 455419f4b1c3dfd688554e9dd8bd7cbf23aa127e8a98b77163850f4d2bc35e33 a537f2b94f092af6e6829be439eedbaf4859ecbda0b051537c311b0b596c4029 4f96fd8f095a1afd34b7c423eb4a6f2618f519dc3624ca2afd84faae8d4455de 4178079841ed697897831adfedc3e55a23ad163f3cface19d38ec58700f66c24 fb0e9d91f53a0ba73fb3df353f628e4d1a211e086557871bb92009c55ab0a716 f1ef1bd0fda5192f4bee28ea9347e7afa3afa786444ccf47a6ead4fa8b22a8d5 f1c9f28a60ac305c08cf70d00c405b65f31b4a44ac15ccfb077d8c4b3111c2f2 56f859d0c9189edab35bc7a7bb97424da7011c8c24caeb28a5d6fdefb6efae8c 643cdd7ee75db87d106ec747ba117a677c3a0b09249da545d99cfe8bc453299b 16531d1ef6e55fe82ff69547d71ed137ded9c5b0524e37badf1cc4c3854cb056 376a925d65d838c4494fc7d5071443ac18a9244e23ca02a478192fcb3d96918c 927a879d76a41001d14db2793a5f34a2c59dcbfe73062f40a1b86b24feb3d1d1 3cbd8340af5f8d932fa34c9a7c8b4f4a97754a1b4713325510de3c0cca824dfd 3fb411a12b89d5ad31c2dda157372f2ad95f6b42db72b6c1b6c9400a6c012179 b383a778f6ce992fffdf4e72d5722b67662cc76aed77cc6d8527221593d5bec0 3124225d2e7c30634d0d60f62a22d72df43e13af0c1769b625531717fe9dbce0 c54301ac4bb059dae47c454757a0afd11662c1253505a625ae9e03064f3cfa6d bb5f8f8ec6d90f927f3d02b53810a153bffe1a65bb9b81d431d1ae04118ce41d 83ef2468a975186beaf4ab6c4c939253f255c3ec4188af8e96cb03156acd149c df6230f2fd40a3c121071ad36a9954e6d27b5155275bf06b396a436e952b8971 5d9bb34bbdd9f5b4100dbb3e0ba41e7b5c55aa390ee77f282f1951af8d6c9c99 01f0a465a6abda05a5ceb52e54676c02ba23396df6873f68803bf5a870e94b33 cc2de8974db8ca0305a08bb8945c54db15225238319833f78c5983f2f6d5339c 158911dc6ad46147b304a4cb1e4a5a1da6a5ee636264820a3e8831f3a7cf41d5 fb6a3fde18e995404bc014d477266a3993c0abb0eabfd788192917aa79f422c5 0a0a78de27940da86483bb070acde5942f7aae3124fce71462629235c581460d cbd175532f75c418b52e22794c2c15bbae238a18be6e868ed4579fbfbd94fa9d eaf5c4f84a9af34246f61240bcf9ea31c461bdc2381707b0c3489387152b371a 5cba639d691ed6fa19a9a4a46e27efcbae359a0661d553ba37b87e237a3e5917 c4c228eed900e91720fa73a072b874f15da1dc6c79241d9db4e66662235a1f44 c5615e90c60973b875e983e61d0f8c7ee2911386f180a497f4a7b3b4d614c85e d0f06ea0f92fe9a48dc0b064bee5d8fff94226ef4972716b19cddef86c623a27 fd94dcae51f587cef185f54e7e7e8f9508c9d048b38df1383ce13588cd4dacb2 866edee6f43f03fe1a048f4a2d6d3c673dff6c46df310c35afa0d92d5d334f7d 5b11ee971ae161b237921267e28ce9c930553af3843f4d4263285f25fe3b1619 02fb2c12ad69673509393e0b79714597f52a3a66f87a937107f9993d00d2e5f8 59744085e11fe2fea66fc34e72ca5aae753621cb395d7664e2038a871d242ec1 e45e54dcd1c545d6de5d741867f10da931781c95ecfe48b1af399dbf0aebde50 f20d3f5fa41b186126758194ffdafdf639d92d58e21fda18eace7f2b046e30de 309287b8df89e264bab9c5fbf97f32e58cbd11cfac9d70c532cac14fba32266b e3bf294bd46fa62c2623db0550b3842fe5eac6970d8c3d81ca0e828697478dd4 b1ded234e6eeabea5f07f0a93e02176a457fdd2cc073b9a95526f6cfa6cd7da7 016f8374069d20aa3afe2109bcb00b70e7cb750a1b08a32cbcc42f51c41a3a48 4c760c830f9bda8b4a3683cd941817ab3f7d9667e6cd319356a0d1b0ceb965c8 a2bb47a4f7f48ebfb854784ccc2db07b9fad88e4de2a3d62d9da86ac0b2fb780 4e8a24a109c1bb3197823266ff4f84c0d87610875d0c874d6a988e30cea069c2 b124872e52566930af7f7c10d70ce419644cb65f4f87f77da0d5eff29a5aa89d 0e8fcd5df45605ae83ff57561f87c2d74489964d9959e7e4596acea918dbc67a ffc185f091aeaa99af3c483806a27b1705ae2204e9c8f48606ed5c40d28833ab 0958c79cade83db520df5a2a2c32900acf45319ad17db7c545793fbd4d21f2e0 fceb4071992cd592e5e7ca3bc2850e21d782626da5a66283606023e342287c8d 7097b3061baf6de708777a510323c89973ce545338062b048fec9c35134dec37 a401274c3b65f441dbaa481d43e4071cf7b52421a8743ecce033734fa83e0419 4c48cbd5d308c93a9d2292fc1ff14a6aee22e414a9765ae587fe3187371c33be 3edef79f075fc7964ad6f495d239b26f3a09038f914084a0bf4043eb76b84856 ef0aca90ec8a3dfb6c28ad34dfd14d9edfdf7cbe46fcf94cf1e45290b719d05d cbfc4ab20779da345f67278ba01c0f853b7590add064c26e8452a801778ed8b0 61b42cff4383ed62adeb3dac686a5bf63121f42d52f9210cca8b71bf602c38cf 855f80d0bee0e52c47c6c1eda50f1150ff6c8abd69121232130f624b31c3acb6 3049ae6252f567585b05bc65940b4af236509971625fbda5fe5b5abd29edd7f7 4d989da559e36dc267ae496e1bff6ad121c65c783d3b8dfcd6c93a53c6ad753c ee76f6773d785c6cfc1af3b7af23cdb24904e83672f6c78fb31598b93c109e26 dce1af9219314a72d34e5e12d95ca083611ebee7a2a4f2fc5df36395e3bc7ede 3cc7ec7838d864ee757aa85510a1c812fcdf405b73f6cbc48b20e5bf45540be4 c3f23ded289316dc3cea9df4eaf66f6439ed99b59b3d44a2c391643238338eec d6ddf98156c517bda2e944066e1306e47f5e49eef6e08163decef2508316ce0a 3f9e310047996ff95395268c8f248f0124f566b19b10a5646e22d20a79d72fb0 ab6efc6d474b97694b689459f825e79b20b92e513ea5b4a784e4b278524e13e1 6667fa71e013a7d93cd7c08b7387fc799d1c2bccc0aecfd060c54c591b124ed0 eabf9a022a099b9f1fe5195e2de7321e822c771f3e5a4c6ae3a554ccbe0c145f ca10c38bb378a0f0a16d31d34112a9dda45070af4588d4970ae36df69915bf60 ef31cab28a764f1aae78470de9c98c98f24bb73f6130ee9a9085271fab063db5 77573d29c1b84a787d91963766ae9461a9572285cb02b1f01dde3a8ed4922f32 c5b12682714cbc4ae4782cf51a30e8a591004e432fbee07c536ea81dbb2f3d68 637b3636740ab1a9161353db4ad3c39e6dd81a73c7059648542943612848123c 94c89d4ec1b291cc9cab3e052d6909e5d3559c2cc01931fea2869d8d9125d4db 2a3b759007c0590bf8afaf0f3ab6885e51a5845c17cb7426bfc2ec5f369476b4 cbe5e8e8b94255259ce5ee7316f98c7f3303851dd0edfc17233d28fd76d8e417 eace33c28de856e9bd47ead4b84351225828c2321c62a474780e44025d542ec7 afbc4328a6247704321f4ca9de33ec0dfaab004fc712bacf9d8674bbc730d71d c9c63248d4193e75331f087556a3bebb54108420d44d59a5abd3837cba0f681d c17679e4b002e8deb57b2be9d0d8d984c5c1ecf0193620e99b3eb7b90320c3d8 b69713c7dfcf26b44f3adedfac5400206162315e325df38d46bec5179b1f90a8 8f54aebb9c0e7a037f49134b2528744beb365c99b621c55685659eb5d7e2cf35 adf0f092e09f2582a01fcefc02b674396b13072558b389c6144d30bd7889a542 88a49ccb8c43ae2d59fb90c1f69db7649ff85f3704209b12c9da0f86e4f72880 3710de69a0782c82336340079c9011e5bf493d660ed592b6d66770396d29668a 5476208a88d5f4cd976481b16f3ba9e2dfb0c060d6d7d2fea04c34370806fe7a b93c0858cbc0bce60adfe056f3bf09d75bd0dd34651bae1ef390b7032ada3c41 90b8df3d765fdf4e9fe42c98b1ded95e50873dc05012c7c1355c38b50ea88b72 a98a586f4f4f20fbf354750c5be1365a18dd4a22860d5b5537ae9b1f3c7f83dd 8144836b07416b6ce029c7425b266f3954fb4d3235ef8bdcaf1bac3e47bbbfd9 08f0c6cb73e431f53e971293e514461e33f20fa0140888321c9c022fb7f49f7a 41c4bf3b3bfe6423085e927b7533c0e5ae26fffa500e161f980d5d547926fd81 d69ce8c62a50572ae3dc55b104ccd47d38406872a37fc2ac11b4db17188d51a9 b18b29fdc957d15531fbb247e9a51a7134d7deb90686c2b8131e7469777914dd 01269f3b377cbefc669653d77ceaea6b87adab90acd7aeb34954a5babddd010b 36c4aa7bf8fed52436c65b4a94532d62bad80a465495bf354adf04fae6c9a959 d579d897cf61c551086a7b0d8403d1d7c10c90a58bbbfadca720ff60c4de218d e2c61740fafa197d3a54fb43b0f41c414e33ac37ed88315bcfe8f39e98013f15 8762441e0b539d81af47426b866ac7799fcdf01252b82a3507ab7f75b7513350 92ecaedb505f65b8b7cf3053be66fce445f5a5360ac508e131a1d42163053cee e70ee798fe0d6f70ca291bb3170d79da73a723f7557fa7e0acb2969261fa067a e4b29e5ad84170f1d72d216ee04b1e764e8a09435c3e7a7a3ff4748477c2aafb b9d354cc92540e34a72dc5c6204748b3febde66713d823457e9d3945cfca441a eb198a90e2f0b0af0b7ab510ec96e8bea097e450ebdda048e01142148df94ea0 b0313c2093d362779981d5bbe68f1c1283bddda91cb75276446b70dceda47b08 7c6d993139a870d7fbb08613c412736cf6931af19f5255a824c04efe52b27db4 f9e9d849f9f34e0b7672e060f2313c84b517f914d7b7f611207af7cc13a48b99 b835925d60e0e908d50438cbff4ee2b6b1ef633bbbd27cf124785ed71c7dd7d1 008a9177187fada51a19210fb8c0d7d591480793f62d0c465d2fac61583dfa31 7e4732611b0ee990c2753130023d1cb4cca9a788606ab951a896eec7379bb9f2 ce8839a6829a4de9889ab19815688717f0472f2d6c559b2afa4ae8b5986c0931 d0454dbda2756884162329d5d360d956017c8ca432e72280c92fcfb8ec0be61b 729f392c116744a953e57ae6e12530e0c567143bd045e85de5f757975eea8284 fa1fcd41a540567b78610ce2b98851ed6e2ce9ffe127551ca7f8932dbb6f5bfd 54faefd287865e7b2fdf7e56efe0bc30368e80d3b5744af355bb0db781db44a0 8683a34a21283e5f3ef6c53022d5fb6ddce4a3b2a13ad6f7488a9e9a86fa4264 bafc2905dec959a966e2eb3fb80ed901bf913cb729f5f6accfe027c7921ef274 8cd760efc47a814bb8410d8bf98f832903d73b6b3311fedaa723167ddeb1bd13 e6725ccedc3109c8434936e5d3feb0333ff4eac06d45bc3acb188780407989c6 2f60e7ef852c72ce393fabb88348fa35a89595fcf07c1143ed968a87b5135229 75501e0540761fb8ee105f190776eef82ed9388c82e732a612fe334f1e6f9f29 1b8176eca46b3fe6f6d3491b701829a2b5a934f1474e69c9c4cf9fd49935c7be 0c574f9af6a92bcb86b056ecd557adf8168bffde7edb702dd265fe998b052920 186a076041df359cdd0956c8b018a8eddb64dd626bc2551607c1431c54b171e9 962ff0f9f825e7059d528a44ce51601a0b53c68b884d9c072b2f6ec7ca351505 68dbc7bd6a12ef37a58e1ab2d7e863508b1e19d0cbc6cbdaf1fc76e2a2150559 40a7d9a8a2a10064f3851bd4ae2b61333a3cc588eac0eb8d5aa949764d68832d 364855d737a9de9e5ce36d961627d4e8895662b6e544d73cd64ba42b69ea154c 70acf59ccb346db7e2cc1bdf3de6a997cca207f1d235f3a78930b1db81174a07 eee2f1ce1c83c874884f9fe42b7a45a2a94ffdc9859fa6d9c98e9795b9869769 bc845ca1db907cc84e70e198aadab44872c017cfc2cfe5f5442f93db1a14a279 d63a2a64706a3974c233a5f6e4cf2d593f2a31dac025a656214f00970ded4ea6 580816ee72714376e1735dc17a4c141fdaab3ddb0af4236d41b7fb6d03781b2b 8bee427ad3017d81c0b6230dc8e6dda9c3d5896b33747d1f9d65e1ac4b298b87 79eeae5fbafa9b404287b17f39643cc84d06975f8d8c4784346bbf54d7bc67be 3814c2e98d894c468ded1b9fe41a28c268a00e598ad0834831c00632f5485172 0237273a889c74bdbb94c156a39148139e1b753bbb5ee35d221d289ac77499c2 c85a2ca7d30bd72f4eeca9a44ffbf1e0c4a7ea4e3866ab1d74ee4688 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMSY10 %!PS-AdobeFont-1.1: CMSY10 1.0 %%CreationDate: 1991 Aug 15 07:20:57 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMSY10) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle -14.035 def /isFixedPitch false def end readonly def /FontName /CMSY10 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 161 /minus put dup 174 /circledivide put dup 175 /circledot put dup 176 /circlecopyrt put dup 178 /bullet put dup 183 /lessequal put dup 188 /approxequal put dup 33 /arrowright put dup 55 /mapsto put dup 102 /braceleft put dup 103 /braceright put dup 110 /backslash put readonly def /FontBBox{-29 -960 1116 775}readonly def /UniqueXX 5000820 def currentdict end currentfile eexec 9b9c1569015f2c1d2bf560f4c0d52257bac8ced9b09a275ab231194ecf829352 05826f4e975dcecec72b2cf3a18899ccde1fd935d09d813b096cc6b83cdf4f23 b9a60db41f9976ac333263c908dcefcdbd4c8402ed00a36e7487634d089fd45a f4a38a56a4412c3b0baffaeb717bf0de9ffb7a8460bf475a6718b0c73c571145 d026957276530530a2fbefc6c8f67052788e6703bb5ee49533870bca1f113ad8 3750d597b842d8d96c423ba1273ddd32f3a54a912a443fcd44f7c3a6fe3956b0 aa1e784aaec6fce08dae0c76da9d0a3eba57b98a6233d9e9f0c3f00fcc6b2c6a 9ba23af389e6dfff4efec3de05d6276c6be417703ce508377f25960ef4ed83b4 9b01b873f3a639ce00f356229b6477a081933fef3bb80e2b9dffa7f75567b1fa 4d739b772f8d674e567534c6c5bbf1cf615372be20b18472f7aa58be8c216dbd df81cc0a86b6d8318ca68fe22c8af13b54d7576fe4ca5a7af9005ea5cc4edb79 c0ab668e4fec4b7f5a9eb5f0e4c088cd818ecc4feb4b40ec8bd2981bf2336074 b64c4302813551ec0153be72f1f9695b56a658dabe99f86661b49303d6565988 88bfe2c6ad3f28b68ea9b83725ea102a0b9393a25f33efc29df1996ac4dd61f5 f873f5babe16171ad53ce606645dd09e9afb6d3941bdc0cd7ebb88f0212e7307 dc897d640746055a0fc6981bab986521bdb7cba769fb2c66d8b2bf75fed9993d cae2dd3294b78daa1effd619b5e105744252d0e41ac11a24552a644b187a90e1 0e5067d762da220546e283e0a38ca375ca94cdf9cca3c37f89450a014e95f2f9 ac9ef704be72533d18b372fa0ce9450d325ef79fc07fcfb238797808b5ff37dd ed1a79e0c0798874d5ca2a314861d1b60be10e63b1fdb48378ef2d895858aee3 f1e82af19536d00454934a5c2323df39ed6c9831c193249b66ab29a1f42b0da8 0eaf7ed3f12a51f59f39cdadbbd09440228946d3836fe5cf53135e8b1001e059 a2250fb88a3022252930e5f867ed844f34bf7d0540d3aa6c00c845f3278e73f2 8f65f858d3bae9c3c56ddcaca9ae53035f13e8a1256215be86faf96838721de8 99d982578a32ff9587fbc73aeab1cc787ccf69b38edd76920a07b439c0075806 fe487be0c015459310ac09081e3da7ae3321b7c946f3f82993f3ddd4591ba7bb 16496614859f0e5bdeb41dd1cd4c20bd617849492ff8bb3f5442c23bf71f99d6 423ad498624eec90f35a5ac4f137d98be29b9f81876f77d1b31db091ebca42a0 de67a795b0991833c4a3728d3b3061fbaa5dbdd3086387d28afd9a0956a7e19a 7326158fb42ec7094b126db3afa1dafb63490010add9c40a3f8019a0b0a17a1b 4dd52a65f901cc4009b9ee2001ea79baf68ac2270b0beaae4a5a1aab2b027280 cf6aa7078ac77737b19846bfe5b2aaedff9e13e96a601a1721dec1288989fd70 6b932eaeec039d8526b590cee6efd0ec8161305979f475f1e775f0e88f34bd1e 8e5d4c1c133a84fee65fd87508f9ca11613af3671a86c25ada1ba5b016899a80 c795b012043cce9a1733faac21ef05b68a8d079d3d08d5b325081536e0e66993 edf30c7b7a4849cd99e93e694090a7ca6c0db93c3aeca1370cd60ed48ea323f1 706c455679ecc1409491086e39e42738369e73dc5c6ab210701c0cc695fa3d6a 35bc7d16306dd14c08f3336a1badfe86623f49bd4b84a914c1d07d9228bc09b2 1401ff6f7c8e2d0fc96e961a2f4c71464752b4f30f7e785b7fed1be9bdc37128 138ed9a146f2eb09b301383033adeecfc418e741b66e60465ef8dadffba07be8 744d306d61b52e0dc7b9a948c2edeed379ce86b130836df6c72dcc880281277e 7c4e96bc01d93be4b4704263bb304ebc454cdba4489b032d820b4f577a0db447 20f8ef1408e256f1337beccce4f4793d70775e2e8a461ed455b7c99e8af5dfd8 9567e0e0f9b594a5a7ba77be62f8de8fe16d13e97801283844d13c635593af58 4931a77cc095b3bd3ab7e06f2d914f645ef5f5e8a821608aa5dfd2c268efe681 8d473ad35a20fcd97e0730bf60b57275fafee53a3d5bc6ca8439e9bcbd5976a1 db8347102af51ed2d61a6065261e33dd53d86a91a7f3c6c0ce8eeca9f41983b1 9fc64260dadf3db390b0ea87849c401645a09942c1d044d0bc027b7832e1c6c2 a9721b5fce6451f9675799880d4f786c08ea8a16ce60fce2c736f8ee5aaf9498 b4a5d1cbd2c6a93148c0736b12f4bb961c898952f13b5c2ef76bda3db097117f 1b5b5f33af275b7fddb2434f4021f66de48d317c2d10aa1844b226256afffd82 9f6f9bc5a82001b4a5e2684cb17c15cf913b4be7fcc3060aa4292be375c85cd6 fb66de1677d6a57e03c54fdbde781c3f6bdeb682e11ca8159e5832f93f2604dc 9d326054e781d1f2213b5dd06c30dd86e9653ad4efe3ea80ee6b0fe61f7eebf6 c1c25eacdb4a58f201527990f2e833ac958cdbeed72665b635d6090cb157b703 e79ea28b84a1b6c3e75193ce509a744b8c11a86c6874fe60c3def397b32861b7 8ec1ce727a79963cfcc68eb5fe0c5cf28296035361e37a72218f888320acb76d 3022d0b7970008dac500c3485e65be51caf1e434a013851ebb51e090982da0c8 5f26cd5a3f9d44847d06946d9efdedbb1f6ab07f43e66bf4b9d59cad26492b09 a5d1393708b729d80dd5c7aaeccf54e05cfc164ac448d8dd62c15a7d558fcbc3 dc5678aedc11a083c6a741d22d0de36e279c798ed609458f706b4c6cc2b319c7 f26dbf962dbd7c897b75f44740d950eb67bc196071fa9defcf7ec657a197152d 5d2c91fa15e64e68a0962a73ff08b3c828d17b8d244d9b131eed9e2ee3e20cc2 bc4d7af4bbf1e6a05052cbd7821ebccf18d90d662a5bd8e175d163ce44282ee0 54c96f21b2e0c0e5f2e775618d42d2fb0018267b73693e4fb23649750ff1b697 d21766dc01bc9c1519fc38099bc64535825234518fafc5659b3c7bd137612f04 73d553dbae6a1c5de49125d88d7fec59aa4a109a752c97b3577b60b74ed22442 2483a50c3c1478d2402e9767cc5730a47907a5eaaf2cdd 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMTT10 %!PS-AdobeFont-1.1: CMTT10 1.00B %%CreationDate: 1992 Apr 26 10:42:42 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.00B) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMTT10) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch true def end readonly def /FontName /CMTT10 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 161 /Gamma put dup 174 /arrowup put dup 175 /arrowdown put dup 176 /quotesingle put dup 178 /questiondown put dup 183 /caron put dup 188 /germandbls put dup 33 /exclam put dup 34 /quotedbl put dup 35 /numbersign put dup 36 /dollar put dup 37 /percent put dup 39 /quoteright put dup 40 /parenleft put dup 41 /parenright put dup 42 /asterisk put dup 43 /plus put dup 44 /comma put dup 45 /hyphen put dup 46 /period put dup 47 /slash put dup 48 /zero put dup 49 /one put dup 50 /two put dup 51 /three put dup 52 /four put dup 53 /five put dup 54 /six put dup 55 /seven put dup 56 /eight put dup 57 /nine put dup 58 /colon put dup 59 /semicolon put dup 60 /less put dup 61 /equal put dup 62 /greater put dup 63 /question put dup 64 /at put dup 65 /A put dup 66 /B put dup 67 /C put dup 68 /D put dup 69 /E put dup 70 /F put dup 71 /G put dup 72 /H put dup 73 /I put dup 74 /J put dup 75 /K put dup 76 /L put dup 77 /M put dup 78 /N put dup 79 /O put dup 80 /P put dup 81 /Q put dup 82 /R put dup 83 /S put dup 84 /T put dup 86 /V put dup 87 /W put dup 89 /Y put dup 90 /Z put dup 91 /bracketleft put dup 92 /backslash put dup 93 /bracketright put dup 94 /asciicircum put dup 95 /underscore put dup 97 /a put dup 98 /b put dup 99 /c put dup 100 /d put dup 101 /e put dup 102 /f put dup 103 /g put dup 104 /h put dup 105 /i put dup 106 /j put dup 107 /k put dup 108 /l put dup 109 /m put dup 110 /n put dup 111 /o put dup 112 /p put dup 113 /q put dup 114 /r put dup 115 /s put dup 116 /t put dup 117 /u put dup 118 /v put dup 119 /w put dup 120 /x put dup 121 /y put dup 122 /z put dup 123 /braceleft put dup 125 /braceright put readonly def /FontBBox{-4 -235 731 800}readonly def /UniqueXX 5000832 def currentdict end currentfile eexec 8053514d28ec28da1630165fab262882d3fca78881823c5537fe6c3dda8ee5b8 97e17cb027f5c73fdbb56b0a7c25fc3512b55fe8f3acfbffcc7f4a382d8299cc 8fd37d3cea49dabdca92847af0560b404ef71134b0f3d99934fc9d0b4e602011 b9cfb856c23f958f3c5a2fbe0ef8587d1f5774879c324e51fcb22888b74f2415 50d7401eb990d4f3a7af635198422283cac1b6cd446ddbcbd915db9bff88844e 784c6bf7389803d9450b0c21756a017306462c563d51ecefaacd079732f12c29 315e4b9623a5752c6f1d8145869e120d910b2644887cea7e30b15676a92537c2 9d3aa80dc30082aba94b40990b82fb1a877e805e0c8c48f61e9f2edac05b944e e4d8084ec1d5cc517aaeec5b3ea379dd011eeb454cecab3ad2443c887c582789 72355673e503affe0394fc7db31de364e4f56c24033c7df2265c56445ec63a1d 5695a6041ea1b94407e1cdb7c5635603a4fd047e6edcaeb2d0da6c9e0e9396d5 1a4a58e8fdc1578730f992435560a6e2d3e3687703ee2f78f5896389ac8470bc 806169eb01762e89b6dc9adf857ead656620e2589aae722c37a2ed7a2941c360 b067ee34d8d5ca3bf68db725614d936bcb207781f4d4ec2ac67b13a5ad161f3f 059add7b5e3d904831e31c20c04546fae83ca93a35989e65c201756888f727b9 7e5313c9870ec96e4cec3901ea03a5c744754485e7d169bbc98bf872d0796e18 9d43b712950c3786257d8be06ab6080b9d9392313298327549a8a41c00a2cea3 690b4a333e45aa815a64facae1c2b44640860b8b8687afbefdbd5b4a541a7251 4ee7d3e0752af3e96a88c95d31fa16d34ba2f02fdb0088b165844f02611c734a dbcc2037bf741fdea7e8bcdc130c70c33772f777d8bcddf4611db99001ccff14 d7af2bb05defc3480bdab312a0eff2f375afb4e0df2f803c594b7c93f71ca4af 861ae1711932fef19bfe2f9b7adb69d68e5a70ea4d1a3d5bd85231b16993f65e fb37a0a823f0542f8c2340a073dc1be4a8347f9d3068a6435cd8278b0db1809e 8af9664c2c989b9f16873c009449b6284b85da4dee11c96a05ba83292f0edbd9 2cf674aad6ac1a5ff966ffc37e88a66048deed053565b55ef6bdb8c2f2f67832 f8939a32442ea54f13d003494d6350a2864b427a9126a9c26a031909fe53fa84 63b80c3ffd536c9a5dd29ceb03148dbc24c0033aee72ddd159f2e8a6fc113f42 8070eb36ce5a38a72ed5bd94d81ab4daf08ebd42c8e5bc695622e02aecd4004e 6cbd7c6d6f7a74d9b1997b36df5760f9048fa0ee0df6d81ba0b4ebd4e63d4dfd 821c5a9de281ce9ed399078f6059033f0caafc1eac827ed1bd0fe1a88a05000d f9e3de5adb56001749069c096e21756dc5beb9d435cb9b09c4e26de2e74e8b4d 542bb4b00709a351d7bc7457774f68681cfc833ec62ba5a1169e5046f1566f59 57a5a6b488c0dd7a9c84f1c2fc6d4df3994f888af24921963d03f74bd648f784 5acdc3a08b48360a2a441d5dcc8402bd982e037be5a9d8fcf665158a79ba34e4 e035dcf18cc4ecbf28aa246f64d8e2aee7576efae2cc3302812990793b1324e2 416690562e5048c568f5f4e1754acfa37e6bb128d5135fefc62a958233084082 17f4af6c4a38f6f5c745e197365c1e98da82d6dbd46747ad5781fdb148db21f8 2b1c0de548b6276eaadba888097fe7ca5b8ab972c6a02b11bd3ccc77b1b7d824 232f58efe8cdbb7c1fde891d8fb730e04b085d2dec45c4ae6d01bbf8d3f5cf1d a6f4ed9edc672729bada44ff0832570f74979823b66919a801e3cfb25425f9dc f47b9dbba4453251c196e32932cd84b84ce4658b9373098a59191cf8ee3ba021 b7c9287b30a2daaccf781bea2ef5e342a595ce2c784390756f5b8dfdcacf873a b64f5c0d8a16636bd5d080deac7f44bb1a48633d78a0deb9311c7aa649ce9f05 170f0bd13cc550a697c7435dda662a1756481ab8d1d0bdc602b147674e2fef08 755a90c40b61c18789755d38e347fd46c21c67da91ff9291298ab3f2cedbdbd9 c2f1c2a52bfc37ff627f2be78a5355f27bcc6737b025266cd8c4d0d9a74e3114 6c11e31c16b6d0402e35cb7451aab49cd92796a9cf2bb2d825451dc1b55bf368 3409ab27ddca7dd0190bc5dbb3919b26018ed0de19cf06f15177732df4212d82 f85d0cf4e09ad31ddbd50c9043cc6c3fb00917c57fdec19b4293f662dc1269d7 0a0cdce05727e3eb3cfc2a66c50682bfc9e87a5442dac9b271cf6a70b24e6d84 69f4f949853f1b7b86948deee6f2e15906940230a862d756a7e6250c1891271e e67edbdeca1a6891597de5609f7cc113f8e414a15926e17ca1716b4dacee201c 07abd6e528ebcddce3cc2c35e4a828c8389e2ef9f9e6ae36097531048e5a0a4a a2653bfb6e043314693cdd52ad8bb40f2f96927d90a0fc6530b205a4bb623801 e5500139350d04623d0572a9f55d79c08c673c054bbf4cd91579e63fbe095438 d7b87ef81238bab334a30abb10ec4933107b19026bd1dc6030fb648eda524d3e 65369e1b2530c78f7f027e76f1c10ca16486804a342b743337bfd44a5f7e9727 99514e0fc509e9be6d408a3ca06c61d4f90de3a7349979bd084bf4e64faf7b5b c37fe5f157917c8f91c38f2997d43a8e975aa1ddcfd10286ba826670647f831f 32d2174cfd53a6855369c18980be944a7f7a1e0e8cd4a578d1daf1f5e336752c 48c49c3bb5412a3b58cdb0e19abd1b2186857319e70ee43cd1ff129ad0b80fcd b38ba17fd53416a90588727c27f66c40acaea914561e3d6963955752a7a247bb a46dd47bf91cf2860299ddec28ebb4ce14c413a83c454b129c18df59978e2010 4ddb862b5e1f1066b3c654ba273bb5a294510914fbc0ef7b9f64e95707cc2cbb b4f5627abb03da57997aa591b54dbe03a46f9e1e357e21158f0574785c89e765 94f66331e5cd033550461ea913684eaa4362506a645971e1b1ba76308fa902ae 2262d1c02a48ff2bd67a10bef4b3f6e16ad11e8077109ea24898298cf0bf3069 2c14d5ffa312be9b7997f11ed92ccd4fccd204245cd11204a7961a74c42a21fb 3f8b494f015a1168ba1d6f79bf044d0c678f6595dbb06961f86f2a5f39cb40d9 76f67e689b05e520807430cfb2111f4f6b31873d1be6d5f70759c6b277f96dc5 b65ee2c8252d2c6db6e61dec7ee1296468d9f61da37894eeb4409d0deda54682 499f3cab70d3aa5ffbf2d9c4e1aeb0355b824f5062cb3fd63bd00a209c95b9c8 f2901b703afc285eec4ec774c4f8ac5ee974b12fd6638d413d82c407f4e36376 5c6b25e4256d19e2e01795b914129dcaafcfceefd28922738b1fb8445a36f302 b7876d65f35b104ff842790c1acb3dce4cc63f926cb6fee32927b498510d4e1b 8a038bbaf92d96e30632cafdc9284f74b0af6c6c6ba555f2660e86601617ec58 9e3831814fd430159530933728ccdc2c0938da5a18390826d59495fae834d078 5afb013f732c5115500aaac18bfe8c92ef31665a32c8812ec90ea880f77f55e4 c648039c64958332b32fdde6e7325ea1ac88a5890a15c665589fee665ac30022 956c0e8e6bff545dec8cda29ddbb70e6cc9228635fe686093b2dc0d24b069b0f 5c2edf17516d9918c5ea7e54ce7e303e2a210176e6d8d5b0328bfbe545b1c8e7 3511ee4a8069b64d5cf7c66636deb0bee61f7b472baf323ad64f8f436cb35787 ee9ac2200622c4feb6afbe9440526394c2971b87f8d9b66a0d749687f1ba6527 bde2a411db3ca638e2d3c3281bdbbd01eafb7bf04ce7cc1424dd92ad7185ef9f 3396f254089ac1a31948d920a964803877448cec9a494f94b06d420fb319a91b 60be129c02e247e3603eff60e78e5fb9451a4492a81abe7a0a18b82c11ba5fec d236bccfc503b32b761ab5c0b133990834aeace69ee34fcdb079fa61291ab67f f17fe5f311a72ff57c5826f49afa052dec79f2837c279f4fc9bd399af33312f1 1942b7d2610b5c68304bb05754e2c932b74d46462fd9c1ed8dbc5b96914dcf4b e77e5535460b937a7c23a4bea31fe6b70c79b03c53895c213c287547c9e15346 106d1183e317aa6d890308b4ee18ca326cb03dfc91f9dabd6b00f3ac16d11f74 7840f5901e54599f8c737f9368e8a374d400831ac833130ecd6b820c5fb841aa 9eafb48b3fb679c61f50ca181e959c299de15793728dab6eb36ae4308f873318 5404a478b7ddd96717c06d2f1442d93d4765a9cf82faf10e7c05ffdd4591e909 eb17ab1e268d7ab6038f11076535a0a07380f4f9f1b4f16dac0dcff885d39a39 44e72314c4b34daa2d3362afc02126431aafc3e9821b809b1593d1d861f5b847 fc1be5e99736d1216a957ba8b296efd38eb92fa6ab0366719b2913d223aa632c 7ef544a725eb1146ef435a0bbc7a0091179905a211059caf9da51c4e0e79aebd ec1bd533689d19c94057893cc7311be38688d62932798d5faa4c1869482b6058 bdd1fe0fb69b77b480d43ba46c908a0f4b67262ca7b3c434c02caf2cf891a248 f8a335a8f57786d48d12abdad4f74dbe1cdabda2a496dc3c20a21abc3c3bafa7 3ba8b5a368ea962e4338013f8f833fef22b77dbf72308d67e24e8fca1505b9f3 5088ea76a6b226b8335d808ad2a3f527fd7ebcd437ad8c4b01a9d7e0a87c6089 7963c338c5b1855d31da811567ef5948577edd757654b956c38df3d6ff18c89e 1d21aa2762caad07a0bd857e1574fc1343e0b9baa953f673e31ee2b805f5e337 b3576a9436a1089d9148f2f3deb0fe8fe01d2553c211e5ccc4cbbae95e859ee1 58dc52989a5a002761643be65a255c288ac99c9fe54570672abfbb429b84f13e 12a6d8748a105f7aac481f86dd61783afe31808f532c51ffe49c8bf77d335bc2 de691eacdf642e424baed077909eab5943b25e10855d5a19618f4c88c457371b 73a247269f493754faa7c56908a82c292f0cb5e6aa5c152bac555fc492fbb3e7 5fb84adfb38e6044afc6fbb62d7df1d811f192f06efa6d9e1466bffdc22af831 1e825aeef7e2dde771ad49639b97daf62d08194a90c3bc7677ce5610dc40adaf 1cb98076ef1876cff6845e79f1443614668174585769facbca8918365c2e0827 7ff1e40c236209f3c11a55405448e98ce7acad58c2d4377b366a79b52da4badd e60f695d3bfefb651d0e9a39963f51f567028b6af663c1d90e2d2fd8c308ba1e a388d195e065dd6dca035416e872f782b3686ce7b9ee187ed3104ed515d55acb fd3211d0a971a0f546dbe5d1943f4707fe67b38fefd5c29283498082a6da38eb 25c1c7c1203d09eb4df88bcfe19cb4dadd8e52c4d17820aef06ace1dfdfb7d0a 76b14bfbc988d812f5b9e28eab20f555cf99487502dcbf7ff08ad34a416db371 0ec981befeb70f175645b2af7da914a019ab38cc935531ae505c1d03e5e895b5 5ba91cc70094586d819c0022bba5708f5d8a388297c9e49d3395605c93a8a325 679b7edb4ce4f1de18cb3dcc62bccee4e85d592e09dde08777a3300ebc062681 9c20a1b8bc44d75dca90cfc1d03c64b8105a665b07a6648c50e71a5ef9af0ba4 80f86fc58ab28552b5245aa860b71afcf6416af5bc665ec31b1cba2d3b3eaae6 86f78052432291046507c4331b13b5e7fd2f8d2f1dd4a3ca3f51d38b405eac58 3acac9304106766f309defe9bec7f33f1d125c71e475507f31370121714e57b4 a246a6428a8a71a1097e94f9d3067de4815c2ed1f787b30ad5db5129d0005f0d 3dae3eb925aeb7d9798e37516b2d170807b4a274fc0ea753b6b477a73f783d4a 9b42496db3d6995e5fddd3f2c04a7ac276716a67e4623b70699d6690afe275ed 5c2de4167dc5ec7d038c9251ea08b2d8435f9ae6a84b2d3d2a04ca63508e2acf 489ddeeec5d899a0df19051bc0c1407fbfba2bfa1580f9d9822b1bc109af6f82 989339a69fcbf2f2f5978052d85d42d9964d9fc9079277355e6a7cc253803cec 0d2db32769dc51cd83f019bb0ac2606e711dfe6e3d1f5dcfc500db40e041bfe4 77d373b2ba341d36708a933e10bd71cc0d81598d8408bd25f194fd4f3454f2a9 70446adeb047f79c284cddf54315efec4762cd6165f76ea919b6430ec45a41bf 1ed3b15edaf0cb4c4d8fdae4933bea463e1948ec7c12d943ba0b4c2d59c017b4 5e1a3f2361565c941564721a00de3b20aeab76fff66e217d2bc000f616227104 785d8d94838269d0051c652cc687fd4b931a2f67b4122440ddf158c7a8c65965 3ee53d5b29358e684816075db98ee94d1b3e8acadad3419f963396e5f516448d 66cf54d676068401b5cedcc98192362a7d83abebc4aa4446fc418653fef41b7e 1ef3f37d127523d8c6d1ad213a855cc7d9ec72dc2a258a0782765ccbe068720b f1ceed36fff8dbde237a1f017f001c3db85f6646c62d15ee6d3072de9a17a367 17596915f5d16b18cb26501c1484977769f48dca70b951c1b31b45a32d3b622f fdae6d7ef568b059fab1d017158d1ea72034e64fa59c9043e3d8b242889a2eb8 3b10b99af096bd01719ae13e07a17d234bcf4e5e61a4960eb1bc849ca29cfbdd d14e132a7be6c30c16fef977418d17afac918f0f77a54d791340fed97ce9ca99 92e5691f126b0c72fcf5aeb0ea72cdefd3e5b2e4fc07257eca5f7cfae54c5043 22094802752496cd358ad97f6079d73a11f93b4f9beec9bf0080efa2c660b36c 277b3f151e778f9b83db0006eec7b78770f564b96975a5873d601d96c9f2211d 38c43d220df37d9b2e4621209e442de0e5940aa3e354ca1b724781c4045bafeb 86f6b34ff728d62a2a5ac5fef3fb4307a45c5f3db162646a5e19003920ed1612 1174356db1ae27c3557feee295fc5ef7853581541be7c6f09408d1f954c98364 24bbab50340edd3dc1e436246abe793cc42f076defcc3486bc27ee4d6421c195 2f0bed4bbbad54b073ae996a2b587be5ae23334517638a8828b9429141bfaafc b08b88575e1f5fe7967d269d54950bcf2506c3c58c343bc1c830430cb6a20f39 0fcaadc8c952afad18c6f5b4ee8a3e77d16a0696f88a9bd4e60ea6e6719843d0 d397959e9bf573567e4115ff1663986023ecdce6632bad1ada51f71788c1c566 7b9d540008f620e397c24151837f357a1446cc32898a433653562d1120df8a6a 812061bd2d397246d68378517da2ad8e5cd09fa99fcb7789a51fced68e940387 889e58f44daf564ce75a0eb20e8d95e9cba524870b9e9b9ac4134d826a0dc7b0 c0ab02308b17f6d3db4b444edfc1619809c3745c6fed66ddc1fe4d550bcc8216 0e024b9a70840b8ffa3b90410327116e8df1f5da4dc3726e608d1c75c0a74088 ac0ff021ff7701090a7332522d380e736fa10577dd099eaea32bf70ce9ab223e ec267683722191ffecca261d05d2cf5a933840b1340265d8e7a937dca11ca8ed 478782fc6377534bebd3df22d41da8db473e2a89358e3298079bfc00cd063cb7 3b2c536b193a3be77a8a45795d72b6ffd1d9512ec6fe009e38b89673d8fc37db fa9e278bfb7ebc0bcbdd79be72256128e607fe42d45f4022ac094c1d33158520 cb1ee9a5f9c92cb2894712b28f4ce4a306dd91b887388d7fdf510269556da10b bfffea273665110791f0162122691dda21070d8c68e9d12360b766e34c7179b6 0015e31c6e3817dc23a5cda20e6349dfbbebe8a4dc54d3c6849ca81faae146bb 4ae657aa15fcf94c1b95ac8df53a2f75fe93ccd5d2571c76aaef4a799a81210a 7e86288c1f0e49360a941c54ddcf5a022769e499e872381a8bb656e46029631f ebd768cac0e15cebf8b710104c864877e59a7e7f5638441c3cef85ac708cd1f8 ee34959a6084eb0c39b6d2285025cd747367beb0836575c52556cf11ab702ef1 52df3371d3e985e9f0d78607c0af3b7a71426d21363953de39c48a59527315f1 d408b5effd88dd0d8fb9b0ca705b2285bf3865a3a9b8468e4a95a404374062ca 435fbae75f756820f6a7cc55fe52a44909b8845a189628a130bb15f8574c0285 0a432df7cc5e3454f4dc28daeb36699a0b7550d0ffdf29f9912fcc64485a7bff c639e1cad8ac39e9493eb8ac2436d36ffe385a46dfff09e1730a33ed359c4d0d 1dae464d21d4d04c657f921420b113e1b6982f10225bf30e2b66969c3288d886 ceea018ffc5be3234933a6dd334929d33d0ffe3a78edbfb24a7be070d9497d11 ea549e32b642ca1a40c7bd88a0f1e7f089ae0d9b6c8cd3f18e2d35c2857fadfe f5869d3bf22e3cf25204673156f2948804253f2e6df05df703c2c63629c83b46 a8c638fe22110a2b926c66284eddf6424ec95bdff27cc21d319b0c4a8b94f2a8 0ca2f4b05a3bd6068e2a27c9eb23046e5577f20ff4499bef0e3be2cd8ea93a6d ded8fea986a21c01d3ee1248188d7e3fc9513d3e9b80f0987e3832b6f37e0031 c88e088a35d8b0c07e7335069d482d4b45e6fbe906ced7b227002c9ce0209fb5 6fd59e23fed67f802dff6aeb6e5bb74c3c231569896dfc4e3ae83f616242b061 88b0cb8c396d7c9f7392b94489ee3d9c838018b72ecf282c054b0b06603362a8 b189a921653388df7934d1212e0345f38458b9e56491bde7bef51a689ce5a264 6b0d0274b1b0d8707bcd400cc27b276d5922b892520097d825edb5178cb13733 59755aac0e8f257570f83dacec979b8b8eef12f822036f17d1f96f0938793b6b 6954eeaccc7c9534d2b3ef2c07f1a3f91ed7323f9b026cfcca04bd3067b825a9 23fe2447e51e6b1be2325a20b02ccbb3ef4cec98c8ae29b7e15503fd1b1ad0d5 610beec56ed1620a4fc068e668a9516496028c789ac36ac8ec00df0574d1cf90 1cbc078ca08abc69efe48f56de0616acc8f911aeae3647138b278f2ebc936eeb b8f7c531461a914543fb4c33d60e41d04af99f0d9cdfd8b45c8d7acfefd9a5fc 129dd52e8d9193506aa9e7434659beb0e1e971ac1466576375f8cf505a0ce1ac 45cb2a68a171e2cba02a3273a92a2af3ff01b8e9590687f32c9316324ab43f74 6bccac35374ec45ae84280427f57001b1dda3c61b571d4d7e82547e7af6122e4 75241057ab332cd4a4c273f497532673c927041ae90ddf446a4067908846b119 a0e798b0b2a32f1fd5da50f4a4e68009ae2d1913eee66c005475fcd290aecb35 51fe70f71442855a540e6828ca4bdc0e6edfc0a8dc30ed97cf1b965788dc8529 caabaa2b8c8fe6086040c87f66dcc6ff51ed0bb763bbc1deaae120255d33edb3 7c8a70ebd7bfe7e44c6de2e2c4babcc6378de7f25401fb0ce3b334da4bf30b6d 0f6239b49e70f8d544649b04934d7b0ee7d666c400d58ba77d1f12459e4cf658 2b764d9a3e0fe9d8b31a808b34c48a36f74c44c5b7763a5f6e5bcfc21cb22f3a e15fd6171d44431dd852915a418d3c3bcd46439d39e38cb3ebb1300a66bb96dc cc2fd003fe04d647b6d2f7410b7412ae5c4427db9c8759acb1b1f33ee861f37a a11e774f2ed0d45ef8a7bb32847793e5a167d1f30a677b344ee168147c1e4b21 2d2422f4284fc8796d42e5a04cd3719d55dbc7afb8ba4bb7cd43e24334c65f1b b0b38ea28a952dbafe11f472ad7806932c6dd7fd91f192ab3f66d6df43310dec 596b4e639aba90bf3add7844bb6e5d2793472fe788eafadd4031234b834fc41e a0fa3e8f0f42d2479fd9e896d3c7c32bff1dd63ffc748f5649554f72eda8832d 6fc9a5b7d3f520822684f56b6488747a9930c5d130aa30067b23b2d6fccd51ff 606a7c29345f5560bdd5db3b8c266f62e876309b9416adb2c6f11a289bbf404a e3192c4c9d09e6eab6b96a7e998406cf98213b6389bd01a8d7f4ed38097be4bd 0828a5803d4c763a7cf6c88d07d98bc4e32d1a6e1e4e06209eaa4000046d3c47 b7bf4725fa6a4fec75e5d0be2315983899f4098173590d768e2b49aed9bd9a23 8727d1214f1db28379a52b17a7cfd178e8c58133a63e063d72529d33f7e43a66 e3baad8f01dfccc7590f95b1762541e5181a092d3e0c3d7445334eb1c93adb8d 879ec45d7bf85cc844c90278de108cb3089f69ab5a00b5cab0f49b54c943cf2e 4878458b0788e9cd36cb1b458e107e61b260a7e2e55f6d6edfbbdf0750857848 d4058e2ac8c5338333ca9b43b8d61153c6457f7370567495d84c3bcb5cc9484e fb75c24217dffff05488ef721867ec9c9108def1ac4ee164e255d81c5cfd930e 726e86997e706c294b400a165cc64377247ce97ed770497eb2584a6f5c4e2b6f 6c4779b8e11e2d10b256e2a9cbe18d17b784855eba3a2949a19ba121e07985eb 48817f3d20a91baf9eed3d700e61e84bacc3c801084b4a7a20f3c31d8bd05951 7d4ecfd189f193ed02267625445fe2c9c6a35fae754b89d7783828579b2955d7 33ae2bb180640eb3a373156c03f13ec4957677893eb8f3cbed3300f2ea90bc1b 7b52afd8020f8f4f71681dfadd536cee2e7d779274d1750590041f174370a6df 61291fff64d71595fdeb9891e788d997e9e44bafbb0c51e23f22d75b5df37b47 2c7f7acecb983622f01cc077b6d49b1fd94e3f94102d44e2d4e8fd4b2068782a 28425912993d02af5e868c3b2f554fb637abaac224191c6f941b95ff69482daf 46263689fe669b23a3061fc6d67b01ef2efd021cc6c643da602c23b1273c8c7c 4c50df3dc116fb81c3ea3653bc063cbe4ccb73dbf3b0f907e9f309b39b5808ac c6fd518f4bff0d096e9b74d2c3dd38bcbe411b88f84d39d40958ecda515a75ed 09f44d1c36a7ea87a96371ada96a8acd30d888b9cb7ca5ea682fecbfa8e11a24 8deaf2a390a0f076d674e58fdcf432cafadf297e58dc2e96ceb4842149c208c8 1803a6d575ef147bbf5b6aae61b653a9d78e32254a816bb13bc7705965c3ebc7 ebbdec92d6fb0d3bad16d47717b5865dfebb9ac75409b324aa6b76d111aec134 b96cf99cb435423f328ac540a3d73efcb434dde20b4587d34fc558097071328d 0adc41a0eef915b037d8717c3c883dc0202721aa45b85e6ef1b62256a7888f8e 2a5b2f139ea95e2db659e784b2192e0dad84a6a294accdca90d0442f58deea39 c563a628683c4f1ebc7a7e803c4dd4cf492b7df22d7a7f849359a2795023d0c8 0b936e578d1336662939bd713215150dacdf778cf9aa0bb938d8aacb00a943b3 2020051b05d761433d125ca2c5baeaa294d74d2e5c6af5fa5fbadbdc33a99cfb 18f3e204189e96e1b82e81a90e6cf256723da43bf66e6e5ee2f3b9a9fc70b5b7 53dd41d20bab0a2b8811b7557ba28e4d081541403cc534c5044a733c0256cbb8 32becb0d737ddbb435348ab71404bf5a2ac2093b484f840fc7af3f82f2bc325a fb8b9a7de6c47510791cfead3590ea7ba798df5fea073252609e2c8a6b44a9cb 1742c9e251f9ed716b80702099598c426a6fff927515df7db70972d4df81e1fd 5073e596e903400f5e277b139dec948f24d89492ada5327d43128b42e34ab418 ce8b2f1ef6d2fdccfbbdce50ec05c1f93b67da216635a5de10cb477158d87974 2ee8c1e10fd7dcd1e4bc2771f5658ae05c92047bcd8fcb9917dc1254ff8cfccc d32991fc94ab75fb15717ef69e81727f8b7dda109bc32790ab0e02929cf9047d 4e71cc9e97bef7bfbf46b6479e60fe167227643fd324854e5a946155e42f1daf ea652b7b88a51e4f9cd126b6dc184cae84a8db92ad5e7f2e01bf40abd4b9377e b522b806f5a6087563b93467541937ff15db9d788a68faa9d7d7c3d0ddc69bee a560dca1cd43140948dc33bcd4c9f6e9ade8c1bd8a4d609b1d5f418d4bb48817 1695d4b88f17f0b8faa59c7a3d21f22d0dc34f899b0309303ce3b16f13925828 09bcdb73d56fb8ef52c4090fadda06e6292063ae5a3526192b9154d015f7e42e 7c40e34287f579635ee8493700a84eb2533f3d80ee527394792407db27cc1bb5 71a3bde5ceabfe039545b75a64b029a6209a0df2b08f4473ed6fc56801e7fa37 9831900cf4c8d46e386ce598c093ff0f48095fd5e0ff22d19ef57313f2ad9c69 fafc4b2dbc1548425d1c76cdba400ccb9d143e1f18f77852c68f30f20cb2c58b fe86972174f788032ad6ac52717e277edeeac15ed23fee028cd056582d606d59 594bbc6c3381ab3614b823a4e251242f9609fc88db7107769febfd183591c0a3 ba253e7e82837558e64a20ab217c63f48f53d253e5f706989e9d0ca8329481c3 422ba8b879351390eeb37c13da2e78b02f38c4de33332c2bc5c1b245cd626869 b78fad54d7e1677a7f3d743edf13817f230d6f0fb99ad47262d727876bfebd84 84ebd2e58bb8907a68350a46b176c65fe32a9e93166826e4b6d695909696fd8b b4172da202f2c16b3d92b1f89b17920abdb92e817e34a252860e040ec26ad517 44869941d9be18b5f15a01b991ddb0f15f9a0204ab744b6dba6e8f5cc12383ce 779a74a12a4f7cd59a58247008f2ec9d3921150d8310723e704ebe88eb90b422 964f8e1903c029e25d242ff233bb2abe882cf1acddf835b22e8543e1fb5f5731 a85f514e281a3fa20f70e09bcbfdd8c80056e2c9248e64d6689d1142b6ec4a18 046149ab5e7292386dff56c7773c1a14ca3dac019011f52698e6d5cf0d0e0925 b7f4e6dad74b1da23253c07aba16211436d0eb69bf4bc5b053c20e633d6c5f0f 4015421db3e0dbbafd00a63413db1f1545bb84a6b0b8ef838482b72c656c4559 926a3168cf0139c21f3b91d33b5ecb9a2182546c2cb19b3f21dcc5b229cd513d 8ea3ee1c4289c9d268e7a3c5e2ceca7d95675ab2b6754276d0a8a472f833b876 6736172154f0ffa1b50b45a32738d301af028df431a3d5588560d301798b7c33 1fc189a4766d396310adea51943af212eedc6dcc3f1254d46ffbdfd89f067119 6d516e0caef16b64e04db204c8ae7ff452989609676eabfcc302ee91704ce32c a69b77fad199e260f17484c64cbe0401d3a61e8f2323d2524cec932989e622d8 772b5b0ab43f2b34767427f307043836989e24006d92b9bb5e81dc6fa3d04ee4 66e522d1049ec8a064ac63ce1b3785946a304ede1619f985888c980e105e4f6b aaef8630b7d59a317107f9af116ac74542d1ecdefc319dc59034810119b687fa e6592b0ca83d8718c5c51e0d095ff626786605cf0a57cefb1d85d9fa14ab01b1 01f646fbbf4b0e85a2ebbbe85144be4faa742874c560b4d160f9b070a15e4458 86b08da73040d6a2226b03b6708e2058d06abb78c706b87c676befc1e282248b 0a515947a1adbed83f0a5118124e11c45fcc7b1772b91a5292e3f7501f32674a 6ad3256769c98b45b218cfad46c415766433396a3104ca254fcc8822c3c2bf9c 8c75be51cb3634fb9a0339d6c3ce94f3cc0cb6611a62e2f45053010eb2eb7039 653c0ca328feec8373517a9d3851ad6bc8f934de92a15152f861909548f411fb 476ce1b9c4b380ff59ccc22c627be11f194e309750670e951d808be55dc02e25 4964695ef0a09db76ba08655761e4df42a8b9f4923d00d491332aecfd65ab2c5 49c736dce0a9d2d875eb183f1c00041284d9f1d88fdd1ae7ab57f8b4a0df6fdb eb167010ef46ce8363954345efd2ca620ab322020aa8704ec9292a41aecfa614 003c901776376b43ce23c4f6e5789575b6fa53c607fdd9c24a3f709695b44d58 fe37aafc8840626c27423aa50ab565e4e29557e78eac3afecbaf7297b48d5481 35bb38b1182498a6841d1e93ee53da11e2cdd3abce55908c01d003cea4cc6840 217fa8fd918bd61cf2b158638cdef3e39f75601be241f4976dd705f5b77029ae 48db07ce9eec6a5ee0418ef97cf8d332c8945e328d52ca83ca0e5d51779433e7 2b9b3e6a016b50891c94c0e0e24d5cd97f1ba36c7afe023f79600dd817a2b96d 985b5009ec6a9689e2bbcf5797ce09ce62cf1b2eb6ea6f2bbbdaac0bec91477c d6b5afa020e633621c2f4b478b991ddf490ead75b65247b3755326324ced0c7e 59c43d20d02b6f81976c4a613c61e65e00e1a78c28c5932dd3f1c27c0fcd5313 709cc0edde1fde01641a5531dc74a79e8f4c9682b2848bd45c5f060126dc9a61 7376bb93751c79f50398ec816f1545f0e14bcdbcff8a3d6b9fc887b3aee9b5cc 3786ff70627b47204796bce089b3e9a616344779db2944cb47daf2811341b3a2 ea7a6e3f7d1b1d6419aa303f22c87f5933abe9f79ecf54db2d24b9be899989a8 ce45b79b33201b11301257bc7817a3bd9db94d6da5bea83eca0c96411aa1c441 793db933b739ad529a02125ba10f3083149486b4ff04ee62e638172495c2105b 2bab3c3de49eba6fee210a1cb1863ac6c35302829fc89ad2adbcf779664b3ae9 f6baf3c8660255cc9da1dd221a5ed8d9469410d84d4f51dcfc88d1e56efd4387 e3ed24655386e9a56320e4dee06107cae90b8771c4d4cda354b4d6a517261100 8ee70239bcaff757b8d9655aaf4dcc307494daca5972ae04c06e71ffa807d68a 70c18a445c774f2e26ca978c3a03d878fc92de5c72323c18076a58a276ba8ed8 34e4657dd174416b6f71a76a4fe948578016c3eda13e18708bf0bbec999c2daf 12a69d61823003af3f441d0e5f7ea0aba7ce1f0889d5dfd8b8d7a464aabc937c 14bd3da3721e3196c890693991a36a41e03c6ea3244713abdc654656cf0e4f90 1dcdb7a34ee906faf4d8a08516116c0c48189c422579077b330e234ff8007236 ef5336b93710ca05d882b26c221385a7e22f9489a58adefcd1730745bf848d42 2c5ea89d5a475fd6ba31fa7cd5cb2a53a05e6dd082f765f024e0d955eca472bf 747525b3cd3293b3aef9314dc77e312f97ba321655686f0a4192c5f23658d04e 040899ab2e3987e3c3421579e9655771246d16dff39d279d6c4f736b073cac52 c99546a79c8c40e2786e40f0e0e8ab65661f295a9949dea5db8069ae41f18b05 ad1da4b8298015cf01285a55896acc7208ddac7076c18df0c50a71472ce081a2 370e01b22a3f198596ecc92151669d3ded29ec95885b68cc745f820065056744 6a15835e93c1e623cbd17eaf46379fc1ead5eb38beb3324bcd09e7546ea9f756 05ca76c307496f22380144ef04f46ed614511b2a2261350c9969641b93761387 9b8f9356dfb0793d71539bc427ade9ad7630aebf48218e9e938b970ae750e0e9 1971d91580251affc99b885b3202a87a29617af50815f71f22c9a3a2a17269c5 bd60f6f348576f61644965eed5d48ae9f4181d14e45d6dd3042ea7419979743f 09f6c2a5059e435175af6289e6db7f302aec4f76c15c76df1ff7414d352a20f5 5d742b68523e0ffd8eaf7340bd9c560ff283d8c80921d4496b9e09ce174ce6ba b781d03a05cb36a7d7e26725b9b3b1c00c4388c47a4f9b918abfd94caa7960f5 1a7fff28f7bc672233458e7c4698e0e516dd61cfa2fee205ceec2c387b85f0db 87b75e8cd445dbc165075c8b23c010426f2408e5b2f473994c1dea1474b24cb3 481565f1d0b191c0c12f14bf00efedf57486d2b66b70a561bfeb16be5a24aaad 1c346e0d56c59c10ecea8ac21d25cdd7c35e9ebb83658314bd09d3d7cdd0a181 b3f44ee529151ebd957730e45ea8c8b818e1b60acb945891686e9453b9bb9153 6fed6fa8132b693f2518d76197de88fabcf8024777ee952feb1e830d92204a43 b0dc38573ab5c2592ff57cc93ddc8d2d04d9f3c9b408a97aae8a289958bf19d4 a0eec0d7453ef2e0c224cab7cf064430d7c0b99bd5e42319eef075d437d4d205 5c083b7fc3a034db9adb5216dfd812b3b1e233f60f79c44385af9229060a5278 4f69e5a3db50236084ce21750357493c75ac1a1af8495aa2f35ff94e223cc646 e41a827ec2122bc6af14f4bbfd2bff193c98b7fd889236a7c8b18448efef3763 201cca4a53e6e02b6d80b339460ca26e4f2960a9d239733e4191a3a4f306add1 3998a59a4b6a332b52e31008007e32bb53ddedb070c953af1aeb21a9deecfde9 cc82de04c93bc95705cfaf7a45ce400216b0157724d925e99becd0d5dd3327c1 b98a2d707b990265af22b325f6fbc274b55ff14257b8e3e7820ee8344de2ee54 6aa8ab09b47eb7d2a5272effff2fa7506bb8b9f280d3e9e54ccb7b36eb056844 5562f783448b905c842327e4210cbd724cfdb8a3830561623a8c135eeeb6d66e cc78847761bc3ff0a1a77f9c993bfe73b624f1ad2cbd0ff88920f2f9ac5115c0 e0b1a41e0ee48b1c361cfb017aeb2d699be2423d2bc4b4eeac5d602e1bf420d4 e82fad8c8383a008003672a6dbeaa67761a65fbbf26f1a1e6eaf7b379c87ea60 fb9543d720fc343c86128e87217b61265ff1d0d521d5174427c9b0fe099f745d 0301d948993e361a903e55db2f8881ea029e072d5e7299ae6b14e1cc4e9a1e41 fd794519338b2014cae51c04ca79b655e4e82e063d5c0dd0762431797fbf25e8 f23001affa8dd702e8602d9bdc654140e7b218e1a835022aefe9ea0c9a1fad2e c4af03ccc65ef786ad0e82aef6019247febcaa78e86e67e52c285bd887ae7290 b94407348167b377b8e5b2195bcd1af995e43f9de0271894661334d4fe5550a0 9a91b5b14fa338c8c0b80ea5fa172b8685ea82b1bce7671591c279c30624a6cf 308c513f7414fb013609dd7f0bd116d6e07981b059a48d480c4d94b6ba8bb5dd 08bc90ac7961172460373218bb97e47fa65ca05e870156f90f63dc09c03dcbf6 0781ead3707d1bed225f35d09bf11e655b607bc311ba55152655aa07a1c0c991 473fa9f1f87e3877279164b259f6282736a67fffe5af7f23c5dffe059d7c854a 2ad0b98de7f77fa4e6547873319b17fd9409cbfcfff45acf56482feea09ea4ff 58c5c81ca5aa0c7651c5486e9eb06c6736e099230b3a13f3b5eea7498b362245 c97c2a899d4aaa8672f4a70bcf851a915cc0eedd6ba75bd694f48358b0c71bbd 5753f87d73ec7fc201861d1bc0cc0f164c2f09bcd5096746e43dc9391ebb6971 d4b1e30b42bc4d510cb8b43e83bb13021ac366d5e24860ceeb7e9a07dc87ea6b 46c66c8a6e897de50b55870b02ba647ce711e00b921989a62d69eb44410d000a 0eb1985ff4a705239e91b92ea62502a531db75360523d4c451e5e1c2ee29e682 46962734fc535f13fdb861b18da85e9f0d03b278d86dd65938e3663e837d00c2 911c5621b7ba430c0fb95e36f3dff863cccc4ac719c531581438db0ccb768dcf 50dc4d4e98b0257a8aafa43ad724c83135b495186c74b1ba0a8543ed60637f66 c3914739544852de5a6c0a6f7236c71601c5a3034bc6dd8faee88e179edf89c8 31703f5e811507c8966f10927fa10b2de9528277452efe5f600d4b14068ca834 0c4a5315137d62c44e3e2a6e755ce127def41f69df80635ab0736ddd8cbebc44 2018b5bb94fc35221a7081ad401b5811dac1cb27d7076f33df8803c92cee956d d841eb4aad86293bf0a1cc2b05ec9bacaec1185e6c59a65f42c641d3b3460aaf b6a503fdf35a0afeb2875b2b3575b5bc808b156b994bc4d4a9e60ddfe684d799 e59f71ff0bf7b4bf4ad657b30ba5bc852f020e3db5f4a1b51a7e8ba5b2efe1d4 596c4af43de3d7f339fd6921b85e5d05884b75d062ff32dd8f5a98ebb129b03b aabec775fbc79b275252c59819162cb5c6f1d7b14352d5c21a6be11667a56408 9e312a9a35fefbfe30451e1825b4ceeca8002390d3d481fe2348e847b6ef8c1c 1956d6782b13e96d37b9682bd46b95e61714f5bcb5df38cd70ce75324981dbdf 0954b87c96194caaf39b4a3eda32de39ff9b67ba54f20f6a246ce6772f16e24a 2d01cc98876e4b2880797bb9393124898d2c0fe68c4d6eabf692be43cec88d8a 9a7da5c173ed18d0f8e696247e08f7371f68b107d40a965de8d3aa9682bd5815 655395cbeb4742e9aaafa1236f07369308094443f39d42c6ba97a2b18405dd47 8a63fbdd3167c33a99c800fe9319fb44e3690e7dbd5997abfb17bc47f2039105 ee06272048edf12d34fd4a7a4154e4090afa6f35c4e655f02057afba35663577 5b66b19a24598efa5e3b08aab7b08f69d872cfc98c130742112e18307b283a41 4b8faba45a6006eb249d8e90cd3adbc16fb96c60c7aa25532be34b3ea1d23cf4 9c6bf6cefe7b8d7b5f3cef6549a6000da022d70573036e632b7a5cb21ff6780a 1a19678c469423df9240597efc23b1274ebd59eb32b92cd356d292026a851ce8 e23588776ec6273bd7ac3f3a4eb565aa00bba0d020638ec803ed8a1a72465758 5884a2771c25c6ab020d0c8d430c84ee61b8e685f44b4d049158daff10bf3b74 1b4715862073c2e98248d374a074b54cbf7bcac1b87b1200987e5c1f333001e8 b29f1424fd269a49a33a6e066a849d6a8b15a60154bbcefb5bbeab7c930e1778 90e9bdb34859dc606eb46472f838a283139071dc724464c2a1582ad076e854ab 07f203e7a625c821e4981c7af0ea12647dc1eef235cb1fb12cbee915f1de6570 b3763c7d30ec7a21e7e3d87abc93fe572e1a9817a7076620741f311967aad028 58905ea5d12ad2307e6b3ab928af2c6a8b97371039620e0ea8e9392b996fb061 24b676a598970e2855dc5ce23e644eec40c04b901258819bcf37ea3c96683097 952c2d4c42580ac179714b9347e18788647137f573ae3483e700e232b131b366 b00c65a9ff59f8ce61aebf872163ff91a3fc64fd92c7800b3e3199d4dfecd6e4 bb0dea67442205dd4c4f9145cc26af962d0dee63a2bc31d9d011328f6995f79a ec6801cd9e4b106b660c3585a2ae86b4dac8fd6972e862483090d4ac5b981eae bcd059afab99bb0375ee1224f4a071e8c1c261e15bf7998a37e592ce26118dce 3bdeb23121d54e4b3de038a7fe3592466104789d9650d52d4fb551695a61bb8e d8dc992b0f37505ef439da7bde0bc27b6894fdd17ebfddc995be268c8df48fc3 8ef1672653c8b630e62ce9b9fbe6f861653c6c2406c43be2212299b2ca9f42ee 4f0e99ca588f03e2f0b68b036b486797abe46a6780eb6f60e3d5079b99d05813 bdfdd7b7ebd163337df9154c83dcb29702f1d11309684afe036479675d70de81 4b718fc4eaa3e55601f003a2109bb6a3581d530bfd30239fc062e16e1e3bdf4e 17d59dab16ae0868d52ae16919854e3152874fc001dde30a545e6047ce5403ad 1d970eea717aea5b3012dac5e07ddeacfe84a9e29c7e1c249222a7ce68ecfded 27bf6743f348b237a785166dcd541bc350b12aa69550c9a358079f062aa8334d eea22359a2139472759bc15725efd38da2c3ab1a78415a52ffaba6f1eb997050 76c4538b1cfaa932a43a4534ac428c8f4183e315812a6260218d50b0f607a3ce 248b3cd795f680c195d4485fd61afd78261666301add961a65f307142c96e680 e57f176feb98509094d6d8590134266f0dc437a64ef5eba75a700d85d70689f1 c06e089b5a1a6fe3722d779cd5e6aa907d11a4fe3adfa4986dab5ddb1a78d390 6aac9356c1aabb61f88ec5018560c2eb1ebee1605b1b06d12292194bbce1952f 215b741ef9d973b30da6e1271d38f7913317e1dfbdb70d900ac95d0e5132fdb7 b16c6b2cfcbdbb2612cc4e62d043e6232677ed24b70a23abd70e6cfc2bb3f0c8 00200b50aa7795fcc626303cdf2a4aa91b32233f0008a71f05ab3b8ad65602c3 6079b474a3fdf4e2535385c12ede3bd763056f6db6b52ea4cca257803c77e928 658a6ca666843260fb98b8ad010081b51a30b5665066753bdba5997ead876a84 f3e2ca4647742bd23a69de1471bc252217db35ff35ba15df23ceb66bd6e156ca 665bf05c5a4647a2796f20b3cd1869e95667b856f0f072f6dc2b5c47d9a60469 2f436ebeef8f869d163ce972a2e4fb6a82f0a4222911d0ad12e84c5a92efdef0 7b8af8da126a5fcd0b64284e9450ad413a0b28cd1eb17ec22e9808397fe94808 a7ddd958168d5ffb00ae12cbffff4b4ed3d62b555afde9c5cef52a905dadf325 77c5830bee54283bf7942afe702fd1d2b9af5e36b1d52d34cba1141891058247 778c26563f331724ae3d5b2297f5a4275b3e266180a12778469ee3468bf6bcab be4e0b3be29a4e122d6e16be997df93aae799c31139ebc9ba2085f7333f52f72 4e4b68cadef47925e2397622bea1a29c407fd07b1368d75fb88a6cd0b32d3221 906993fd171f2322e35a53eb019ec8dc4a71d201de66e0ce5a1ca92806883f76 c70f48ddfa25537417e6dca438e9815564b0ad1e16c9920c97b13185869b88bb 9f792623463c044e89546a75335a7df9e453e0c7570c55de82fda643c6c60dc9 d8c4b3e2e5d7fbe081928cfbb8f2e5b737ae8eaf3a9f6b7aa7e6cc81772ca94a f46f83b3826c0a5f095eb86d453180d859600ab88e0ccb5a5c4b1980111ed8e1 891aa60303ebad505ed74f9ed8771b8cee75a91f29a4ab4ad32ba927b6b67dab bbe7c1c2476cce9c391b8e0dcde3ae54ec8273843dff5c06c7e8e10c3efc985b 832a9c071eba09287e5d1a32a79f1565427eca3216bb75acbd6cdd4ddb6300b4 46949a37039a99a0d50beacec804100900ba06984a05b4de97eef665f4cddb5d 881e791ff137afda615d1b5729ade6315e8178759cf57ec49f22f32d5b9d2630 80a6761374570d59156363f92fa8c0e2595b6ba0ceb63267a2acd3ab104c05f2 a1756c83cb8ec69d578543cd9ef07ff29a81481843740b5fafe84087ef5a3229 d62919cfc26dae6b94e95a1b7b33ed80607945b68b18782b1bef836152120f9b 205b49bc9d83259cc2e8a54a2d7dfbdbb3ce876469587dffd57786c9aaf0ca49 ebf6d8bc54d66a9a131395f4ecfc9abb0ebb68da048de3d11b8cedf42c9f2730 2941afb24ea47a136a0ca806cebd099c21f43a7a32e52e785bbc5a64dc618ce9 cb264b8e59a87f84bef54fd15218258fc7fac0c4b27f9884f013e45f5cfcf879 150ba8a9cb63a2d0368cdfe0115ed4853b119e21ca89a71397e13f1f6525ab5e 94d5a50082ea6678c8b32e2d6190a4ebdfb3b9938f5ecafbe798674afc29d41c 3e26ca27ef4a9cd31cfa1381f1aeb55fccd8ee084b8e31c543a2fc5337048ed5 74e2de44f09c667cf1fe56d02f2022fdd34ae7a94c1097f5b7c58348ace7e9f1 7a4f191211eaf0a4e466b988af7c51e34181729a57ff1f37717d5ac638d1862f 2ec104891d8b0f46077d1ddef69cf3b0bcfd85c486263133645b0c16cf900621 aa7e0052ea3a8632dc59fe35668269ba867ec09af95b40db18f197afc35e567f 23acc4ebe0c50bb312b286b069b7edc5881ae1b6b0f5d02c4c0478fc854cb042 bcefc2307408cce18419b890c77dd96976d749fa270a0181d20ea9a636107fc5 3de3ed88bb6bd8f3478e9be3324ba0f78af6d4a9e2d590cfe17878def2fe6cce 439b021037859a566b3aec82ed9f08b7e69d496fa605a80fe0769e3f98700e94 1195d88ded1273ab29a0e803fb61b5c214b11dd7fad00a3d7ae009649d36605d 7daaff1613e630f47bb691a53d2a69ca7726b685af2737ac4ed5c29f1ec48e90 745369ee0d9bfecf4358edbe6f6f4d377e09fa4f974b41943fd8702ded06db07 ad524499c0a018e00274d8c86b81905b38c835b5fb8460dc546b0482c97fad35 1e1f4986454a6a97561b0d188792f5c575e524cdb2dcfed255c1826a17cca8e4 0dab9343319c2d695ba8c1902c1334de10b51df6f0949d5e2cf25f6eb3920702 5e64613d03e05427b59f8b5d430f228aff9a2d2be05da1ec7269090176eba442 29e319ebb284394c2cada99b54ee28d71062c5043d214e885b10684c254a8d95 caa2e733674cfd0d7d670fb913e28a06f9777943516130d7e7cd22b194b2714e 4b4640be71ac6d09292d3b94a8103799c1239b6db33ddedb6783e45914a81b58 6460a927f0a96f3d323830f1aa3988803084f0343c8bb46eac5ca5e80a2e0882 e0586f142553e511c189d32d88a3248bc1535315f29ced553da6d24fede4d956 8268d3d0eda2260d7f3ec5b3928182a830a8b93ed790aba78130f3c5d322 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMTI10 %!PS-AdobeFont-1.1: CMTI10 1.00B %%CreationDate: 1992 Feb 19 19:56:16 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.00B) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMTI10) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle -14.04 def /isFixedPitch false def end readonly def /FontName /CMTI10 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 161 /Gamma put dup 174 /ff put dup 175 /fi put dup 176 /fl put dup 177 /ffi put dup 178 /ffl put dup 183 /caron put dup 188 /germandbls put dup 39 /quoteright put dup 40 /parenleft put dup 41 /parenright put dup 44 /comma put dup 45 /hyphen put dup 46 /period put dup 48 /zero put dup 49 /one put dup 50 /two put dup 51 /three put dup 52 /four put dup 53 /five put dup 54 /six put dup 57 /nine put dup 58 /colon put dup 63 /question put dup 65 /A put dup 66 /B put dup 67 /C put dup 68 /D put dup 69 /E put dup 70 /F put dup 71 /G put dup 72 /H put dup 73 /I put dup 74 /J put dup 75 /K put dup 76 /L put dup 77 /M put dup 78 /N put dup 79 /O put dup 80 /P put dup 81 /Q put dup 82 /R put dup 83 /S put dup 84 /T put dup 85 /U put dup 87 /W put dup 89 /Y put dup 97 /a put dup 98 /b put dup 99 /c put dup 100 /d put dup 101 /e put dup 102 /f put dup 103 /g put dup 104 /h put dup 105 /i put dup 106 /j put dup 107 /k put dup 108 /l put dup 109 /m put dup 110 /n put dup 111 /o put dup 112 /p put dup 113 /q put dup 114 /r put dup 115 /s put dup 116 /t put dup 117 /u put dup 118 /v put dup 119 /w put dup 120 /x put dup 121 /y put dup 122 /z put dup 196 /dieresis put readonly def /FontBBox{-163 -250 1146 969}readonly def /UniqueXX 5000828 def currentdict end currentfile eexec 8053514d28ec28da1630165fab262882d3ffd20326947b1065649b533eb5e9e3 a88a87fe987918a687950b26f647d6e08bf14d983ed1d4a8ca1e2da8d985f944 2eb916f5b6ed0697ac7c33e1e36a3bf460d34ce45f1631871097cb04f18e3889 4cf4ac1538eb19481311d24fe3be7beaa4a3730e8b4831fe59d6d9ce2e46116b 629c7ba2f9ce3ecba2f43bc162a5a077ca1b2882a42afdcec3f4b75b5d63e0bc 8e5dc95257766d8ea467ad9cbaf47be60f797580cced6884b3a68f70c91f4fdf 80fd00ed9139e7f480dc3a76af72ad9b434187730bdfaefe4cbfe5c7edcaaf24 9204fd703011932e5a3c27be468b7dab69daa18dbbb6335ab8ddfdc607961c7c 02582763fa069d43563ba17704029945cf42fcb19cf78c51df0ec4d851086d43 c1ab38e865ef36865fff3a08b01cbcb070ba4893f7482dc7819ad03d337e520e 7d8cd83bb8ac7aff4df36751f4f12aaaea2b6d7260c09a26e987c904003e0723 7dbcc4a8e4e85cd3259f40d3caf55c742cbb40ad0db1044c20a4f122a63f7b81 1d945bfa69662189ce4d089464d2ead9f6ed60b581b04114d5d45e97be27a576 35154e9b8464f2a0df18da855eb51b8f64d3054b0b2e84621f025a0776d16fed b988a43d2d64c32768dd106b9f541ae8e68ac0bb7399e16f4d4ba074b2152d0a 4e9b5bfc21bfa0d531e28165e518ffc054dd4ed0d74eca079d20e79670419f92 e03bcbfeecf3554d661596f6f29e12170804d15a250d917ffe7a8b6e8fa53047 1ed97ba56481589a65ca13619129f1e26affe6c22f0c38540f8ce37efb6e9e9b 60b51a5a9cb4454fd7c7f92f2f9437159687ab590f35b946a54491a7739c9269 e0f1fb48b129811c82edb3171cbd5105fe65906974db8a7da92f4f43dc7f6b36 6981146d86d23613a0b38d9d6191db9fea0172e982cb1cc50e382f69da1b377c 1be9407f88a2a761b56f398467a057f35d18c01cc377e006182c891ec80272e2 2e3a5c7123cd27eccdc87392a9fdf63bb40f02b7649cfc53ef933c6518744cb8 9cbbd437830ef5b1d58b00b67bbcf4426dc1e6ef583b0b4ad3aebd741e3ff0f7 29ae271f032019b1e7268043fd215be590f9cf24da14a90f1683afcba8006cef 5d5632c2481fbc1bd8224e8952debb7c4596a237e5505ac143180956ca1f603e ec70cdb4a33e1c4ca174436a38b06fd9d2b9196f02114b77a9a5f66595727faa ba323668573ae328f1f84e5298dbc5f5f524e5ecbb9187bef38e29a0e57f83af d150e1ec0809659ea4a616425b0d0eae85813d710e8d91e5330591608ce6bd7e f1cb84eac83ed940d13ac5c678531e77dee9a8fdbdf6e7ca6fdc9c4de8eeab77 9eeb52d6b94ac84e05a528fe7e89aa881dfa0dfeda8c863d4df537b6026b5c7b 7a01435583581efb25e70a9efe0c9257edac8d9e00ce159c592fd2a24ab07b3f c8a1ca4da21c5a65db72b4b53f6f71c0293d84cba7adbf080a7046127de42af2 75c7681a49f4135df39858a19f99d404444b038c20994382eaa801cea83c4a20 10b1f6e6a6e5be265439e63560c199ef21a21d5b9f11244946817bcacd416d6f a22cb08e341a3d5fa682f623f51056fd9ef58a3582ae6cf25a752f23bdca3494 cfe286331345f613ad98f13c2bf9a76083d4a747fb28816bf98741a06de391db b9f1c671682540da8771bf5d249e154a2530c0bc068a848275bd705e69142144 fa676e78c4c113ca0fdaed2e0db324b5b1d2f7d40aa16ef7a6589af4041809cb 9894f38e049386e4490e1f8a6dd70404bfa7ffdd6c16d6f5db43383f85b53126 ef06414745b6d1213caee97af39979e03449b46707283baffb1b5d7b2f5dcb21 1f71a0e9cd8fe0677b0cd3b7a028149ddaafb6889cb27eca61bdbc5002fe2be4 fcf18f909b3038888ada4b1715e26cc748992f83669cf640ab6b655446b05cba 914f38c5fd5b63f2d78eae800409327e278c3b5ed01240f00854a19a40cb83e2 78b37b42a3ebff10087836c5674f4bf21dc197b79b8cc6bbf764723cd779440f 0a97c54cbcc195148ec7bd77a75cc573185068bee7cb1cf893e758755ebb2a2e b980363e5c516f2751c234ddbf01404192b5f6fc7b06ac26e56829a1b2992e0b ddc93ff337f51b6a0ca3d941f4e1801663105198ad741518a4ee91ffc5298aeb 6b4c3c4ff3975de4accff4d02d080bad82281606864742b2db11af69b19d0d79 09f723261a976c2a93ca8768cb02a14c61f74def6a74db1f202719777a854e80 9cfdcd33c3cd245d7e634466a8e4e0a1e8d9e4f5b74c072f727ee4c70225c64e 6ec770a52fe353ad450b9857fe567a8c92015412b74880a86801cd29a4e23b08 3c835205d700d6b05f0119d42dc42888bf3a106bd5188b989536faa11b756ce9 5facbfa9297f4b4c7c286a0281f9f36e66e2afdf6acb9e4ea5044657c6245491 0c854234913837d21bfe94eb0595c184ebe40292957709db070c765c2941ecc1 9f0d680842a2d580abeb0561c688e21ec0e02976469cfefa0ae3b82658a5008e dc07a26bbaa3814fff63ec9ab16a6abf2bdbfadce7b361aab16c6022bfc3a439 a595443bd532d28f7ca95b0c07eec342f13d97ce903fc1ede847ae11af1d206f 8e0da6826dd877a57b40f7e18817622952d2da0f4ca751dc891221b22c1b93be 77c55028c1994a08a46750556072e3b583cbd15587b87335a260ac20c2fc3c28 4cfe2553e3fa33bc3500bb63c2c7f990e94c625acb5933c2b582626f872626b8 da4cc58ce6f02efa1ce87cad88ca7e5d9265759b70f5d0bb471ebed23d85d0d8 f0741335bdc6fa566ae2a481fa00a9b618ceaa5b75983ecd4b2d868dc6afa6a8 eb4e53adec59def53abf41b371432014f16a91fd8e14e8714ffdeb8f71fe299a 2106395e5ec50bd4d81395c6c4dcc009c29ab52f688df5fbb96144c9e17e951d 49efc91dab1d33d80185b4a2876a7dae047893a1ce5610c4501eb25a7b0d8588 aff8f43b5b7c469ed5b57015e0467b456eb80c271dac4f812863268bb8807c4e 60c3c523cfaa0e5013b421437cf10d0cd071250cd32a178fb44b8b3dcc3aa8fd 2b4d8427fc4e0f752a5884702affdc5dd9e30494e9fc54537c381b9e100a1ab3 c69e39f89ae5e6436eae6ac43d911b2fa2ace0526afe20d1f2456a4dfe507682 acc023d784049857c485304e7998ab7c274095912b473c7d9f2102941121b96b ce285187bedbf4bfa97eba322c514a37fe995a10dfdc31e731ce45dbdba27cde 119c6360a31c961852fc351b15fbd8926c9b031b5cf93440fd3d7e9f6b2850c4 8c374b893fca45f0730bb029a3748ec98969dabb9faaab48cc28eb6d428c2bde 2d2c06b0d0d931821d390af71f3d16fb9364c15f9d07ed8e82310bfa470c7d06 6629c84c9b6c6026615515e878f4c82b43e643b1de4d9ddedacc673cd9c25b69 46f148fd696e813ed27b9c1ee64cb124cd5a058ab8b401593f8793bab6e48f2e bbd69b7233b9495d8d98de4cb1f8d1d3788353aebd9b02eb629e4f0834929875 e186118923976335d4610bf48500773c2f451792ba26f6a391a09c9f3e8c4329 6cd9c3700dfd37186e7f6354f65ce3e844a554d3e68c1dd1e81546890ba87ec5 a23fdeebf84f36ce26780cdd1b6c90e1fa384b2948974f4d1f035bce24140cc1 e827b33ab319cc9b5757821bf4a11ed2b857d2120cbf8b1330d20ff4b2633c15 7d8a7c03a2c27dda41c29b227139b3f8ca2123f91d0b3b8ea371fc9458273985 2a0790fe0b9d54827bb5f4a0428dd429d4ede1a9387a230717b7807ebf629cd9 905e3c79ac40505ff2045119d5e1c5658f6b820a9cd84fdf76f59311dcbf5baf bebd9b3ecfac457fb1dea94f2cf43d0ba7d7944a193a3a027a12733886aa23ac 1b641cfe03c670e22cf72f39def27cdffab83615c00c81a06cfa3f012acfe749 d556f2d54cbbb8241cb3e381b9e6404c0cdf9e47d0616a25f5ab127f3c6f05ba 1946692970bfb0ff49a890ff30e0c5078023936489cc6fc501702f4c130b5a77 f70cab2f26d5ccecf51afa130022c6dea38828cb26e5bc2491c5dd0ea0e58c76 9ca4cf3d8370ada71760a87b41f691415189a10f39e15603f528d8c019471a9b 368307ca7d186b3d87c37ff14fbe7675f46c2e91167fa4466f6cd9bd50732fae 000a184783f50f2e117316deb6c46e6bf6a8938baf7d7935eb0298edc6c650ad dd5e3e8a317dc5a61963226ecea3218a1cf6a1d2e80e9496244032a52f82850b 95a0754460e766dab087ce4f12057e92fa51bcfce8c2e5c74f3da1465258b29d 5056455fab4d3bfbe5cb784e87bc4de33ea7f30de62a73c8fa5cce53ce9f0ed6 96c31eec19089729faec52fb154411e0bfb1594feb9fef6e8ec4e8ede8bf5ce1 f228684a6ae3275cfa9386c011e1bd3ab5eef92c15e4dcf0f9bf0338b82224e8 78bb0aba84e26ed674653e0e5c52d5de63bde170b56f5e460ae6a8a7cee1a5db fe0593a7b52294552495c55642369b1e9156da46be24a5c851eee13111b84bdf bc5b6ecae0a3c461be135f2aa33e768873374eb87a14ff98e0ba40a094b85740 921999614bb9f5313a6ba8b64c0e7d6011e88546f5a1294de0bd5f97d19083e6 d88ed0b878de8405801141a2e4a1411367b45fc3e1856cf610407340f5cfafdd e241a5974d67f716cafb029805b9bc2fbbaf2919cbe4c7c5f0b3d91843189c5c 59c113cc4f63df10569740f9845f48a52ebc4de6adaf729605d7718eab231635 afdf5137223f9aa20b00b6b9cf859d19917a6613d3e7f657bf39b44077d8c4b2 72cd6f00fe8759c25d04da8c4c3a1c99baeee23c3415f6e8e5e456e2c9770eee 796d80c68f87a0f6768cd97c443fa851b3f4e45d1ef5901807e397a6cc387ed8 0374253d1c0e1aacf68af00cdbeac702a9b1881d5fb71a3deaa343a16f825ed2 ab45c88e1310634855443776a6b7b0583f8a4b64315578bcd8557a5e08570bc4 e76ccff3f829b28fed05e9e5578918fa5d818522f86cb7ae9b7fffd5ee12a6bc b38bdd7c7a4ec7805b5f7af91764354ab5da03d3e08681384c15c48b3997fad3 c52b5cfcb38ccd61c8b655f1c28674d4ad8ef144f48933bbcf17286a9a0e1f89 736387fac0ee63bd8585a17c75f1c171fc48724203a0deaaefc11596211c63c8 d78152ecf9b8c4d1b69ab6171c23045f1352cd7e837ee216e040266074e51de7 8bebf8bf40303b582dc35200e621a6c84aceb1e0628b84bf9e7abc40acfbb38d ccd4f032e80846af0ca5f79cb70ced6b4bcd89a5a68a0bade0e5db8e520b17bd 70499ba419b7e23dc5e14fc52b5fa0a5fb11c967f9e69adff0341a4734ee703b dfc1a3ef7a66665a0553e242a7b8651a4de9c7e36efc570a2981a5dd2488d38b e36f3adce792789d5b332ba02f2c494a76b90fe2f0780d03aa7aeafdab5e0a9d 86c689110b420e5f3fa37db404105341265a572b6a2014b79aa3693aefcb98bc 1f7f407ef1d90e824f3ec026a5773e2c90f415ef7a882f140b90e09883fbea93 aec53cddf5bbbbf61b331c2e2b4a9729049600b70edad3af4cde6c5be36d2485 cf714a81eb8841101a2704107d563a311da3205eec64aad390aad1a9938b773a b9feaa2f6cb47e07d782575d5e2c255199bbc552b0ab9f3e83b4e5bfea72406a 74f95e58d6952efcab24a49b27bff2c14340fcd840366356143eb970903c773b 3ccb3cc7ce42681c695270605af08a5d1d93bb2222531f66b9782d5164835ad5 4af8450e3e9d857d5fb9bf5007fdd4648491abd96b82b39a3ad6cc0c3ea4c0dd 987d87a92d2cd8733c362864f81874bbbb65632d2b3f9aa3b85ba1baca320a90 80667e78d83127d63d5090e748059c04c894ff2040cb9d71122a14e6c75b8ce3 4eab5b565daabc81cb65c26dad0bbfd36ec93ae5d71774aa62cbadb1a7024fdc 950376d461d36996c541d76101dffc8d68f4110f52ae6df60012cba3a8ffbbff 2739a30e01a250a8cbea820cd4ea55f80059f86c3a04cdbd3f3f67ced953f8c3 2036472d0c58a2ac6469045e8c22e033704ca5b122f7081059d0c15092e428df a64c5286709292282e46058059311e2172e1a8c46fc309ac03f48c21fca6d915 f8e66107e899702e3b59ceef02f232ee7616989c9413db42e5f01a276ce7bb23 59d2a4a5cf663ee5b77373d4bef8c42e0bf1036e2f280b570833ba2be8fa7787 1161df2541957e5e33df50f75e0c4f520d895a0493820ec4aabe7dfb09ba4405 67198186a19df6d126e273d8b0a73727baaec7f5eccb08ffe5babce711b6a87f c85996e73e1d28c9fda54282cee07786ce30c0d91d8035410171817ab67e1b2b 1a07c972b057d616c4ec1b6f15a837ff353df3964829f9b3a0f94e99f93539f2 c0ea8e489830e6643fd16656e5bcbd9fdaae26499279cd58e55ddd8ee14b5ca7 63e1cbedb64350dd798785199db95d0b6f8d0cc0835850b3d964d7dd48ceb3db d09f142f52eedc0deda0991389cabbeb380ba1ce7bd0ad5a486e4e5eb5e90953 ca48299cd383d2c1ccfaf9a6ae9747514befec085b47f2774a1f7ead267d52d5 8a1fdd12bdac28f23691c7faceaa6ecf3cbd229d3267653c62c346defb23b130 942dbbf5268eafeae7537bbf30a5a462578efb8fd68bf160fa74180ef1e28cd2 7efa2f5d821a55d593546ef79657bb21ece1edd4c2d3bb5c347f8b6f4a72c220 5ebf6b9bd20085f5bbb7827f26e7aabc8a2e7a184f40f14f3629272a66778074 f678245b9d5142abab725796e5aa6ccf46cbac176bb515ed4ecc6c233f55e0e7 70e2c2de2bdb867e1eca6106b31a519837f55ee5630d0e0e33e80944d051f041 6fea4eb16b106870f9478fe9cf8da0e3a632b6f7616247da5a8587cb9045a603 dbac5cbcfb73603c69ee3199ced71613acfdb630b4ad855593bf281e79f784fe d90b9cd3149a717b4133021010dcc247552391dcc9e88b3dfab5cfca32910e42 3b01219bacaa833caf6a3f53fcb07f56fff6aaccff094f6a0b5fd92a854718d0 cbc70dfa3ed8e59a36a6445bd067706fdef420ee61485e52a51e71424db9520c 3220518e52e022a0a4bfc7c0ec18ce00030448b367ee9d458094b9a1913d5d49 4bff2f29dcdc222c37d03fbce75fe05f1fb4ef0e60ff6cbf1c636f2eb2cd61f3 5bb89df46481b32fc1515b8e734aad51f306c2240d7b97793feadb536691d12c 9215db8ad5a8f2781b40397b4e0e9528052a6bd0a29af70449db9496e242d178 20d293efd6a3c5a41dd689222e0bf74db0b436a7fa2f1a540af774740a6143d7 ef909598ac3a4ecb71c1c589a350ec111935f7a510b25e88cd8ac2d724455a2f 42f78a031873f69eb9f79affe240cf14e253809b3cbbc1ee63aa99328d2327b1 c16af50d6625969411d2a7854386cd73ce6239161683c391881992573782bc57 91e668800a349924283a9ccbdee5ccde993f19d61b5c12cc0adf5661173087e6 81c4aabc9c4c805bf185521de14a0b9601d24c7f7376ad1e2bdfc3b0b14e968e 0d6110b0df5521d9b62327bcb80c92f2e54043732531dc73ee1b0aee39a22d92 e6dc2bbd3eead890940c859f8e5a90d33291f6c07b5c7ed1904c3f1469d6a332 fb229bd99fbfb1a9f61844a9fea0becf89bd6a5986dc58032cf115fd74b0f0e6 db7b72db3c97676530022ef200dbeeb0f8268cefbdf07942692e4986a4641895 4d64d7ce9711386c6556c64d9002fbf0e2473b2a8c50985f00040b3b64c1eaee b8b2f965c7322dbad2931dc8cc850a7c427881584e1e202da4a2b64a845c143d 400e94b7c66dafdbe89d4f6497f3c5996993685aaa7b40a9753948ac94c2da0a 3dd3eebfffe9142d506294afb59616e15429a8e2a795f3e480266a0658d36462 db250b0d32bbe7eae1b6fd0659a813b5614455ab77316c975af26651272d8abb 556bc78c349941c88937e035146909bde6ed03fd0095534e964555f1727efc27 4caf0a173d48b91e0193f1cfbdcf577424913daa505e9331f656012d0214fd01 66d4a1563436376cab1c4669506e784e66cd30188d252fa6bb60a9d5c6c6cbb2 40f85d7b653283ee88342cbcbf34b37e93cda9bc4401997e78b384e26ae6c976 f5ea337fb02846344d508bab25b9c00f6f1e3c250ef49acc13b54a80fcc32530 fcc7bf1d452fccead6eb2e2882a70ab39811fb77beaff83adf7bc79a2421ab1b 1818c3eb4ab7ad4e5b061c0d3995e41150b678bd35ee24b3b4d389b2c8cff8b5 f332f6038736d1081ec2b9b02f61b1fd47c022820708dfb7d4ae48664662715a 4e2e52ec52329dc9d3bc2dc55ae6d04afe4996e49822d5eeec7cda107e7d9d9a a4956bbbdd4925b12495712407bef8b02c247664bd677147699dbbacecd3c923 89f129f1f911dc3619fd2348ff43eee21e16956964115cdc78cd480b48e0265a 7bfe21da002fd5d82dc2d10f188b9a67cce2470c72c86d2223cfc37671543722 9f203c49d0a6c0b45b1c376739b03e0281fcc41473baee1d894626861a49f9df 8d3e0d29d61a7cc3019fc6f8227fedc62fa9807bb95aa228e38489f80d312c5c a358c601bb86c1664059d018123682be4b64ae9a03f4156c9c5419b82888bd95 9b5b630a720caa4b32fcf20a0b18660d024f58ae8eed7fa5423c3004ceece6d4 c29fd81ea7208bc71b94d6534db34a6019d3d5c0fb2e21cca0eabfbdb792dc40 52cd97ab8689c07d2443253d82a051a5c72bf5c015b1b0a80bd56a672e9c4945 d3b9ed93b951de4470db2f20fa9adc458f154838b464d35a88f6de41c5da6ecd a36279ab0b76cc74abce83642ab40db234ea63fa1ac1de612a052218761b6f14 c788ff1b4199d875b20425e721c7bb162de9998a942fa44259e08e20fc5786e9 43babb207e3add2b5ad0c9892a185761ec874a36c2b28272f0f578dca54f995a aa66e9eaa0fe231ad66d7bf754266604f72ad4326060a2004892222c456c2016 0a954466c76c1874b66853a1e4eea07f299c93076f722900319fd1fc1c352020 144f60203d2c83e930f065072f33074e6ffaf5a7cc1f949856061419313637f2 edc5bd4209a998a6c087fada17082a8aff1dc39757e8283ff53691cfe106a0cc 190810c76277a909bd300fd69c131dbac9f40e8ab3dbe36eb6dca46380fc72f3 3da163f2d8b4d034ee28bf86a4e0b7ecf786db02d5cf9ece4bb346c3668c519b 3935ba4c1e350fbd893cdcfb6e5244731e1da029b0bcee05ffb4ec35c22adf01 f9de243760197f28caa2647249885edf5175a7ecbe8df762ffe957163f0bf06f 606ca746c73ed5d1f0603e8c4ceccb650d06407f33e98b636699532acb523236 e5a5dd96f492de7a21991785c8b15ad6001a43a9723274dabef8495f29e61067 8c0cf2622ae0f144fada5203f8872b2be0a5f2f5a957d39550849ce63ce8107a 3aa83c0f821db0f31b972fb71bd08708d54fa801a76e08a1c7de17b364bda54f a31c20dda87f9131fef66f058ecff9a2e212452247f19c0bcfa80d813a0767ea a9b77912b6a0663d0d59c45398079895e32829958ce77856f9616543f15c4b75 1600aa05007cb12cc708e4ca05bfd6f1309673989c834ac738c0e25381ae6f22 4e57f22bd182a93c09eea813a44c712a379b9ee9f36882f36ae246350f3a8583 2ee562d408d7570d719409065fbd085d63fff730b200f8b8a90a76f7e2978508 26359ad199cdde8dd5ce1e7c16da4df31c9a1959c57c2a9ef8e9ad4677c3e1b7 198cf2c8dafbee331deb8f0538c3c38c80199f1490df2d2be39d1af70081cef3 476d2d5a9d56244dd5b237185d1929dfdeaf9df1fe267693063ea4443addeb25 c54f097d17d8a8d2f7a5637372ee73fcae6334388bbe1925ca1c9cf64b83a0c4 96c1e84050eeae1b3b05e3be8d305ae016468694ff2e9860a33e8c0d2c8dccd9 839482dfe1563d19cc448c92f25884d84de99082d2dec4524fd5e97a93022cb5 5241bc660a7483b4b80b6b0a60010584f8ea5fce57c68826407a4fe6fe945c42 33c3e7303455a3eea12f1481ff5f8157afa55300292d03bae3930efef8b690ef 869cc627a1ac19fe3a1f3455c77cf4c99baeb602572d18de4a0ebeeab3fe0c2c 17be2ed579a5e27c26ab604057279d2021760c48f4e15129cadad95116bd4ce7 e0035236dd559b74d1fd80694ec3ff94f175ac9d25cc91674dda3cd0be207fcb 5a819851f7d673366752fb949f1d0227de3f0a250176076d93be286ec4d6c647 e2c6ffea0a2353d6963f41f8b860449decac01e993aad1640d2b1b90ce1e5230 a3217c8d82ff7f826fae71991484797e6011a2d0b7992c715162746a4f979d43 74b294b63289918a440d241c6668ef34756224c08e0cddfa51db946d31ff0d01 6a7ab0fad90a9cbffbc8b1b3c19f1097c9a96a8457ee1c4da1b131a113013b1a 36574a3db9dcd72173af7444832e39721fdd55e4e7ff008f2b8ca0ef9dc5b1f9 98efabe3db5e9675ba70f191280262d000130cf16b1e8a25a81994aa430e99e6 c55585832ef765d24e494dae94656237bcdab9e86633b8456e21748c48cc4527 ed75150dc5fe5daa04d06801cdf8ff52c0af62c1e718beed0dea49c67b84af54 5e1d862e3356b3436f141c3fc843671a57b7877ff7877a638caf506f6c476994 3acc15a6c974143440864f704bb16b45c532762c2c3b5a6fe9238f8c999f7ff0 2f768a53dd72a55d996559c3dffe28d92268c95ae90f28f89bc865ad56a82cab b5811ba2d11af1a640215f1f2f174014bda7f44981424cc755b6a58098fa1cfa d0c00bfa8b6af780d61785c713bb1f908921bf95002fbaeff136a58c8ef6f6f1 0056f0ad05ec328ce229eadaa888e2d07a8ec684ce9c6bac88e8e5fc5f8923cd 2d01a90642966ebecabdfcbe1d5b2d1e7aaabdd1e4c220c70a2e134b38029b98 57e12de3549cf8b5aa44791b2473613f38447822313d2cedc51b0239d322a938 c8ef9c94cec881cc84e7d1ef168187e841d509fe4e16ed60e6bf40b3ed21993b 783902cd7e6f8d97a71d391a3e82958564f932d2ab8718c6dcfe47910e64df59 27a162da023c19214327a8753eeeeff85ddd2dc14936218a9e8453101b7f1b03 f67a29a9ca12afc24e79a9d214408246c7411a2008bb3630541760fec21ff018 aa26de9895a7fa985e26a08b60358dc0c8271e5f9deba8bac6b92f355d531324 b4a1e80a5045e450c99c9a2cd41a68594f1faf5af088039d29819d3eb3c338c1 ee21e228650440c691a2e5d622aeeb15239cda830c496663f282617a37381de2 cce5818931bde62ad6d3c877adb0776184ffe4eb977ea47e693c33bc04624ed1 501d6568ec64d4c57af5df3afff87a8e84ebe6e6395d8ffe09bf91597cb8cfbd bd692bd5c889ee0d7a3ac8d96edb47aaa90a814347c26982cdf996d42e725311 eb6e720ceab8792c1278df6110398f5701a9bac9430696ce400e0b2cd06892c8 39ff24bf8442ca450e66d03032cbae183c8286e5279285749efddd2eabaff2d4 408ae9ce6174c5b151d0623e440823b5c9abc6d436307456baf6a2f7c0b4dc66 8bc8bd34f664dbda0ffbc2d58546a72c75ff1e5ab65a03272238abe448e6d816 8e7da2eac62b309985cc742f293112ac31f0d054d3220d8fb544e394788e2a72 6271bbdc6d9774681b40bd7d1b8631a318db98f73af00ac96c760f91931a83f7 d116dac9c4d10e2cb4c1ba688cf352ffa7a2850298a9d44994a2fe490c5b6f52 c4ffe6ce5ca0347eb9013ec1ec6dd8a82b44945e7dafb8eb92d580967b99ce19 306a79fc76f783db0af18a7a494f5d20bbd5a7d07e57ffdf3ed5a97b0c4f9a69 d89a9cab6b8a8bd304b6e4b1367c129ff27133d183359ca714c761151943c1bb d9908042593332db5c5abd4f1f36e44d4e303d0f89fc023a950725b19d37c178 9296c94f4f04f58ac34ba6bf029eb085527e090c914d7783612dfc84efbee8ee 2e6f3a3e839df937358a2a4dd9f34cb78cfb90c3c076128a8500cdac9c668b85 0c8d869eefa552ec2660b7dcd6a6e4b7b7389df102e999c18171c31beb05a5a6 5d0c71ee64835bb35546a069f77806dfa143dc42f2e66ad3e3b8475376255e98 50673726659814b84c311ac399c806312d0e9d52487d000057e1ac735ad08d9e c512e3fe3b7727076b18ecfbf38cbd4bd227067a52d09aa4faece515c903b996 b1102e66fdd3e6c761adec0401fa28cc21e07272a6419499913edbacd49080e6 6bdc3e4cf34aafe010868980aa277698189fe8ebdc89f1dd988d4e7a54cb8670 b2aba8198eafc137bdcbeb5e8c5188d410df247e0da84a1766019eca2eb61f01 b6248766506911590fa240098decf7fd8b748e136493e818f76aca98c3219b49 7c5766355459ae1e0f137df57bd3a3609e7db7a2c46c491569b44665c7bb7302 7f87b4d8c6d43a09203872f4b6904085371b59fef2948398332b18b5dc7ee3f0 627b97d747df34fe577bb40206e3f8da5684839115e9ddb13283ba8508c6171a 11a9f6fb423aa4125025852943187acc933e418830d5d73a7839b10efdf3e6dd 95e1ccdb1dd264132efa352cab98b87dfde0530a5e1387dcfdbef55ae3c769d9 9513373e45ab24070756faf54256c4bd58db2de0c7101468a4ed34414f7a42c1 eef191f9ee3b5082ee911f5d6fcd02cf4bfe1f7eda8363b55edbea1296f68de7 3c41ef880446bacc7f627190f843b33b9062b80ff00882ef32a35333ec0cad24 95a5db1c032de93bc5025636f0b8c138eca01df7ef3e10ce2eff63092f6d3f32 e7c9a82396b6e1fd0abc5630589375926d00d77b5d28fbdf405ccfa8216ef91b 887e97c23241b47a91791f4e69023f87ab6fedcc83d70f57d0ba6314ba1603e2 b881855e89ffb040bbe1ced0a784775ab5509be6cde77d3ed97095f42627b6ab 13e95df149ebd7a4cc7ecee0aead23f6f7fa0e8a0a51dd1fa38b6c588b2ca2c3 9f7e99a9d556cfa244188fc2b5ca081d8cc68a4682fe0a05da6d8029be6c8961 73ae33069f386131c89ee0f69bae71d553a59c14c44d8310d97285bbdd7c0507 598a956e5df2bb857da1075fe7964940578803c4a5ed39bfa5473c291763244c f3daa851923f9b2738ca2b0b12e6b5138199aeb1a2068393486debb2755a0cda 6c67230f12e33265af99bb4f645812bf77fb542116b01bac7b73b1da607b3c2f e73a33ff0b453770c6610207fa833ec520a69b09b3012bca9b8c0386fc2c781c bd6b5ba9dd62e996dc4541f766b31fd1049171dd30b800c32b2af6b2c7ea13a2 da71f974769c98354bc34e289001f832a87de411aa4559e4ec4c3a41edeaa295 734a56522cb559198da92f247780d2da7c1e948db251187c7d8f35f01327c357 606e338e411ef1dec1b1fb6babbb0ce345b788f8e1879c87e758061b77b0f52a ccad1ef8e78109cfd6fbfde1f89899f7782668d21f5af5d7f2967112c3c0b51e 7f273bb2e7e75d1bea24e906a5fc088a231fc4fc2c1587a66328484d2a85c776 419962fb241579cd0bbfcf1c6b1213753b4ef573565ce75646a26857856af440 6c31518e109e33dc145a39c33036fcec424a9149803ffd9e07be3c7bde31ed88 4a9672bcfb0b49b33edda564167494dc1ea318815eeea87d698c26099c10ccc5 b3d5fd688400fc7ff6e67fd3827e9b3a5706f9d891e0213af6944ccd1ef77a22 392a8ecd60fba6e13ffa50c6fc096ba45e675dba4f1c8c8e8f8e4a1600ea56cd ece6778f37403886d9d6a0cbe25e556bcc451d49ab8b78c07bc9f71f950af632 92231acaca52f483b75759e9d1038c53fa2f5db4755f80dde49f832b9221b116 80910090cf8681e872eec62b036a8a096a19fab6b22eb3acc5131e3fa287b860 68097ec14788acacdb261e0044dd21cfd845d07132ab840003231ea985debe66 23ba698a5a502f51f7aac934414774341631482a863a589465abc80b49cdc6a4 9e82e166895ac22c7ad882c27e81e9d8fad200fb9207bb5e98fd50e2e469de21 5ad22fecccc3883d3756a0c8173834af00c221dfa9e432a8f8bd763913c8a851 ff02bd0aabd0ea3be890d89292ead49b08e06b205f30317ac6a7a2fd910c00c8 b01818d36b8304c8b96be7c947a2aca1249cea99c78e4847b80bcf8c95cab94b 7082a6629b435c0880fa1bc56073756a115885fe2d3a6ced66ef1e8a0508e975 e47dbb655779d337ed092df605da23c204888a98d57d710a9f2571426a97c42e ab6a97c9794c9654e167c8155787312ea37102f25740a5dd1ac02a97d41e1399 28d229f990f87d895ed0fba3116f823ba279f377935e477ba595f58b1e0db08a 96bfd625a2a52c46b27832ab918161050a0ab1c334e97476d996e4f54bc2dd19 ee8cacdda368c0a90d2e83b98a8f71fc94f308d5e4561a5b2a707b77d042cb8b 5508d98f64434e14ebb3b4f4863248be0c8787df616d04cf5bcb287aee749c78 b558a1a331fb582f60095ae99aeaf71bf4434e75186d3cca8de549ee48c33fff 292c8c7fcc49e16f96dc07a9233ed73f321a950b6657ed628e95bb5605dae70b d477038519310c7cbeff5be80e78c7e45e3a5e9048252d4c26b5c1d26b39aff4 c860ef25522f70ff585a8289d8735eee299eb94dbc788b5d05eff2ecb3c170c6 4ea35be9095681065f6f9f764ab6039d4e59467e2e2a1860a65300511ef9cf02 756ecad2bd7b63b35992246fd176a1a5a586a29764ce6615bf015269d04e6d29 dbebce2b6347bb14542440184189ba3db12c8527f60fdebf4d05b561fed977ed 323f00b0e71319e8a9a0d06c9da77c75660bcefee94351b01acda6927b8d8733 b6ea1a2ac4c910e109b862fc81145994548751c3dcce742f3e49010ce9f87eb2 2a776e0b6f8e0691cbd2e6436d8300e65b08a5c5a95cf1de5b2ef25b517dd47d 971e09f24e12cbabf2d0284cf0d04c1fcba046c4d818814915cb06133250f9d2 eb6bdac0d45c4a30410ffc3d49aafcd5ba28411cf1ef511fa0079db04b9fce6a d916dc04a4691fd76379c3c64b41c756349c88e36344942c75a7b8585020f091 796873a218c7692cd808e3302684807d9ebf0397fa39eaecf095194cd2a619f3 55f083a11d205ea78a91d2b04a22dc504822487e633bf142c4159dbbde1e9a41 5a4a302f091af6ead1ba69b004a690812796e74fcc4220d9fd49a5443dbab13c 8f0d4b0a35528b427f2c190852659dce599e162b1730311a45f869dcf8158e89 9e450ffccd91f39076ac1a6c847bc26954b278016648c1d510df72a70dc8ee6c 63961140a447367ebaef7b7fad824dc41f422e4c697a00b6aef991a593258f01 a1187ad7ab6cb4e94308daa837ff7a0453361decf0ad3c63095dec9180ed4bc7 8fefc95b3f594ad1560a4a66730b0133e2726cb4ca24d75330b451ffec47d79f 758bfa2d292513b936fa69cdd2e6da08052518b9b950ffa68d6934a1ef93c72a 1b8816528a4bc4ffbe2a000479928846238233fd8f3b0d87f8b3ac19681881cf 054faf9242b76ffbf415bd3608696c6e2a53a12b885c363fae20f5b76e243aae 8f87292844b5aae299a5320f225190587ea22c049bbd0915788694d15247c52b e0ff68a7215d68a14af6bdeaaf1d3f25fbbf579c1467b6cd94b39c6d8488d552 f7e5fcb7b2890cd49312d8e97748ac5d299745debcde84fecffced06c5dab2c1 0c2ec6fc6e1154f1a2d5dc512d8b3deb98d56c52ec8fadcb9229e5eff71560ad eae13ffe5667860b9429dbb191ed867b4307e657f91b55401be10eddcb0c0287 5dcf9e80a749162bca46f384dbed2e477f86dc772f7c6bf13b4555c634297ea0 e3a50ac40509ef2951f4d055a300ab2d2fc79d8b1906abcf9ccbcba39b59374f 182ffd0c0513ea7727cfd77e860290919e856a910223bc49f581cbb59febc89f e386633ffd17624fd60af633f089270cdbfaef080d96336f50caa3e9dc4fb987 e444a38510d9c7d3d648fbef98834de4a800ff0bd8c475ebd3197cfbb364cfb2 dcc1d5a4ce19ed1942e89494ebecffe1efe5ada68d738d20db499f1dd4f21d5b e77c73c7112900c10abeefcda629506c37d17fa2b771f53e946241fbe1723a5b 815fea6e6b055c818ded15acae9316447eb595e2432b06efb8800c9148a2dc33 6c9b4c7c2c981b22344256ca9dfb71c4ab798a5992e53fa2ffce684cf74f36bc 17ab2ce972aa568d90c920939b13324c33c1d1bae5295836386db6aaa45010cd 24d43c33ff60eeff49ced1c92a5c83487593877c8436f5ab43146106d4b58f1b 0831a39a17a1c8f6e51d546bc486bff879ea2aa032b632063af133a3b04980f8 908bb98c5dd07cba454900a93e67e1a290fee0f8a595eb8a9c03f17cd4573eb9 86c2f083ef9f083abeaa600e3cbb1818aae11100da62459e9b5d03f50ae854d3 b68f967e567de2a8a9fb945d86191ad9eef54a64e1aef7f677b0efc0ce2b4485 90627332f5fd518eee19492a159188c8692d9648f2cebc743dca587688993432 e74d7a285316a77ddced8d8dfe3dc6f0b69774ab0371a78bbb674a0913a95d8e 41b6c0722c5fbda8f335b359e66c967df6d0fcece22e8bb93c9ff846af8c9cfb e2269824d646906d1c2cee26ec52f9d191fd5fceab7a5c7215fe2f88a37edbe7 70cb4737105e20bfba0664c8fad32cfc38e1d742bb094be37a89fa41b938caa7 3b78f7e96783960a1de2c82db2c89a8b82c04f1991f5ac23df2c3f528765ba20 f8be3698f5e9f3a753c010fe83293e80bdf226b21cf3de9fca0bd90431058c4a bda3d03160d3034addcdc4ddfe2067901727d1e58a971908003b88f8ada0dcc5 6f6d771cc76024d0f9f41163a0d0b8c517f96a0f1064666d0c8fb695b6410515 2fe0d8095a4c0ac86ee791389752e7cf9ac2d4c2b9661f4869b8fc065dd11e17 447a72c15ba1c3050ff29d1b8248f2d6bfc67cf33e8cae0da9a5c8eb9d99da14 3e1a5f2acf1d88e63574de13c384ccc09c126104313dac8e216f631615357e70 b75d5206f79a44a12724c95b8284c8b7eac7cf26ad15df05ff05e9db299187a7 813e517542a1c81c1347031d43afae69df57de70c12ecbce3172a40ead543ddf 908009d8ca1e6f147e0bf93aaec0c492bb9bf4ff57137a49a49f81efb855c31e 42147a880ae218fe1a668e403189bbc2cfc7024c152758fde60e27573d99c82d d55de1e071a6da9569a9e564d11058098962c05348c33c23f830b900a930e8fa 7b533fadd84246a774d48b56db6b6c1e797ec2a67caa7590a7da1f3dc70bf512 5dd67ef2b3bd77188f94c9e5e20da159ac6df2ba0f517f03f138a54f3407e181 bc814903f2f4f39e42dd2fc19dea72a17fea3361768e7c3518e050a475e8760e 49171708638d21ff97dfeab6d8ba3423def586ebdafaa4cd5c1d7fdae7c342b7 13054e8bc50ad4b7f48d461167371296cc7df1b2723187bbf2cf0d27f11fc1dd b1f099f61354aa3558d70c26d3b13200fd9587d91b8ee7c225c7c8d643784630 9a32df0b2aba956604512a802efba45e3eed5f10201d207e053211f550b16bac f51e2a957767cf084ea695fe7cca74bd0c1be6916ef6c19fbda8f04dc3b78f86 1aa40d887ebcf0d00be01477c136285491f8f7d7da35daa46b8beae704b702ca b2dc441a0d1f892dd8371729a5f778dc195d826e59c285015928117fdadf2761 963433a1b1cbe880e572d8679b843d2f8832a4028d0cf01ba493345aef58bcb4 74c61bba4856f6ea39814bba82bcd4f8bb30418f7bf0c82a5db23839ad05dbf8 71f386b0654993650ff821d0f89364ff22e772e711d0096d6c4864538e137a30 a303206431cdd29397fc09fc63c79d672f171657ac59c1429ebbe089c39cb500 e1f5df447f7ffec5a020c2b080b5fdade6e588b79cf1a2efa65dcadeab837183 ef067113b5140a7c94c09c04de44fc719ffaafe27b13a5590d58d3ec06d956a4 6902f0b5003eff23d361dc57e344153759b471b379403b1dd42c9e9b99337bf8 9aa6d5a436d7d4b2c510ba9a033cf56a3ce7e662e2264ebcf254ef72b340b499 57c347ef73a84fad52ab02355a6b7d4006b0accd7fb83adc113b6d6cf0605f8c b5dff9d45816b46742fd295e49b0eb02e47b8c45a931c602fe051756d0dc4895 2147da04e44ad3cff22e942ad3528afdcfbb2144ef88e40fc9f4dbc716330b77 fce36fdb4109469f7e77cd3dd931c19b6ffebc11dc2218f35467ed7c258bbdc3 29eeb010ecae460bca2d451bbdf942d573c76a2b423011ef782f8cb6ef04ed40 fc4e03209c25359a1847f3f8f04f00716a322549a83efef141d3dcbd931624a2 0f6e04495b4e4278c22845610f550dd35851807fa235ccbb9a507041f47fa8d3 c066b113afdec6d8eb20dd32f7f6c7279c10399e9bf417550e53e83495328cc6 c598d0d14738b9e5ee22c63ad670e893065f6dc250f4ac869ab0a79e18a29020 bb2693ed1a16e211e78e870ad5ea185e1a5c7ff59dc3cbdc09fdb2aa8a46fc68 f446c1f99015ac60225dfe57c0b18b85e144eae4979d3a0edbabb6571ad366b6 267089f5259c033683d256ad79c5a8654cff6293ba810d9d183acb7ec2018c8a 6b3ab0cd74deedef5ee213f87d85e1438669a92e66c26e8cdd0bff319fcbcb9d a8cfd67d528f52c84423c92917c2f054270bb507f8a458d73181f9052cb39058 841db8d6f26a2969456761ceefd59434a55b45208ba7e37d3829c0afbf6844e7 27d731a0af9749977efaf05f6c5b121edfccf80d8c6be3d5092ec020fe41fcba 68c449a3d9cfa27e344ef6238a8e61b79056181188031f473353a1adc7667552 850edc58a5b3b9258d87d2eac686887d1cba7aeccaeeb4122a52ad61a22036da 87b7c02ec3b7995c46146e8aa36da7d3fa944ad6347fec3290c7f06b9f534640 d515faec9d4fbd6a800e0c35e41abdc794150dec6046c5034fe1a9d1aac66012 456deeece308b258bbda6ceae9227b909ff1498d226cbc0a03cb085614257f0c 4ba735969ec05d51d9271498a6b84c3fcd71f48e917da90b8329f029296d6083 87a0a419faf52b57bacfa18d47019dcf90097bb30746796280a9d4e7aff40538 b3eab128ec5986369e05a34b9c7c0b91b37e53fcab3d127ec239362042f3777f 6494c9519e6f1a08c7264b3f60de0408726317dc54908b6d03b47e2e3e31cd0a 494a719f311b3b6867ceb9588d3a83ce2285ddcf4aa4ab2f1a28f1411aa3b42b 4c8fc2d2f10827d1653c2ee029599591c9ce803a9579390ada082fc79a706e3a 76c65640be3939db8f33395e8137417b4ba57eec2d45b77aabdf99e55f2c9180 bbef6b053408fd8aeadc41689d867391bcc7934f37c9a681be9cfe753c23eb09 059fd8641101720d9bba1bff64c87732160cc564c0b31b1896369e0a8a1a14e1 1330ec97af369c34a0ca0ec77f1417b8ead643277a4387c048a921e14b80c0dd 130bca57e02c18ecd0f94dec5d9f532bb10782cca9bb78ebb5e3062b5120d88b ebe4fa467c88bb4ccbc9db07a81a10afc8dd5126a73852cbeedd53193d21b3ed 98cfb655bb789720c0276e502a19ec2da68756aeb87b2b7b668d18126a7f36e1 e36e8a63ecb4aef6fbad5a560e525a32ef7c8af9b1612f9a19cb66a7820d5a0e c5e726e896ce743f428f8b645d10bdcb8ed4b4838e6175ae39784bd3ed65d9f4 b8b2a261428e5b17eb89cc5fb01a3808a7a66e5af1e5d741dacefb7c10762cc7 f5b2fbc20c8f8c4e165f9329ef36b1cb6460512b37973fde258ce54ea8bcfa6b 65a4e193841a20175bf1ee0ffa9e9613c21246523119f20c24c85025a948485e 5a1bf3066b1454344421dd8b6554c136f31ce3fb2e8ffe0201d9f6620a6cccb9 56a81b92d8322974996083eed60027fa27964720cb6aa35cf127aece3b8d500b 08c0e040c57856251e2f482fa3a9be04585dc087476ccadf846fde75aef91655 fb9e01bb2f3e4f9ea066ee7fb418750bfd29b28e04c376f14672582b60d2597a 148c3c39f4b1c1d7ff3b44f93e21f4afc082bcbd998d1a369a97104f46c06af0 72ef3db250a1e80567bc35c894d4423d303f61be58f81bf7f154b2d4ab7b8106 938ddfb7acd9d74f65651e48010005d679021fea176729e58ee9c818a7d607ab ba46ff7a96ebc076af1f3e9613cf4a81bad4274121f53d0b8dbef02284be06c6 e9cbbe0dca9836b021d8aae954ed42e614f6f8abc15885c0e2ca89bb3d99a9d1 3d65cefbc0b1fd428f610f19d637fca4c16eead8cf2bb8827574a9b92fb17ab1 ccc0c5334b59122c4e675a8ee49d2482c6a36a78b17f35113f31b3e3b1395bf4 7821f15c222f4b818d7b848a05f44aecc489afd85ecd9f4862bb6f7a2ddb8be6 5e2216aedde52ffb88aa6139736cadfe5c46458eba66d1044ebcc65246add82c c21537aa53e26587e327e5209586561026967c9312f99e442ecf8143f7faa047 3bc0db308a6541b5049fae2f939ebc48e44f2669ea691721501a2a98989aae7f 48f9c600cf60f21f9d45d77004427a032a58329a3c368f0a065dbe3db1856721 3ad4f73af9ccbfc2c0951b89069d1ec9c3cc9b0fd156bb868220884372c0e203 0f2efca37a5afbeb4b82be1ce416f96ae93c49e0356969c3cdbec2436cb0e4ac ebb8645b989b9867a48afe09ed7cb9e665d921ec651bafa41b3894a2e6b90e04 bc9cdc4f1c52f6c0b142985f40cd37b2bc8c6a79d8bde5a120a9b7f366390770 d2c9c090a2f8cd254b408e5135b430300c83fe83e2162e4774dc129a0b62dc96 a5bf8299d3adc267dd7af6e0a7ec8cd92684afec4554e3583a34a88a673e6905 c164c9eed81983c82fccf45f7f5d8bcd70e4bfaaf6a9aeef7f15e0166543e072 e6be0de1fde8eb479c8db3dcb657c460a6a05d898d9f7ee319825fcf4d5b9a06 246f6bd914ccc57e3acf8b3e25a4b0b18a21dd966897b825993db0c19b15983e 58b4bab176d24f1a9f547a426b12d836cd4706d033adc121525e5874671c97e3 cc09581637aad7a7085e4df19b4b06e8d5449a463c460b0a616403e1bd46c2e8 5ba316839dd00483d21d1ebb04580bcb10bf0490692a60f888df00c19012addd 91590da537bcef25879f2d585882fec55bbc4298d3c4d3b32f9f0e11d8c569a2 1f09aba86bc42b00b325dee7cc93f358f1f3aa5eead382cded17e3550fba9f23 8d6e1d1b94334570b2556a15353f470a82474bf51f301164d5a1bdc566308e0d a65b82116242844bd4402475e3f7d3e81af9131ed5f9a04a94a6b050bf10bf63 0703d5fd10df4ed2697f21004b0ce8348d393d80c516c8cf5acef20e52362420 78684d9711bcce0a368a9449188d848a753acf2deba768898ab2b99cd87dcf5f 2a5b9862c4774a9fafa9dab6dad6d14f7ae2cfe24e9849a61222f2b2f71dd20d 3d6a52e8330c6f86ca5e591d9cd5e91ee449f0914ac23c416fb8803159ade975 41f8bc878948872b0bb99ed2081f90a952c33f05a60ad2d449ac0abdce682f4b e7c80209203f1b93172c19ff6f8deb8634ccb219424eaf22eb9ce0c633188682 b5dad8c9981e4b102a66434921d07f38d5f0b63205b22b7e2773665c67ca6187 9b19b682b4078cbc503e8d31f63d8f2bfe38ed4f35bc6a4d0e61d834c766e6d2 8fa14e99c960bc41a36d00633820b03fe412c162557e9c48988024009c5bf634 c6784abb75d9cd095a4b71bc814101d91b57e57cdf9c639068cb570cb1345528 8b74d6869862bbfd9082f5280b52d963d35143447799d83d5649f418696d81de cd3e443eed11522e09cf69f1f3cba1b4734f916185239bf3d8e203adbadb7cc8 6e73fa7e0770c10f413f91c2622a4f37feb4ed5efd9ee2d49276124a42dbabe9 c8d188261eab7264db8ed538d3282a1a88959baa1263b7301aceea6a25c72fb1 110236b082fdb3d3c0a532e1251aff6645e41f08cf8c057b35e3ca6849aacea9 4797dfc4564885dd4b8ea57ff1c5e04aff7353206d5da6917bf6b08d2de3f08f 18c60419c9e617f4f831e7bcfe032f4e02c6ccd5f2346e939f22b856966a1dfe d5586541ab2d747a119aadadd91b8501440e12c0ea512141b6f954fdc0e7527c 53e6dd2c91fc4d536e3976cab549c3d13b6afdb2943718090b0561f62154de9a 4bd0841dc241bcc62494de8d5ba057bf9f38250c83f7d88026ba8f5bfe9fd9ac 3ee48dd4466bf6d6835eb67e51102c81c824f09666aec1a51ca8c6a2dddc1c3b 37ceabc7a8b15c6b5db663f47ce773da01df1f02f8c40f517b69395aca67a932 bce8eac959fd70ccf2c7f87841efe0bb085dbaa326abce2e4f8a2e50da274d5c 52a47b033b2f3d92554da472d4589dffbf6728f027f5c47a00a956d1c4689b0a 1918386de5c405d97f56616f808369a1b81d0cc0e979a19e905ddb97ec860f17 75b50b5dfb59f1f8d9e6902bf32e6f486638c43e4c2e179e170c73f5dc411331 c9e625aefde2b29457eeca6f4dc407c466aeff414aa192673a5e60e80ccdfe9b 88dbca5ca3a893fff630fef7fab3bcc22e60367c1b5ae5f9e6c3bba3f155f2ae 1aff8e70046decf2fcce170a143c8d9f2385642506d62b77f98f8adf5236cbb5 6554166fdbffd6878aa644e907ddd9d4122173c949705e8f1702c5f832c30419 06e504e4bcb6ea02d5d0296c54e2eaff92d66ec5d5d212918bc7b9f117659042 3424b9c467e0efbce3c355e4a01811d327159fcb039ec6ccbd60474e402fd105 03cb12f13ae0a2ab16634c9d09e5f51c7e1c2e109c7016a413dfbb49a78447a5 61abb41cfba3017e1aa2767b1e401587cc9c04302c566288e7bae7ac2eb2162b a422ee034f8e433af5358d4c35df5de86928128d33a4f723dca1192a81b8b71c ae61afcf8918ce1189bcac2e330bc7b373ca48e33569653b5e96567cb9597c24 2a8cca847d878b77c62f37ef671f48304dd846aa9218cae8ca7a35366d6f0dc4 ece05c611504a8b7a66d634f1926495bf58ee89ca69ce7d8f7b92783ad229a3a d6ccd803727d88311dd547b937dc774161d87602c5fb49a16eeb938f2755e298 48e82a6ca61721b2eaab460718ac8e8e9aeb8eb156f4dc6803b63a97b9f1d117 880d22f27076fbb12fd095a6081983b713fa6d09756c320f40b6423e8f50e57a a1fc117b95f0a3b82f04adbbb2d86746b73d827817534c27f414c7ee6becc1c1 b3216bf1bd8b6c6066fa166e2cfd7d4bb118b10596ab29e66c57a7ebb52016d1 e5bec29b69d4de50f767030754927ce03dd3efb31d394c009b938e93cccdd431 7c75ec3bc781c88731ab8585c79a42538e4a9c853764d44b12660fcd4168fa27 17d0e57d9f283fa5fd7b0c2f6854282aefffa5387282cf91997f01768740ad1f 5c616e6acad20a8e79191561e8b190c9c00a6832991b166d2ea01d09eb232e15 b4e7782375b4befa7b8e509e401cc5fdd06d5067f34e8510d7602bb869f92c9c 681f8446c3fe49b8f76f56281a2078af1198c3ecc83cc97d2dba5e4a062ebbaf 94bc9d2aee72f29dbed4e1d2baa221198e3f6437ee0e74dd3fc79e991dcf8c8a 37a0d6c68b30d90811bce4f0a42834f6feae4966ec516c12b26056cced81c42c b01fd8bdb240aabe781d697ca82b9e43835b2a3dd40fcd36063c882a4aa53dc1 178d29e4ebaf275b8fdeba91a5786178cc4778913a142afd550f39629cf9eb8f d777f38008e50362a510f63e77e6a9d04369d6d0b75223fbd5bc3f4126fdbb4c e2b3833bdc4acba60f42e6a1b40e62f28252285edb18c8747dd9 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMR10 %!PS-AdobeFont-1.1: CMR10 1.00B %%CreationDate: 1992 Feb 19 19:54:52 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.00B) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMR10) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /CMR10 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 161 /Gamma put dup 174 /ff put dup 175 /fi put dup 176 /fl put dup 177 /ffi put dup 178 /ffl put dup 179 /dotlessi put dup 183 /caron put dup 188 /germandbls put dup 33 /exclam put dup 34 /quotedblright put dup 39 /quoteright put dup 40 /parenleft put dup 41 /parenright put dup 43 /plus put dup 44 /comma put dup 45 /hyphen put dup 46 /period put dup 47 /slash put dup 48 /zero put dup 49 /one put dup 50 /two put dup 51 /three put dup 52 /four put dup 53 /five put dup 54 /six put dup 55 /seven put dup 56 /eight put dup 57 /nine put dup 58 /colon put dup 59 /semicolon put dup 61 /equal put dup 63 /question put dup 65 /A put dup 66 /B put dup 67 /C put dup 68 /D put dup 69 /E put dup 70 /F put dup 71 /G put dup 72 /H put dup 73 /I put dup 74 /J put dup 75 /K put dup 76 /L put dup 77 /M put dup 78 /N put dup 79 /O put dup 80 /P put dup 81 /Q put dup 82 /R put dup 83 /S put dup 84 /T put dup 85 /U put dup 86 /V put dup 87 /W put dup 88 /X put dup 89 /Y put dup 90 /Z put dup 92 /quotedblleft put dup 97 /a put dup 98 /b put dup 99 /c put dup 100 /d put dup 101 /e put dup 102 /f put dup 103 /g put dup 104 /h put dup 105 /i put dup 106 /j put dup 107 /k put dup 108 /l put dup 109 /m put dup 110 /n put dup 111 /o put dup 112 /p put dup 113 /q put dup 114 /r put dup 115 /s put dup 116 /t put dup 117 /u put dup 118 /v put dup 119 /w put dup 120 /x put dup 121 /y put dup 122 /z put dup 123 /endash put dup 124 /emdash put dup 196 /dieresis put readonly def /FontBBox{-251 -250 1009 969}readonly def /UniqueXX 5000793 def currentdict end currentfile eexec 8053514d28ec28da1630165fab262882d3fca78881823c5537fe6c3dda8ee5b8 97e17cb027f5c73fdbb56b0a7c25fc3512b55fe8f3acfbffcc7f4a382d8299cc 8fd37d3cea49dabdca92847af0560b404ef71134b0f3d99934fc9d0b4e602011 b9cfb856c23f958f3c5a2fbe0ef8587d1f5774879c324e51fcb22888b74f2415 50d7401eb990d4f3a7af635198422283cac1b6cd446ddbcbd915db9bff88844e 784c6bf7389803d9450b0c21756a017306457c7e62c1d269f306bd3402e266de fc3b5e7d8a8d2f5bf0fe6ddd40d07391df4fad4a6018dce29a2b8f692b29f202 3a7c0e66de8ed85c14f1f8492167357f51a7e84cc5d92e0fee4d81cf7fbc8de5 2d2e7bb57142033993f9c08c315abade8dbc4a732e84e142d3bee51557910e12 cd8aa37c459a5e6b7f5269f59078aba3be4641a11ac48d0b625c8325b38ec08e 4c9e5e7fed976a5650d99d82114f449b9ca14c4ec957702295a39a93ef93f618 99b8ea06b092c3c1e503e6e436e0a9fa22576c8930ab3dc8c20f5d82b69cddf8 ff4dacfa9c54bed5a3aa3ea5b129fe96be632843b9b6bc91b615581a985db56b 1e01ca60ee69ca92cf5c0882ece62edad3e106d835348822400f0b66af658f2a e56ed08f8b0010571807009b73ab12a8cf14ca6c71f03c2a48c500f9d62266af 154a6375ff600d9bac3f05ce34142d6867a79581c533176bb2f3117336671e2e 44638a97167e2ea9644e31ea16c2ad2990ea33c54001e0c8156e6de8ab6a4d40 a7137ba275f39589fea2e2db8256adc103d6f9cc038037a47e8fd469c5f98a5e 3c15bd4ace40d340018b1cff7d1ed8abb0ac57b5b5a2c20a51957b96c453edb7 dae5affd91a46d938fe0a13363001d844ded4323f1ee6d30012aea19b024a552 315505535c85dc26bad31e09c50e6512802976d298c4e90d0044c362e6bf3ab3 62a454ee93de25ce54411090c29e9d75c80ce26a84404bd9de3aee0e3f921ac5 87f907572b8354a5c3165eea7e8b2ba4e333802132f760b41a900c698eb3d273 8bea0aaf7aae96a558f08b61aec7c7d65b2889bb7b99800cffee5ba19ac90fce 11437be1ddfcf0bca5670b543b9644a71c8726d0c1005abdb96f6e0cf7caaa31 95017ca81519151c2c0b04f81e717c0691b63a76e9b25329ce2625b711cb7bf9 9d23ec2bb5ec8aefb8c1a3b422ad617b3da4d49685fd44cc21a1fe5e1541163a b3e1594601d63c7e98801d7746474377ce93f81404f3570afbd5dbfe77578605 917ab96963987e6efc2d3f99fa56ecae6422579852567f90cc90e4ef6d6f71d1 858270205477e221018a375ca83c572b3f972c5181d18643cecb04909d84cf76 7174b3c0c8ec69bf1e9fdfbc0fc7ed97ec67d878ea4ddac8caa522fdc6932df7 21b81af837ab56b547d4799241310d6692918fcf8a46189a78d6638aad7cb446 2d8774ec73d184076595c94c0b4a8233cd34f2d92f6ff94f941dfd589def2ce7 90d5cb2159b953338c7384cb68c11779120a68bfa20b993d8c0313987eb96a2e ae66620f9f9702e3ad8bb05a9028d7c99aa992cfeee3cb990cb2f2ec7041e786 20aca3c4c9e7d428d67f45724e31fe6ac5d01a91ccf20c2e00527689f8e65320 877601ad781c5c463a3f0bd8d4a008126de41dda2dc1e85e32b3ecff2e3efc4b a19de0a26ba9a5c2abc9f3a0d365afe379ffe818588480bddecb8871576b4aec 6582059c00d8fb5e1ff565c08ea27117755754ecb84fd30e446c481da914da11 17971368891b776e63b436c263fa5c1278896fbfe6dc226d5405076f35ba5eba 6c1312c59d2af7ba5ccf0790af5a860cfb27f92472af12c8a0c76efa7279079a db724f7a561c37a274b23126d93562d043a679c4ad551f402d8259548587b4a4 d21b797ec6387de4c129cc3d09e7605d3775d9b4a66967549e6110dbb174bbaf 429296b86e4987e4a17788cea3bbe47533db69ccc08618bbeb0cca2fafb87184 103a5cb7a2326c0192326a6ad508c84fadec23858fc6a1ec4599bb37cf3335ba 9756c6be1e10fb1b9856c800231aa67a90937f21d2cff84edcb5297d4ec77f52 b11f1580b25b8845ed262a27c4019ca695746194bfd87111befe9b53061dd57f 367e67c33d6b368469e4af95ec88a39060f99ef210df1adedf3d3190817b5fec e4d9cc611cb1bf003208593e7ad58e25871a9055c22c572934ce275c139c390b c24ad874f43d2dc853d37dc6a2b63d0fccd7bb0b35c63f878db209bd3fc560a0 b274375525d933e8f58799e430e15d50c20432d7b2516d1fee07518d86dfbb36 f21714d1062ab08b78223da6a1035cea0fd5c2c32636cef87af2768692acc7f2 dc0bed72663f40feaa40ebd68940ed305374c21d31603c6e267745cac83d9101 a564e57fe3bf6cf1a9f6389dadc48d0836ca49a7d3db8e4792ff084d48bef957 662472bf3bc2dfa23d5969a27ce64eedef622432ee9543dbd701d349929e982e 0ac177f9593c563eabf9b840b8fa06aca3db10bf5dd1688d5b4e255f48067906 75fce30483959127e090de00b4c1f689ee1cfda0f1a88a09b085a9b5021112aa 510d7219355ead54d1f665d939d00ee6855e88e80b722706a0b7ad3992310669 6878e0893c877d6fa5be869ccbaaae1d603bcf233a63746f38c301807c1c16f0 bbef2166d5344986a1affd1950830795406c5e274a8c7036ff36a20284bd5bb9 16ca3bd1282f3dfb01dbefb1e109e1623be7c31074f89bd9207edf2ec3732828 31c1b050f4d262deff4172859d9bdeddcc0bd7366d842a3d61c78b400f35abf0 b0e0e7ca2bce6c4dd9555f51dfcda05894ca71d3f843f8ed19c3efc33fcdbf9b 0cc2c6aad16d469a418fcdd8fbd8044be84e08387726fc726d300767f8b3af51 83daa9d884a93c262935b16e6f1844e7b847aabad21dfbbcb7347aca81e77fd7 d3e87f689f34141731b0fdbc4673b489beb34cbe42b32ba131752a4aec9d9712 7bbe0fd05db617f7b7ba6c376a8b4e29ff87b03864e0d1978d0f4cf4c62ffa0d fd7cfaf517055f2477763692ba5320301cd6f29b8bc4cb072ac99d51d75849cb a88922ed9214aafb7ff6fcd5623a3c1b6e28aee98d02a2a34de8604ae038b35c 774d8be877d248b474029e6efaf166ed84a5424cce2407657c679d5c1bb406d3 90f5533bcfc80918f9588afc2cb65b31f70cb7ac073d4f25169eb80a74a055cf d1ee7d088ce2b6549a6e3cf1dab35ec22a643eb518b40564e499f55525836569 d75a815a3e85b516fd46380db514a38a6f52fb93a28850f27564e5fa725733e0 a62127fe3929cf561244007b21334b0f08b513a3c3dcca95eb441d9b1873c9b5 3ad9909da01229271c1659f952263624a3578fd0b5ffba55fd80b147008b3960 8f2cd289fe4913bf784871289eefb0657c1aebf09d5235fdb23404ae1cebf4cd e937afed1d1403d8f2c863a330a5c9e1adb07c7f880f287ae16709bb41117359 2af964029578cd0f6bf15bf933f823b398cf594317bd5ca5200ac84183fb7c86 ee32fb15efbb25e637ccecd55eb9e637762252d5a8fc0c48be7b159084c989eb 3c13351cf8917c32bda33cf525547e653b5c3780798278011c576ae8d2385c8b a0b2377453b8293b7a356c8ce54d246a0f5a74bceccbe7256083b5d9cb48ba3d c4f50632cae8546546469c5f30ec5ed63d4feb1cc2da5fbb0a14e326675f5bc7 974cd9cc2c5edd36523bd073cb8dc55041ef63d7f6e91575f86bfc8f3635021f d9f15d11dfa51109c18e4f8e52c017d40eadcea356f3ae2cecc22c479b074abe aced2ac19c8b41cc782d8ea07ec8ce18d8d5f260ec3a003aad1c9e0f023753b4 31206a48478fb95db2b8f0db0fd427f1077b35999e4bf6a3cff97e4701c6bed9 6e0097af3d31403714c4f62469155e0e4fae3cf532c8a7cef6d55bdd2b40771f 7317afe0dca2a7d55ffe6db8b297b61f92c4614a430cbd89919e2ded2ef29fb5 64ff9802d31369ca071745b210b11d0178b4d215be79283a93c3c653b3c8a9d5 70d750e839fde338f8db8be4462a069577ba0df8d9244376598d9e347ead30b8 2cf2530fa45b1f136a531f3a208935b7a838f84762f5e9aa7b4a5bf363fc96b3 602d5a96b28e602bfaadaf828407e0f0a276f38cc9fba27b18c7a92af7917795 f4ed06b6252d226bad4c4cf8e60a9f196e3e6e5572f83a979de28f7004968ca0 f3ab59eca9457dc6adc68ce5164877bfac7e7e79bacb288bbd63ede6610f8b90 446def63ed2c49c3e42a537b02cf2246da85262663fdad778dd31720dab7aefb f163805affed72781f68540dbd02f2ad080454957eed618bfd0a38fd6d3790e1 3220697037673ccf6a35980b44addc4be603720e868eb967c705a43d1e6f4346 c1c306ec1b3af4a950fb6c1cb82e0d6170bd0c80e58ec4dad0a5d56c966d747e adfc7c599922eec5e6f1318e6e95473ec9fd7161ec457588ac8b600cfe40b2de ff6bd11238253c8aff38f8926b8ad3e8ed8a6952ccfb7591d0d75c9a40c5bd97 4dcaff327a316859b6356ac5b11a79717f5c43771568c8cb604096260c1e29a4 c2d5542555dbb0b3fae3222b2a4d5331e365803eab63cd463a9543157d0f44f9 c03f690a9cc114646b3084387bb974aaa847668ad93fd83f72169e480d70ecab d6f59660ddd51b6648395693fa39485c4766e4a67998b67d3e5e88003ecf383c 59d3dbda317d3eca85b2a2cbbd5608c32d7aa3cb09dffa2022eef98477560ef2 7a69da83ba5f3bd79bfe2cda55951cf89100d0fbffb057b0bcab6bde423656ec 7a0aeb6dd22a0adc2d0dfb4e36400a2707c2714e7879f1adfad5ab9a5c3b0c53 38e666aef27598a1413ad4ba3262f3adcb4ddba24699760de3297dc8290f0d2b da5e65ebfca0f45c6a5454a6738ea3541a9a3b5ca70b0d19a6cc46be048ad9be a720d25c7e57ae17a5d6df3cbdedc359e6734f6f593b7ac192f7ef9b22804dbe 2984ef33907759bf539ac6b179b34030df349d403bd4f2727e46e0f5fd8caf30 9ae7f243b24bc2373125e7d9eff9c6883b3b791adc21ee7185561b969a1f278c b573494125c8a6389c40507aa13f4f2e861299a2440913dfea3dd5a2ae1dc267 bb1f45464f2f6a44c79e4897e5b5ddd8999014c2b7ec02e51b8bd2ed47fbb26b 11abec925fa9bc64223d0e0695229d8e8052b8951643e0d62437e774ea299bff 7d27a0eaee51e30085aa472a107bdffc657e3f6fc89e5d61fe3b51a6b766109f e8991c67b4d7e5eebae48a00786108aa053a67477aa3e1eddcccfc9ec0a79896 060c738e6cb72afce624dacb2da7c45bd5c67010a679bf91e366a7bb02d9acc6 dd977d57cce1e72632756d7018731f4a68c5aba49a3bbf5c60048c43f6271c22 17e733d2150537b16d0bf33bc4c06e166db97955c64549f31d4a720b5adfbf52 ef65787dbd0148bfbb952828a6c877b2bc892fbba1b1db3fff5122836458f9f8 179b83cf510ec958b3b92caf8800a7cb676a630eed9a846e1474410445f327c3 4588045a6de05fbe252b602378cdbfa1585bf9bb6fecc6215f7783d14704cb18 20c19e17cde8602d8434a6ef796a89f1b325d658d276c829137ccdc763f17ec0 d50697fbfc9c119092029205395bc68561d5d012a13bab8b845e15e291332438 d4038572ad012d033fd23b5ac55fa52f4e8addc351b363dbe789d83b29675b4b bfb6384a2e7da76c49c8d175bf2bf1ce2cb163c42d5209afe65318e80d183de3 fb475e0ab9864c9c5a9e3902d92ecebe530c17843cc579a87a030c9aebb47d37 f1b81f9e8d3ac2e5472efb76cb18aeb1118f7638bd80b46c17d89b99c3a6c33a 607bae9a598de5e965e49551157cf43d059e242a37fb70d7c45bf8a70910c8d6 97857646d1cfd37ae6d898a6c2539e761e7f47b801908a63ddf5a6b225ab924c dbdfcb5081047827304543f5b616bb4e154d82ec9e313fb3be0de3a181b1be83 d454ff3574aa258188f01e3deab9f0a14ec13d3fdef669f3537998dc5182b84f 71f55e252abf556c05d5e8e14656a96702bac655988872c6ab5bfd2b55f9a8c6 1e11e906869eb4803af4d5fa77fa405b555594f9da1039f7ad86240266893f19 e3693e24759077bc544053a0a686e5089975c63652746f360b6b76d7ec79d9b9 fb0e7053f7f895def47f5ad6a34d02c9668f18ffbd76cca97bfae11f1c8fc564 3ccd910597c94f47bce9ca3437d55a5627e3f8695085d8844b6a2a94ab8274fa b5dd2cabf9bac128fc638ca045964f6240f7493342b07a0de8439c8d80db96c4 71ec2c9fa4d0259a107eefb346257037503020191c148e96f52bc3c3bf1ec637 74306b00ada451db91a42356a54128a0a4324eb05053064fe10dcd166d1acf65 8f7d592447e27c4ce2aaad89f8c0bfed132bc5c0e49cd8d78d73a6e61f1d32b6 4d1415961df4908659abba203ced49cdeecd3124b74dccdda43f2b3f628c9979 8adca12927b796e5dd089e6e880b7b10abc96986b1766589e05f2c6bc02d99be a2642fd9cc895391a08bbf99d608beadb71aa391e7219c022002ff43963a9e48 596c08ad66593575f55ed1608a87cfe42cbb3d54bdb09ee857c13b6196c26292 8f58acfd348fd12a7c7fa64f3e0fc233d04eed19ce4a786de8c8480368f8e188 b9af4ee5fa22fbc77a253d137085d7afc7febdc0421f43c590ec2337a2d5632f e36d5415cc83c4c5df8161f783f02e1e8044696882bf8ec911e2f500edfbc5f3 b50f001c7be1273115cd8f8164d73681127726d9cdec9357ba59ac01982ea294 3c05c97d76417237d313388c8e600f2b48dc97f8c77177469218b2ec978c7acb c2bc6967b01beb741ae647c266c3ac0a6cd320b57710fa8372b1723818e4c312 d618ab2d2acf7216f1540e9e49fbc14cfa52dc179bf54f89599cff962f811ec5 3a7fbdc6a5b4b02b69040133cb19fc50563a67fe304c367570a30eef7199e9d3 7f346ef6e63374dcb8f31d1a14bc5df8a60c785b78e71f90a4934ec9f0fa2675 7fcef8ad1b2a8b7cc7e225df88b24323934db69b9e92f083b90beb8152459035 696e15e5251f4d75b5fdb5a70e91d9ca84cbcfa2c123b39e0beb1e61a13248a4 425fd8648241b38407c35bdf39f7065b4a4a122ba274bccac257d66e1bf07da3 b2ab254746374427e99998f85087aad939b2cd25ea0968bac00c99b330527564 0fcd2409ed0a95f1ef942ec767b9eda327283f21d1d93890cd766157e7a66aa8 cccaf8c3b238ca1d68075ea4beb3eaa1f0328ff3ba2143f4d67860cbb5b3b172 3181313fc5213ef1a8a226ef0d8cd0b4f3977e2e7adf88e9e2278536137927cb 1abbab20d9d51b25a532450a97becbc2634e06fbaf3d689bc5c93b7a53fcaf18 1bc2b9d578aab26f32cb6cac1ebb86139538aaf1c03d29a26253a5302c363d59 fdbfd16c25ac1af722538c77effd7bac56f5e089a5a0529a5dbb4b32011dd4c4 25ccbcd7bed61eb0a165d8d8f9237bc0c7c685d1329b9a25569035c312fff8db 26807b5979dd46564cc6ba4c12fd47ac25fa097085ac34eb19df1f1b79e435ec 6615ff752f4497dbdafe44aedbfc43eccfa4b56d7860d9ab82c714bfb19c0bd6 c3fb5b61ddc51fb74ea90a89a7e1a5ec655a257e8cc492cfcfe0e6ec3bfa641f 605ea935b921719e0c90ce5ee2acfd9a539a09ba382d7d7673a057ccb9507b6c 5ac139a058a194787f44a7dacb5488a61e4491b436569bad57fb1751614e7798 57635bb93e4c62e06d04262c95b8bd3a8719978cc059b28b3c8ca226142e4907 7cfe943201ff01abcff8cf31ebedd02a087b48aa2f86469aaaca4ab4f5dc987f d28bf85ccd02e933a726658560cb701c8104cb378d4bd26ffb4f30e81bf95f2a 08389768b6972886a24969dce179d623ffee3ef3261d88f2cede6be47cd79d96 16d97747b75aa49ec67f5a86309d317d2fe036957e7a16121ae0378c5b824469 3237c0f539431bd032e213dc9074f36aaf4ae73a47897e162deb5929c775a4a2 75cc6613e180c93b69096c4e02a36cc96d478b836e3e2f3a28df58631db3d5d5 1c18c27f6ba44e4ed192d0438f2c19eca4b9c07b3feb7d4ea44507104c03ab74 f59b2485d5aff5c27cd263ced0703ae79ff69c10c493bd1fd1c6d0c0b1fc675e a2157b263ea894adbc9c09d998ceeb3573e569d38751f1753f2d9018ce526add 1ba494efd7e5ead1a174eff91e5b89b662d19c48231dba368bfe8cd419b49997 a14e89937a3ec07d5b660dc0885c39fe30021454859a197fa2c757925d875e39 dcc9144650debb5a9e2dc214916467194da546c5caf5fab7cc4811e436a7dcdf c705e40c8d90ff27a1af50e4d5102e0e0295f2f595dea535bb3f77867c1e5e14 bfff40472ef4e80984b49be6fa36735646eb21e4334c63fd18d1b780d46e20c8 88e229ea638728b9353145d07d43831927a40d553a6e9646816a5c1ed28bff34 9d71f58a17185fdf45b72d24dcff3545c3b9196362b3e96a5f3747975464d11b 0c0e48416c79674a87ba2fe05a1ca4301e03757e0ef6b9ecd45f15863a6f3c8a 9f07da6a1e8ab71df011028201e114199026bd5ee2563ab53af87d1f5db02963 46a32964d32a82727b96166c4b9aec488b92c299940837d31dd8e20fc2435836 f20b9e5fddb73b9a1e12d8a50b80bdba501aef3e0f7f7c639e74f9f4ec5211c5 246ddca6a834dfa7eb6db3a37b854c1aaab7c3ec84acb0eb0219279ffa7cd6ff b7e1f398b6602d63cf1e68e8849609897a3e6db4387243744ef12495fa57c1b6 c88a2daf235cf1166ea84deaeba57963354ec1cac0f0ec0754bc80f87dd34d2a 0db8e8d7e2e2ffb3a34950b47e2b6d23799853589cff060a69e818113ae7de60 fb0a749d901e66e1f8e924fb41a8bff9b905c0955d68262838db1aa9fcb8c662 4f381c58bc4033f337b312d5a626e9b9eb75caa9e973acd66a19323fdddb7abf dc9b8f431bd8ac879f8351cdceae404eef63a42ede456be0e0c90667f2c6a5cf 8415b021bf3aca97c3b822492279ca9a39d65d544595e366873830c4c0ec5132 c0422415598e6644f3d258ef90ed02680de35eecf89e9bfc5ad02312b672673e bbc9f6e81bc60e83ba017f1b366f1d99cbaed99fea4fb92d7904e674dd82a51f 08517dd645990bb789d8a8cbe07ffb8c3471c2307e73439ad3b17875bc9581de f17ff7bcf6951dea8f1b94384db526b04b9cd023bc9e46eb8a51412c5aa2e7fb 56ba01e1896b0512a64083fecb96b409985ca40dea6f6777290c31b6a26d776d b550ca99065c97515f575bbb48e3fcbad01b4c08ee6378ade2e6f97aca56ec47 b808020273f770609d02801637977485a9ef8e7efafa6df45d136f38538dde77 c4a2019b13c5c03d10578061b9126de432249d90995c246e7a5fc9279ddad14e 087dfd774ae5e10b21720e257c088ea5a74bb3f2af3da6b2aa853e562d7416da 5459625330d053e2fe4c9b201f8ffa177b53b00c841844b5aba4cc73bb050be5 72a13865803844409abd44c586ef67ce6e2a997f56589046f47c5107dc055f35 76b65b435007ff289c247c08a7ab990144a22a983f065188e96df2a28d9cb1ff d9d8a47046eb95c866fab6a26ad1c26b5d4d9a1d027c1c7a149983a40ed3f782 c0a8d2559c853773ec00732b62875890aa6f9fcf69314419d5f7accfe3341178 3382e303c7b8716e72c27c3ca192f5bbf02ab92e0f4f8acb3f4091654d3cb94a 2c3cf7ce67a1f1dccf3e9b3a891566bb5b571fb6d54a9e168bfb1832eff87931 d97c6273af56f9bdc530dabb1a97a19d95ef2acfb7b4fe5712baee7a940622f9 e4168eb1cfab91173071d0613fb1d44344b91d026f332ca6082ac46ccda264f9 889026f41ec34c9c22a1fcdfd7130b8a88ac3d850b0fcf34d60df75f7e16bc4a 6b0492f8c4672941290095aa27fe802d71b5ec72612f5c2d6bb85b0123e9828a 8ddf98146a42fa437ddf9a66fce48eb6dba6f6e8c7057f5538e166c7abf49986 4994a7f7bebaad76df74601962071ceb500506c67dc40dd08807c44b6be59881 9907acfa1f0a41e32e40d9552a65e416ef0c8179c0c3c3b14c94f0135bd0cfc8 0d6347dc08513b1fdba6445dc6c2acc8257786f4194aec9febaba20199a1a648 6d1724156f548a13f35ac6e8d2e8ec89c64bf8c3b882fe8a4dfa0b5ad172eb91 250366754d4876f316629f3043f7d074dad0bf89b6c70282aa3b176816d72b20 b44c8090c438d9060f551b3b504eca207abab19936ac2c05525eeb58dc17fafc fa73e7c5a72cbaef7384fde67643c875416345beeb6cec725b1b7fc6b0eae8ac f5d23fba96f349639001537752cbfd9c0902e6f8565b834859a0a27618bbd261 aba9fc2c3798fbd7ba8c86827887e74f7b38a491fbdbbd5f0c240ffe9890536f d549ccc6ece730f9f2d1fc71312f559a9627045f71d2302e7b8c05793e80b534 4f7d96e33cb17e27bcb6095f937e5fab5954cc4d543d73818cdb07dff4292e51 cc3be35f67871fefc5d212485e22b7b1875987c24a8eb2c0e26f80624be85479 a70ff55d5a4252815445979dd2d59814611f910f1c3171e7bee3544729679314 4e8be72b1fff02d9e0bb74760d0410f60eeb49418dfa33d6095e6801ff704d0e 5566ec914c40a9520f4af17617d12d749e4d3e3fccd760d1701548ff25d7fdf1 f338f9b896532b3ab08fccd7755f277b7f31b4c237a82a415c8e65c9c8748eb0 d24dff5917480d66c00c071145b4e07f2649da741ae915ee1ad83ac99e9b3fa1 bc1a02a620a652e0777b6619814dfbeba71a9fa4f4512b2c14df3fd9331cc056 af380a4821c832997e71949350194fb708652d3cbf39d7adb841a026b3607113 2a76bb8c02abde2eb4cc8e7cfa7d2908900e337063bbc4d882a0a2a07b021eec bb467827a216ec6592b21d5348c3a53782bed4643df851950396f5823efbfbda abd2444ba58e52bd159214807f85786de733df971427c9e23f11fc37e4e2486d 964707ffe70f9ab7fc85d05598fb94c2a7b6338b891bd37935cff4a3dae5dd3c d38327e49d3f4dd0154485c2e84c4cae0f0f74a99064bc39d1dd3433bdcfc93a 043880e2cc45de63721807231863823c80230582bbdec133dfabdbb66e134c0f 502bd0056eb3db7371afc0f4d09ff469513c82a60b40e6f5a5856a91a92eb577 ae82a032e406d5b828909526b54c298ba69137f131744382cb9684c11e44b728 7ae302b700efdddada62f1750e3a50e959da9ee190e329a29576b29007d1a2e9 98ba3f01a25d40dd96d5c318545bffd7043457874693d900472d9454ad8f6566 66c216625c2d7e70248a77776a3195f010f6ea94f498ec9d21c4a6d1969b8034 4190e8339efb6bb51eb8c8282de7ffc461f08113f35f7bedce2c12330a0d1506 75a517344f6d59866c864ac47ad97428f65f0df0f6df31ab8fa339cda33c656f 638c0b2f4133d13910addaceb6aff979bc373cb3a9471b4587d9195f2c12f21a b9ad93d131e5a96a531793a4d7ae0291d518c80c1c1433298eca484bebc333bd ffc9b3523c8527ea9a56f3f4b287ba56538bf84b89da88c626720e0646b80b1c 1b37208aebe7ca9d0c3c90e261407210f8736f3be7a9d8be71edf13d99803855 eccafc44d50d2b858e33304b4ea89ce7b3606f3554a4dda8d52b3d8361ead5a2 0dd2e27b2499267742b4644ca44698bb5c25928efa0bc4bb6c8f70f9a75a2e8b ea83fd988f37a4a61d0b38d9fef9f519b859604e35674cdc026aa47c4025175d 9e4c6a52e3ad4a33909dbde91a8ff37b8bb4104bebabef1cf82259fc0e886553 0bffe17b24d65254d9be1d4c202a1b555e5505eff7d56fb7a18be0af0c33b3e7 705b9e27b5788a298456fc2eafd77206a83fe515a8af025f933b2c740ed76337 0f123d241135b2dea87b7a8dea7ffd45747688cac12a32d462851a6558a1330f 8d2e2454735c47e622fbf1fb1cbb3237c3efcb47f9fa51e7ae5502ca5b964083 141901261fb4d7bef3b8cd70050f540aa11f9ea1ad7956317fce816fd0b2539c ca9b4b2be5d89dc7c3ae88340d490ce79e42305e3d117c7f923d749552a810c3 c5688d54dbdaea6a5de43513bcfff227d7f74db563e0ea0eccb0afdb68731cac fe44adba701de7907cdcd8993888798368cfecb123796de9346ae70b67144c00 177c379758e92f64f08090cbcef075fde2a6570e74652af3a8f9fd1d3c74f8f3 5aefe9d5e0bd2154abc6266e7ec9ca6ddef39d6c78ee0eb2a8e3a6704ccf1c94 e1aa0adc3811ac1ca0820d36278746af6b5e1cf289c7bf66db2332a6d293cf3a cc2da1992c86c73b972722abcff9d592f9d535c99961fedfccb7dbe945494b90 8dfbe258e8b6e0ae6bc3227ef869f5e0e5c1135c73a4442cb9ed460e89491669 6667a3921e5fdf7edc49676a69889a3bebaf238113a37ad51db38bc0ae37ce05 dd54d18170373e6bf429e3e9bc18ab26bee26239e023d8daee323a3ed80914bc 7a35df5797e08b1caed0a041a2f4e5b1dd3ac51747a668e24eb62d737789ae1d 11ee1cfb7782600d574c031b9f70a0db7f21a253c1e45dfb00ac484ce6507c5c a7b7c6d6730ca341b4725e89f790d00f495ae5c8e43883eff6e191abea43b09e c5c6eb132d046cc6c30fb8898537d252663863ee496e79a86d0c54246ceafc7e 321461d05121d82b54b0ec13627eb9225b74e19cbae8fe524ab915d2dabf712a 84ea377b1231ab21f0ef1c8c70e93512644166ed137ef1d209d9b2f2ac5e7659 e95bbeb58cd337d37bc0af8ac01a0d172dc0f5dd08075fd634aac3fd11fe9943 427c07fc227dab2a01f8a462d952e898e1c4ec3f5aaac0d70756908ddc0521d3 a56882143baa569936c707e55589b8fc7894bc39c5dd17b37e144cef979a3b4c 08d3955e09144c393db143588d3cfdcb1b69ee6ec2c46fc9cfe065bf916c07d9 fe3558dd5cca0d64676e21442e193d110f1b5a52eb6dd75fbdd96d7c2eb8923e 140f389381817c6f870f784bfb37aca00e2de1eab561729d4e4c05986816b691 8ac5a23ac3467509b9594ffc9dd8ea5f4866d25e97e9db2da289639e4821c338 f03b8b16dbdc17c319b26f502534d28ce892bb37e695b1503e51f7b4bccc1ad9 76ca6004b762e5094ab62332d2e39f9c3ee4183be95d374fb0d76f782ba65c47 f6d76342e4989beb8bcab7a50876dff1f4a6104f4383a4370cb2ab516ff77607 c5c5be71ca49fefb24e94e51ee0eaaed1b25eb66ab17dcccb3289eded5edb14f 3053ebd741c93d2e0fa08b205df2b2678017af4fc84227dc2669f528d8f7d6c2 d069f7a567a8c740c35c1a9996b02ca5161ea5ec1d524576ad23c5c96b8640bf a6a1c44fed397af0cb7a0cc847a6efd84016b44ec5a1731b1804e7cdd71dad38 941eedcccb515f10fb1ed93735652c24d6c630fdcebb1037e44671e3cf963587 303bfa466f8b85968e5a4d4ac9a42dde2e84ba058b2c25c3ec01c70fbc86d473 ce83021bcea5b0ae6dddd1c0e06d5c79a8165041bb618f2889f80181b57545e9 1502eee2ebe3905a48371d4f30b6c6cb2cdd5231348de303e282ed8912919416 da5b2998c79b98d1424a1f97ae22773de75dfd0c801697cd64d9df5b2090227f b9203280f187d19c3eab33e666997f597fcf38f70cb773c8c650e3f3ced7b6bc 091e441d5450c3dfea8827f2ee769fe8e7d83fcb62db03c086cbc44c2456c6e5 a36c49ca2b51af4389437344cc7517ec268446d18fb4ca104a573cb56380a9a5 714cf175ee7f50f4b726c1c3a20b7fe424408a83860cb56e406b544f27c68b1c 9522aa008055ecac97e0314838a96203677bd7312f08237647ba0e3cc7f49dd7 a4290feda8c44fea3d6d168be111f6a04cd2c2df581dcc50ecc46bfd97c52841 5f7572377e90a05f4edf4a7014540b5ba7cab0e8d11fcc08e99536d0a5ae1bbc 6abc2e03c59e2a7d01f4b889167d586632dd3ee9a6a67b0d7ba554e4698d758c 895ec5251133f62a6dff60b45503f3b7ebaa8d7871051d7bf4b753fc63b9bfba db52e355b688a2fb2ba5b875e8833fcfed57f05fd7c3cbb748e2d0bb29e43922 8c697d6ab26346f3f4320131c2983323ba075ab1f89e830aacaa252e31969ad2 233c888484a50622d62d051850febae692c899c10c1928532e33bf4016f8d438 b7286ef04842fa2b9900ec271fd79bc97c3d16c590779ec6e799033dacb785cb 899bb995ac5337e2792a5dc9d62c1a6407e0244a10224aab5a3d4eaec9d3db7a becc961578a6adc1c40aee03f6251fb1c9adf83705e56d8efa4c0d9dde2189a3 7b18f82bd4367aaf7d6e68296d957b7d0d9052f54a68854c749854e619be6c35 885aa015d3189436f5f19c43d492fe589f53a9334bb258249e99869cd7da6c43 c13d7d2ce2688a39c4cce85546ed6f2093f1d450fd433628193d268a696b5959 973f569209c5d01dc120bf514894785e6afb371c39cfa517e5eb41afcf23e00f 306637d833caeb3857b19c951a6ff56dc29f7e4fd07931d5e4a71eb1bbe79ef1 276eaa99a85a192b28e3ad367374e85123aa5ac5a9f564ccd04514ea6aad21a0 62a8541dbb7286b6d1d6420a0c30fde47462cc1bc1bbf21239052b9be7856c36 d63c3abe57accff3f2a2966fa3e0cb5c23f1c2aa6bfcc664f1f9466f59aab4ae 1c0518b30171b0ee3658ce10ba31e511095f170177b4122836969d74cb1cdedb 7ff519b0db1d61d4c01056bcfd2454280b34455a5b2d1d4b0d596f3f0cc09abd ef96253ba2990d190bd73e88add035546c1bfa2a49276b1f9eca5d3292f1f848 2656e315ba020899ca4dcd65a5301e7c7220b58258187acf0c24ff2e838c6b3d 93d7d9b20d535b0028bd1f4fe370e02d1e7aaa0f36654574342c7bde39b835d7 820dcc54bc277c51246a40944dbcd50fee4edd6f605b3e2f069661b25ed669b3 e2a1dae36d5eb11125e17d0c559ac545e8ad43462ce3d5e9a9eb3a0e9073a6a6 0766dd4203edfede670b82d0fb3c94e24112fca74c8400e8d34cb93dc383cf55 859de41e8bba1f1228c3466c2f423dcc2f48cd8c3f9f4c8eac0f7d324af01694 deccbaf233a8bb2beece02e641992be0c49b72c8e57f622989d98f58d666e6a0 df18045985388372d60e9b035e0995f2b386cbd940d3b0deea19b5b70f535d45 1656a67d76d77757e8322217efcea62d088fb9da86f1e2cbd0163f6053c8a29f 115ede47f2d009ef5a1dcab21b51656553c4df0b4dbc1fbe89160d09d4c0c113 b10fd80255b0d66a6d4c682b64d17d78856e5bce81a9e397aa8e05d9fdcf5fd3 aa86bf54c1fa2b39aab25830a0f03fa2783d333442c1982e3186fa3d43a89d95 cd43088ddb7b31426caf2341d67c2dfd14827a7511e1ae1d1c460f6feec0a4cb 462fcadc34eb838308d316bbf2e40ccf8c1fa22b4aae295ea94513625b5b41ee bed2fec186a08388babafa8f5964d3f3eb090f29e2a806551cc74d84b3d5b79b 452e80506853ba32569efdaf45e31ff9a3ef3a5c5b8062d3586e21addf55fce9 3a5f25c0c9b5d3f10aa7f1fdd5a026d603a0da80bdc8155ade4651b0536ce0d8 6de441cd6b40746f772c6f606042d1e8ca150817af63e710d13118b8a8b870a3 7fbd686cd132f88e4b8fd1e28805c473ccf2fd30b242ef660d78c2e99ba65822 3db2159c64f4d8aef8bf8f60f703acdd3166a0d5e8f7db31febcdea9c48e181b 338029c2abe1a8d438f5575aef4063f851b0de3110a14c080ef90ea391a12d68 dbcb436f79db92e0f254bd76c185515ce458f9443eb5ffa993f5be4cb6e9c047 45964718493348bdf3a04f20624851c1a4b32186147947d889a7f06994152e3e a5ddaf74e9b3fc136ceb64c0b4db8b4ce696f8848e40a220408b4231c9a3dcc7 2a5d899064d67451afc3f2d5ff4ce92f1570c20af15e856964a1abb1266e2351 7b5676c34ecafc92f79ef53504308eae1c30fb1bc4291d52cc496f379d7ad722 b12d54059dcc685262121dca2d592f4db2cc6a16e8b8e2deca164600d2fba26b 794d6b14b171883e49f3dc8ca3fa60bc70a48d11638d31d97fdc1df68c5c996e 972d46a26ef0a22bf61d4dad2ce345de6d6f539d9e76de79575b8c7014668904 c18d331cd5871cab70d40a84dab0430030d3ba134fe529f071726ce301d93fc3 f86842d8477fe3a31788480f5e6641a31a529c23425f62d5628f7c64b463c456 f0bf0e9b3ebcc78ba6c706f434877e88af82ce5c4e20e9e84a252cd5b4690109 b611cf62fdada61cd0c78a481b26efb97306c330b5b08d6bb3a2009bf34bb439 ccf35c90901acd25d8dfe31d0ac3b29e4a5691a44426b6b04b90d49396b6cce7 3740f55acce0c8029689600b1be8a59657d68c6e1e400739534d95dff8f567ea 0b442aaf85830189fcbe79ba91bb108e5b808f8a39d899cf5a31605b4055652c 2d5cea2c188aa6731b52a277bca9572751c1f8de00eb535a6376eb0ab5e03907 cbe60d800c44c5e1a14d35836259f931e05955c949d77167f4134d6475510069 985f97956285f824ddeb4174318b74f04b74d4adb219387cf8fdfea5ad8d628e ccdc1ef2d4366c1363f725e6ff00736f244dbe6b1f332d99f0470bb4ea19e542 47cf146708387ce290efcab7b5ff522af0c7c53751f7647fecb717adf480c208 842e64e0e2b2a0c07e17305e85103afa50256eca8cfbc9e1a92cc4b6f97f04d6 c27f5cc18dc1efef3800f3841d390709fe218c6214c9746e9c43266588e2f7f5 9a5a5a477585f7994e1a1847205fb5c9ab95bc6e08f2a0b35e62d9a35f9844bf e8e04023ff4057e6ecfefcc7106d2d746b8c89ba328719792364d25cb99d01a6 8e414d60e9da6353a0ba294530215292d040f782166661973bdf9658e84045c7 9402d4607343dd8596c8f5e675f84c1a23ecbf945cb95c8e1690f3fa4ea36b76 081547c542279abb64fd201f51300366dad4784392e00e3fa0f855d35d6cb180 e45e328414826981edfc5fa4c464b7dbf9c2ebbdeadfdd360f5e9edaff6c06c8 7d3dc707e128a70f2a40032d44e3656188387b9b4b0eaeda0ac10a8af24e80a9 44f19f72413314d0a510e62490dcf42c366f0a0a867f5298fa2d096e8d3bf5f6 331c3a9e85d2010914af6f60e450a430be1691adc06ca028f650f1b34f4e37c9 ca0f8c6b44a8d846ab90dcc46120b2ce266cd423378b630a7193d5bfa91016d9 8c07b36dcba1442e1e7a8dbd71acba03f71af8357cdfc2a0b985f21df51daf15 c106d20a05a14b12aac4287fa05d293efd78788ccc42429472a176b72650c4c2 f2619ece42932acdeb4de96ee32b2b9c46ec1da7e90688407dfe8a11ade87776 297e83bc5d78938884e701bf08a3102abb72e4a0bbcc41d3137e48a62784ab0e 264189033a3b3951d472a1006f5748a1733dea61046ded3c2b03e00f358c42a5 abab0b5836cde6a634a8e0c7e0f4c700dfdc50e43655ab461427a8f1aa8cbb9b 3c7ae32b64b441065b18c18e0c9ecd90e72cb0303e1408f00042e66057824dbf ca6a72449e229ae3d3348cb4db2828dbb3abab185b8bbe7096b0130265f99ab2 28a6c2c5ba55212e7f1c58bdc4ced9a140dc9ec7973888173081393a8fd36c69 785001a8db60529f62af29b55b1c7c98cd6bcde1d5503fbb454fef4849ad8dbd 1edafdca68a3362ad6e49363e8869b9e82e1be3f81d006474ba5bf88e5b87510 65ff962983ca7fcd3ded0e0418630f5a9a7e8c1d0b64a890aa228d4048d546c9 42adfdbc91f9662c3e7178e45d093d9a66801c0ba2b0325c5ffb7d040a0c7fe5 d9dce1d72f9926292d98e7f6a649925218503157720b7e13a451763babd6fd82 2d5720ffeabb8b0d57011afaeb642dda57b2372e7575f85e6ed57ec164824b00 c9910faea5009dc85dcd1166d7e47ddc61a7d84eebee6b436ec554a602ca7637 8d78ea5f465ea58a3c0777732ed1a72bce75d146329118f34e8116f0aa1ea81e 6283d8d82c2b427d3dacc6a104feaad7fc3eca3de518c40bf49f13ed80851351 a7318770611ac2aed11bd9344ed2ae3768888adf45ec40e72156b47581a98033 6f2ec2636d92e7f40bc934b3acbac5bc295f0d7675cba64965b6758396ff3f4b 3eba95604f5d095c9e9620d7532991d847ece63193733a1959e544168b45410e d7a7ed26b9dce550bab59ac8a73853e60e00320434ffc0f1b6f0aaa006956e8a 939fd81d83b22e8240ba660da10f607e5ac08770012c2b7548c8a89809400b18 98cfcacb323d823bdc0813fd10e7dd35e30ea71499f0701aa04fa41ae817e154 ae22113f67ee903ee7b2e9906dd478207f75a654c5d861504e87f38b7652ee30 77efc57b366a96da1d559b1dd3cbc2d085e9a426e8d9f569afea238851a5328a 56ce8cf40fdb1d69e8bf38aacafb2f65e6f784368c304dd6f3e058dd1e8b20fc 106ed264e6189d28adfe7a1b005a1e555e3a674ec461ceb15615817148e78b62 80d8171d36a5e19c7f2da88592cdf18a6467a77c6ec316b45104e76e6bb36314 3a08f1c48092753383e345c525050c47cef2b0d23fc41b14146916035cd80789 35c14913c889a4dd98f437b511b2785edaae664df81ad69ba9953026663a431a edce71e5f17d361464e431547f755809771a55628f298e8ed7125a3458950ca5 25f4e7ebc10e8c08084496ab153e8946a200cb5f6ab3281df4aeb6081ce8c71e fa7d6ddceb390fcb0516c8894f84179e26f8745b18642fa8ab5f0fcc402993bd 0df722c8e5cd3305fcc001a792ad0bd0bbb3bbec43b135d79dffd044de9fcbad 64b51bb743662845b0eeba070917c7fdd18d4d150ccb31534cb5d8913138b037 a6d9d4bd972be07bd32f48db6f1d7b953a8eb159635aaf1ad48838777a9afaca b7ba4216223fe0352ac24b307f6c37108e7102a933fc5d57d7d934f7e338b0c7 52c3b9592be5ef56c9f39cf6795aa206b9c141a200fe0f9ef409a97e95daa216 a5c6978c98bfabe84805046a9c3fe50a265ecb4628554303627f2747fc7d0536 19918a37698af8d693c0ba4d2048eb44b9f03c0e6b7f6ee55fd5621cb50760d1 67af523e7b73798b058f70051830a3cb463653bd8e1d6a76b81a7d5c3b917f20 a991869ed485e5fe64deb579df8373239d4928275643b7487b879d4dee30ae5f f28eed7ec482dd4c9803fb7f494643dc05d249b7ed95817b79533f6feeb02eea 6ed2b9aedda98c358cdbf0bd047356e2ae87a73fe813154fc9eab83565ebee8b 955d23ed45ed4d43813321922caf38734dad9130e2449dd1ba14ac1d53883037 d9eb3c95d23b397ebf9127b2846b0c1c351ff011b03c1feec917c46e76f038d9 b8c2b58181fdbb616ba23c7d0de2be01ab1fd624ea5faa7a51c7c79a6b1eb024 7d1da64c75a82495dbdf884585dd78df376507d50153c1c94c6e72e56da9fe69 67f418d47f18e88e6b4953c934b749efebc3053485a487610b90ad37ed404356 9d706f51a3cbfa4a3a0ff558d92d8d7a71c842f016461f884074af0cba839e75 241c8dc8e3b2bb67c08cf33e2bcef88fa7044ba71078ceaf94f3456668cc121b 71d583fcd662a92ee78ff6e75dd8eeddbaf33b0c57a3edf9a85b3efc7d5ad264 1c74478a619f054b9e760a84a07c910b4bfaef266936d3354811a83049865479 b22df21d7209e36c831e9face24d7ec73bbb1fac48e09f04ff3e76b3f3a1381a 30752539ceafa8b891823b69c03a7a65340fb291b1fe742623160c7f863f835d 3b98acdda33b6d0e54c97db013327bd7fec351a94ffd4086cc43adc28daeee00 a193b618fe66bf0ed6b679a0a6ae78550903ac3d78e032527020534c18150513 5ef244421ca9bed64cef7b2c092f36dcb1e8a51d24c16f2b71a406138f61813d ba6a1fcdf42dce1e024e769fbb31738b413e6d7edd1dbc72afb16ed978727a87 0ca33e59985511b284e1f821443d085017c3b711a380470a3bb430feb66e1245 9d04d9efc32e7cecee1af738faad22df51b2a3ae6c423d0a8bebfd2ac6f060cf 9a66289f09086b4d3a5d3a0cfe2b30b5dd119d4349a2cd7f1d0475be77ea69e5 63b59ba19b603a243717d7563567a9c0fca0de3b55eaf09843c05460f6f52457 c01b4a2db45135d2c9ca7b843bef5dee03d7318a9f4836a18325803b41310a47 e6431f4ecf6ccbe2bb311fa9efbf02c6fcde0fc9dc5ea5d7db7ce9bd31a38d45 8034cb74b7f1f1bb43f600fd58a350de26159ec8c0f65014c91e12996b66f83b f8711cc6f27459dc3df27acb581b6ef16673bc34fb35fc7cc12a9e655f8077b8 1ff8244af507ca29fff6a23a63010451d13e828f1feb8ff8c3e37d3b3aa23473 9af16d0f0a7eb1bd3e4bcc3a9d188b24da6e9c1b7cbc359d44e0143f1af754eb 90bbf4c3b7a75ab28d6e93197ea118bcb764f7c4f521cd0ccc9dc894844f5d00 469bf465d40cb6df03bc868b0791e36291cfad77af70215cc0e6167cfa22e7f6 e7d063dec6a52a708828b12a30902d836da8bb756a320200a86e12d51a889bd1 f3c0857cef776458ceaa5c28baa0b2ae8607d9483de35ae00112189c12919d6f b6950105e78aad385932852ebd795175aa95ce85bf03129047a1116fe3ad68ab e195bd28133870f471d581a8e660c9febe74643228a6066469e0b0d4584d31b9 54a451ae00ea802ccdee83444fb42e89cf3fd674ef6313d93f1b8f0904e0a836 2fe911f097362d1256164f687324c1d906f41c513030bac8a3a75833910bfc92 a2d8736143c6e4a7d488609975e12c49cd83a338d235ef969b00c311ee341385 f90c93155c7a428b19d4393d5b2ca3a56e0594402707fedbf3dfaf2309c2192a f1190022cea5017d792909a8f99d0058da5b8f7a134c55af7316fe13b737f7a2 0e447fe8da12f350c1341c0486f608097e6f31952ab38a0a298e24698a257e6c 2c73398040c9f231e7bb9130ccf0eaad34ac731bd2b843304dd63e7f83a4042e f18572b8079a9d2d3387e31f2a13396daf9237cad68d03409f4a35bc437ff6ab ee87be2237c06a9331b644645e2023b418c3b29b1110b9d4928a598edc9539e2 3e4b20be0945a007355317ebecfbfc0a2197dd78d46140b8746f350a8c7e87a4 a6e90282fa987ef6e5ee552d0867caeb0148931cd32428377604b21f716d762b 3a9c2d19c21e9adb11b2fb2ce98b5e186f328d36645b1b47f88a1f4a3c6dee3f e9c911847a8a9f8cc0ac75a79d39a49351e18462d80b6c92f96a8ecc0fcf5518 6b5526a27b9777b30b3a773c9429ef58fa5b209ac68e54548fc2bc0bf07fa474 9f6c7f5f7a5de835c81a8f937c4a9168d2354685aa64f7532fca51242c1c621c e99c5b8c7cd95a41cbe5b988dbb460fef4f422f8da912f03006e108f94217948 d413dcacc85cd3dcdb4ff66059acbc5558691ac64a013a11888d6707189ddc86 f921769f0430fad1976612d419d86032a594082ff0f5d434a16b397c502f9bea 4d01a328634fb183fc2fd89a2429ae51930d5717fd77d99b58ad3afcce558258 82f9425597932a25e68685e0e31c092497dc9053a3367bcca2b36823ac0b8a51 024494819731ddd42fe09fbe227e73433d3bc089034fe405af33ae3517a7f7fc a3f723a34acf0222f0a71c55c16362c8a5de0d3cef7c8802a87b50441ae0b80c 0427ccb43a8fcc0f2c74e54858608dcd7a67b4683e3b59eb96f56f4ecbe18d2a 924dc6d0e600e7b11f02edee53e09a1c6e38890f05db7d2f48c185520016045d 98a9b58c4dc7a9192343abedd7033d2b65fd865617be9cdab6de401fc0fe1afe a63551bd0515740ffe951878e14d4ea3897aecc9f585bb9e80c3a75a0e0298e7 688d00b9c4fb43508c47495ca3ca14095700151d04a56e9cddf4035f04d70e49 cf2963bee5e5c2163f45ae86b3a72e7ab0accf73e6453c419855d64f4da72ceb 8f96a5038c47d59bf70d721b690e5a7a59b3421acb60fa2defec0ca1e0d8a3fe 808bc9176ddb92de505611c827435a1863cb37f495aaa5bfc9124d4084f33dc8 4eef35f3ed9cadc42ee027da947c639fe535a2440d28dabda71cccf3a070a3ff 674f2f2d4e071eb4c51b37ea137733407cddbad7efacfdce4b5e62a823e7acbc c8d5e63fc19e6599ba92a62d2fb8b457806a48fa0c6e46a03e43d904460cab39 eaf568f675c4d5055473887acff2adb4077fcac3e4b4b2a627163b04ec03a3ee a913d14892a10173f9a47527f5e7ff46c235fe1eb44498d6dc90a713a5e3fb80 e5528f705ca44218b4d0c5afca5c3d852bfb321b6c71550f9218f0fd7986ed32 2e31d64a38fb23fe4795909cfac6a6bd2720f45b5cfdb31b85ad24643b5962c9 9ef16e92b390892c998b8e8f12f4ec9c947105d0afb36842dc1a6970e4d8b42b 1906418d0de62fe690f54dd6d304bff0cc3e0542fac1eef5b720134d12ac37eb 159d212a4daef9f1b236f61106ee38d7c5b4c237a82a4162a54e8bbcc94ae588 a4602012a70faafd99bc0cfbd0943cb13feccfa16c2b1421eb888668b6e4f2c4 71443d7990e35c7d06eef896d050269ddb2b0d89f9c50534b70f880a56053d8a e9470439691be196abb324a24b44d79536d887cbc632290048c557a2106ad3d9 c30502dcf92ab17a65dc9ba3a197f4063f84d2e3e7e4370753616c3cb7fe5a04 879f3c319c97efd3704492bd9843494b6507b0fe5ab17d8fb03951c423c774d6 f6215dbf1282a949dce687d5f1d57e577c404589d946cedeaeab7d082219e3bb 401d3b18d929151057dd7cff3b6dc075031761be4fb7c52b4d116f6159396324 10fef62506699b9f054a9afd91944c9be3be545b00957c0d7a3a8be497b04f92 c458df292af9c06e5ced175297425b6ffc696e4df7381fca9b086c56e6d64188 30cd548c230113647318146d385d523f74167f0b66803c4830722438a48ae799 47dec9d69bcc8eef5333ee9e688cdfc48ff92192284416f278d6e4c6a49407b8 05f0ca8d96c0dd58b9bb3a7f157f0eeea74fe2ade3bd3c859e218c5d3e2229ed e4c9fc4578cddbc04484c54b8f8e8e8170707637b955577d517788fc6631ef35 3eb1db5fa023c73869f35efb2290cdbc 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMR6 %!PS-AdobeFont-1.1: CMR6 1.0 %%CreationDate: 1991 Aug 20 16:39:02 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMR6) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /CMR6 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 161 /Gamma put dup 174 /ff put dup 175 /fi put dup 176 /fl put dup 177 /ffi put dup 178 /ffl put dup 179 /dotlessi put dup 183 /caron put dup 188 /germandbls put dup 49 /one put dup 65 /A put dup 196 /dieresis put readonly def /FontBBox{-20 -250 1193 750}readonly def /UniqueXX 5000789 def currentdict end currentfile eexec 9b9c1569015f2c1d2bf560f4c0d52257bacdd6500abda5ed9835f6a016cfc8f0 0b6c052ed76a87856b50f4d80dfaeb508c97f8281f3f88b17e4d3b90c0f65ec3 79791aacdc162a66cbbc5be2f53aad8de72dd113b55a022fbfee658cb95f5bb3 2ba0357b5e050fddf264a07470bef1c52119b6fbd5c77ebed964ac5a2bbec9d8 b3e48ae5bb003a63d545774b922b9d5ff6b0066ece43645a131879b032137d6d 823385fe55f3402d557fd3b4486858b2a4b5a0cc2e1bf4e2a4a0e748483c3bcf 5de47cc5260a3a967cac70a7a35b88b54315191d0423b4065c7a432987938c6b edad3b72ad63c2918b6e5a2017457e0d4ebc204b031f3fc6c13d7da7277a94ba 018e9998b3dd888011a5d7c4204989f30f908b95533bda845746b673ab71ea57 65a0d14f4350707e47c8276305b28513cbe1bb0dbd269a53719bda46e536685d df78ca0146b6b93e760256b74d939d4e35b5e77238f04c92298dfdd188feea30 e053eefbcbb52f2011772b3aae39f5805597bbc1e8bb75a446ce014030f4f2f0 f49f9e962ee4a1024a746fa92a3628db5270732b54e43fe5ecfa524f127e5fcc 788e77e66098336ad67fe4cccaf0253272d5df79864bf4b734cb9a5859d557d8 bc11b8e00221ebc12e97de4b1f466ead83a4c894709363bca9040410a52d592e 34ee40cc7e5efa920546b981aa659513a24b1b85c221a1875b62d0b89e57a368 321b8043a5b094e0379760a443d632892b14ad6d19dacc8c78093243ad67e6a3 08e56e6b68412ee690b10dac6e17708754a00d51fc957b500eb80175716eef4b 2ca1ef867614659bee3f2b7319e97b6fdf1efc847bf3cee3156f72f21751da8e 5fb6898919e6799820d3de0642d756e09d6fae4ff08dd3deda3173bff4bb11f7 9109c97ddc05897af709ea199a90fcee8ce4c7a3c15b18170c41c04de2d3fba8 f34296a95b8e1e8de3739b17273f8f2c85e914615c31fa0dda3022e6c4280377 c7fc05d7171baf721953616aff57c215b922c58a7eadcefff122216df93857bb 5cf4fdbc70a42b604ec02620e28530f2896c96ef1f89f2054bc547825e74d22a 0e029f61a24352d29e63bc4d26ce4802e718056eef9d2c9ad5d4408449451702 3ce9ceaea284fdd5e8fc131b7b00dd39d9e30af990041c27d80e4486522fd16a a216f97a72eed9786d8e45e377d7a6e377a32a2cb5f213043e7bb79b93c22097 b704339cb415cbe31fe9134044e42ec88fc0e7e49e3e3e5dd6f172dc01ed188e 3024936765dab12cdae938e8cafab59378c45b791867e406591b0b8dc9ee82aa a5e4f000c9fc4a31dab11ffb4d2fa747d68bb9be086f3aa56adadb1bf17b4e34 dfe7048b72899d8668b299b6ec4c31baeca9ad8e60495a6880026046f35bd118 ddd7c6b017241bf56d2a37967ffc5c1ae8eb64d56a52dcda3c1ea760ef1c9432 79758523c4938429ef0190bf2b177ef3b02fcc08a7e9e73ba3b58dbfb49557ab 0b8be6967026f8e264266e8324a227481523fc56cbf8a916112d87c82dc895ab 01636e2acee137d8d0f6d39be8c97a8d06dc238ba10ccd1c37936f015c7cac50 c4c02d969585950f014930612daa256431897f711098cb81394850acdba461c1 dacf72af0787cac2f9d78b8cbb3f6a5f370138c4366353d7926ed90f10233176 7716704a1825cae607e41237b5f8bc05df7420ea9784de6352ed355905af9b55 36f9b9da002dcb423ff9c87753cf91f50695fc94f84a7652f942d8f203780b52 715183b7dbdb0c10756b3a800ac4e424ad23748ff6ab5637785e4a1528a418b7 5d2ab33162728fd8776774c0c02f16d2c4f3c048dc3fc537c10db030d91b9472 d3a900c77ac9617d26244d7abea3c8206ea44cf0d6e6884ffbd2157af0195a87 b2f29ca9fa7efcaef95b850b2d77f80771573ffd77bc048ecc0e2819754a5b19 a96512c67fe64b524cdba3f4339030ebfe46c65abdf106b0eb7701004308baa0 e345eafe54538e59c3b2bd1370b8c1628ad59033b33ac2c6bc7548c94bd1ac90 20899d5b607286a62c733c6349a4995be71b07b06d5646cd9ef07fd977b26b2f 07c48fecc0d2a167de4541baddd417def5c4c66fe4e5110935d2052d5a671cfa 7b2c869e7e67cd9e17f1904c4cbea95cbb386b6a8b139eebd5174aac078c7a6c e82b9d52abda0a99bfb08b20a074ae1be2cad160aa601b48f7fd09bddf8847d2 78f0e59f9319d1c840f8cccb4af22eabcd6f028e1d6687d243812f0b3378d3aa d8fed3ec4308ce13845d05e0de13e9406d8b063436d0f46d38b3ec9ad0e229bf 07e999e452f8033027ada72603438dc087d25e6203bd81a6ba57c3fcd757c020 ae079cd0bd55774bf632085f794a66795fff0c1b34d5c026eb7987f426436115 40b6a2c2c44e79146d4000bc2ea3ada43fcb55beafb4f04d555b0e3c470f42e3 236c25b5c3357dc6ff40dc8934421dccff831310ab7f00b67a5e8187a1db7848 b8ec2e0913d7731614e8598fa997ff1ae5a1f45f40caadb107d4ee75c9a6fc25 ac7024813a0376398d9dd975677aad55d58f4c33b529df909fd7359cdd6c0062 83d287403c80b74612fa80c53d564b8f2e0483c4f9655d360d4d04981c644ca2 c5a03831cd1dea9dfbb000d847c37b8a527d3ca93e90070c6a2e5dfd53fc1727 70f0344bfbab580aef4189654d4f99d13b005c069b10a99de74d267401ce7325 c66b92d10e69fac0acd588f65b1262ec74b7204d42771ddfada29f34486d848b d82128336c334a0f0a95f5a2ef5aa68b56ad1a7c114205267d5e0f20d571b2b6 063a9132c48454272a1846df546bb502c8c35ee6b9bfc2fa6084b766608f24c4 ba8fe02da007657a5ed0d31dc32f6e9d9d2c1ccc3782476966bc607d07597fd2 57df87d31dc257c1925b5996e6c8ec3e3e53272e4139fe6bf1ca1ec334750ecf f0c28ceba0166683b67cc5d2065e306900481725bb291842aa3fb846dd57cae6 727ddf6fbd504e10e5e125b32ed01a9652dbdc11960dcef80eca2d3a4a339952 d0d3ae505ecd19cf9e137444c30859a036f08f42dee44759a99716be9f88f532 ad483a62d05152f732ef8c2c895ad466b67e84b84ec8d243693546373341953e a7a6c428cd1a79af4657250ed792a8698838e625270e40fdc70ac1b0369d1a99 2a024e87062bc2ed6ffdff84676703e6a2d44172b0627bc2e8f675aab133042a 6fec31ce2ce44d90313fd2b2b2a50356902df8e319c2998be71305856095c6b5 2d042ea0a82c17e9e4fdbfb9a7e0f54ac3160af9d796a24743433a84c0ea98ca 1631c463f679499fd272ce6021306e240b9aba3089bcee141b4725faf4480705 da3ec2c7ddfc1eaae7ff27c9c834c7e432b7056a43fbab2e2316024306f53b50 7152f8f84878d619a8dcc16180eda5657250d4d2004f1ffbff700a0a93ff6f24 fa33b52aade1b19b1a23d12ebd4735a54f9dfba38fce600b8d0eaec993aa526b e43f666207d3b68f1af24294c2ef19c49aea8243938159c37e412ec342e42259 bef7ab42bd0352c35c025168de9d6838baecaff3830116315a46148f38255105 a4cdac9ebf6bdcba53c4509aff6390fcb4d72289b0e4b67e9fefe095b871aaec 88f216704758dd2b743c90868d6e97b966a4e1b7c27b4febc9b42a18c54db4d9 2e4fd653b8aa831d988fdf3c7023c86f01522b2de348f0212d562825108c119b 499b9717de9106e97e451a3b73b6329469c8448f29d00e3d0d12c63f3f9d7670 c5fcd6e96d20411070fc64bc49325659dff12009483cae376e23b396aec09944 3e9ebcd3127a872ac9d7b584917651f2e396faf468ea38ce47d2bf41516658f4 674c1fd458770a58eb2d61cd39a19700c283da926edac5450d31c8ce18b4d681 31355986a3c2ddd91ec5e2c84c05ac8c4d1e2f0188e5e3f9d76fa4c6bd4fa8e4 e2e7c00558bfbde21066708d36d47f6119f86a3a8c4a6e24a2721a9e6f2cd49b 7fbeb23416dfbdcad73a49688cc50820b5449364ed13ff1eea058da29869ce9e cdbcdf6428b677265638b5e20f14516b63b694c211c1f31128f57229872fad81 6acbe5629a1c8e6e679e9c297d286bc2f104ad0008e8070fdd514ad9fd5ac774 29a29e2e8de0b8e2c2ea2e9e268c7d48c750b9e957ccae4412e0a25eb1b10b6a 750efdaf55da2869850a3d08da01bd633b667161bfeed92851dc68488b85eea7 845e4e0bc839c26477df70f07f97b4c7fc6e866d397a88e965bb744a4a73e8f2 85a9086d405f45329f1f5c83db75b056f4b57ba95292b3a48371847646132698 03badc24ce009e155cd0f168534ff701141c25adc1a39f36a10b51e6acaf5c1d 034257e35f08859ae84fee6884a50ef0a1b3c2fa87595b880ac51e35da36554d 393b22f366e0517fb4f90251d4411b12c0616358b8e365ed 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMTT9 %!PS-AdobeFont-1.1: CMTT9 1.0 %%CreationDate: 1991 Aug 20 16:46:24 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMTT9) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch true def end readonly def /FontName /CMTT9 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 161 /Gamma put dup 174 /arrowup put dup 175 /arrowdown put dup 176 /quotesingle put dup 177 /exclamdown put dup 178 /questiondown put dup 179 /dotlessi put dup 183 /caron put dup 188 /germandbls put dup 46 /period put dup 47 /slash put dup 58 /colon put dup 99 /c put dup 103 /g put dup 104 /h put dup 105 /i put dup 107 /k put dup 109 /m put dup 110 /n put dup 111 /o put dup 112 /p put dup 114 /r put dup 116 /t put dup 117 /u put dup 119 /w put dup 121 /y put dup 196 /dieresis put readonly def /FontBBox{-6 -233 542 698}readonly def /UniqueXX 5000831 def currentdict end currentfile eexec 9b9c1569015f2c1d2bf560f4c0d52257bacdd6500abda5ed9835f6a016cfc8f0 0b6c052ed76a87856b50f4d80dfaeb508c97f8281f3f88b17e4d3b90c0f65ec3 79791aacdc162a66cbbc5be2f53aad8de72dd113b55a022fbfee658cb95f5bb3 2ba0357b5e050fddf264a07470bef1c52119b6fbd5c77ebed964ac5a2bbec9d8 b3e48ae5bb003a63d545774b922b9d5ff6b0066ece43645a131879b032137d6d 823385fe55f3402d557fd3b4486be465959b1188f76df7824c135a7fb382c4e1 1b0ddfe856b6f34552ca48c24b57dd8448fac257c4d93fb122e1218fd36b99b2 d79dadb8a66613ef11039be77816a7a2d6781fe0d69cecc36232ae87a172afe0 95532a8c7ff40bdd4a5fcfb6ccfd8f73c572231734e0609c6743ee11010f6579 820b367c49069ac1d45760c0ce8dc1e67e2beb72be6d287910547e1b4bb52465 b75947d224998223275a2c340a1c14c04328cc2935c53ee2723f1de6357a291e 14863f6c1411477b3ea074052b30a4c1ef03ab324d678307e1cb02c7aaffa90b 73975378b9debcd3f6aab626a361be8068c60edd0b2be4a7bbf4efa21cc23607 bf7e2556c17b5923d7b0fc036d5fea743c55f2bbf72e8a61995bd63d7104a085 b8dd5a83d9077376a4ae8f0c048606bb9e84c640c52d0a95b35d48cfafd6ebe3 d6eb0ed88c1212818ca93e40614740a77c446b792d02945642014a5d55ba970e f97dcdd5b839f621a052d1085a1e668161d3ac0227c7867324ede883589b39e5 d152793009cb5a08eb6719a44dd01b6147e3436bdbb28215ce3d29a3b1dfc72b d942f8cb3376b4e12cff53a793d935346ceb2afc3428cd9313c671ec1911252c 19de341556999aaf7417aa5085daa35ee71353fdc2c7d83ec2dedaabb1b89b99 e4cb5282159cbfb45a286f8d6bf3abdedccbdcebaf6994b17f1be07d10f00cba 47f2fbf66c0f608f28260bb5bc3cbbbdb7bcbbed9c322336a2f2e4f954a05d48 79d3d976e201848adc85b763c354e8017ea41a9998c520d720772255c69ee591 bc3650e52286e6f7089ad632de39ff9b40f725f8e6e02b748929dd79b8fc1b2e 7b761909aaf09f1f3f0ac59488b0d281d4a95c25cf51b38c7b2d4ebe94aa9ff7 b8bfae3675c9742ee29b158c7ae36e3a68f6f564132fdc8c315b6d9f8e270ed0 088177aff9cebd0a33237fbb2fea1558207fddac4e52e619b91d776561160966 f9da1c9a16a3b8b392111d7cb7985d6f804be8c153e2f9065362a08c3c89a91d 78dd02ee2c03a3bba477878b32e0274abd7dbfe4b4c84909a891873bfd249043 d9905a97d100d3103c409219175fdc36df9255564d793b0465ed6916b6847de7 e0bad997645d2c1403d20c8c4322f67fe78d6382f3fc384980a10b0eed0bcfc5 5ce22c94147d64dd39a8756c95657602e36fb3fd2ce2ea7b8351aadecd37e61d e8c6893d37d139e499eb02b75d3d8572b385cde9da106b0b74d0e84ef79ae28c 75c445fad17a3c0395ce59613b49541309529e36d9b1943fe1524debed13233a bda1e2e08d565217ea291b7135b511fda9cbe40602b308e34ac5e9571a0f9dc5 1adb6bbf5b9e9425a0b32208a69cfcc7053052970d9383b6cdc4918dba32b7fd fc6bac6ec48a489e1224c7349d5881ade39f12481f7a6022c1eca4d555164d15 f6f11fd56e006c9e4e4c33940597c0fed9d9b4c60e29ef9bfcbc5b7949acfd7a 81d78215e5ad9d5dedb3f0eceaadbe04230e775c6eed17257b61bb5db9e9f0ed b90470dcac49fbb66db58cf641861a766a1ae19e6cc141132dd751ffa216f652 5de6b59d33fd69382554553c606213ddd8b2801ab41bbd9cfb969ad34438c804 d9f1cdf8b66d4df2dc67af64b38cef377b9a0761c34b4a3598ffe1a08fa3c741 152e73d45afcc2c61feb0dc75e806f20af6ed81e842572932fb22717a0919ede 86f14859a9e3536d775be4456a221262305bb0af0a99b05a1514dec83b30f712 785cd5af96a0b4f275e38125a14b656856fb6726cd0adeb39111da6946fbc09b 1850337eb0f2ac3d23899b24fa7da4818612469a8c2d330431888f63ff328769 9e32953c52687bf3226b1303fd0d203caaadecf01b60ed0d4f0879eae6d5a73e aa6f9c87ac24d638d9acc2cd43435d8658691f8795278453e4aaf467c6ac1bbd e5e7268ac0ba4ba065e7492a99ae8ff15a753a8c6e828cd198eec0e1a5e4451e 8240fe8dcc625bf1254d8f8aa5a460004131c4dade87d31d058167a39fc6b7e2 3e37b7ed82e880e50fcc61e3ca4e3c0027fa2b7b63a231d337908e271e140e5e a53376acd48dae4712a3940eede1b660ac80d5674fb83ffb30457c43086ca439 6083bde4cd9e49b3c33fb91b6a9a021b6fe57bfcb60b25483f35de1b0bd728e0 00f1d59c4310e1aeb0bb78d9d6b61dd2b16316e3424d315d7fb3e5285259ac06 d68c5dd5c57e07ca101732d9c1c628bf61a31dd1e9c43bd11135b7bd7894eb35 4e45a603a0fae9a2545674586f4efeb9d5f738f13b3604ae43bf537eb14d7bfa 78fbf8f138fef3ef233442c09ceb66334e3215f258b68ff271f8e9e4cd5f07c3 cf90d54242f9ca5094efe9bd8590e2472503299bae5d166b03cb21fa74a3113e b2b507656d62f53c406da50fe8240b7caf61829a7a3300df31448e563817b3c5 5bf85f47e9010d432f9516bf3d8fd93d39cedbab8fcb1fd287e629bf620e1d4e 5c99e0dafbb087882fc824a691e6b85b5cacdea6ffd8a33df5d498a88bc80ccc ba3532ffe14080481a4464e546c305217d0c0e654bbddcc6e62bb356bb090409 c61b046b83f37f5288c78234972aff4a8fb9963469c2d87c4375fb3c79ed408b d65d3dd16f724408936c98833b1aef2c2e81fcf0d2c482fe238460940ef2d5b8 b90605faf4593036a6f6df4e216ad81ebf79f094447cdd5a9de03f41ecd33e46 7a97a091e601dbc47031fa2b721a0cab8ff081ea035f19924696c9af12b62ade 3826e0acf0da939176f3ba6aa8965c49f170891290a2118de816737c3d0b178a aed199c379b7aef914503e9608e828fbd6e74f7adc56c30c68053981b8f1b540 70fb002be552e9a56f51d53ec6eb3c24bf28068d6baae965f7dc25478a4c89da cb091ff720c4b00598e95ce589a0c27a6f4072d3da84b4983fef1176ce649b5c 5115ed01c7d3fdcc24b66d20f6ab02786fe24bc0cf73dbc5d1d501d9195bcfdb ac020b4174ed93f9135f0c0e0359d74dceedf7a376e9d23571481ad99ee07d73 da6928a904e2f5dbf29404eca887ecf9136f9bc51d80326c4563e0d0bc26a92d 3f1fc4c7b155bef8f29fef2d495d150a1cc9c6cf1b3a2493d16f5c75598c3f5a db6956b60f976d4cea08f2ba6ce84d80ed3a94c8b013b9946dc01c39fb5e38a8 3f567c3101860901246d6a491519fa83d648a6a46f5eaca83508293a35416b82 dfc7116293ef312c1c5bdcbc8f0366f3ca6d4220fca1be516fdcf49462ed550d 0a05e6835983fdbcf9cd8459935659c9faba3e33553e7cd1c8a9856fac1069e1 580a79cf18e1b3b1b6e2be2d30e78ec6df1f760b461cdc94815a287a1fd78d72 75042d41a418779babbfef6cc81fae4e86e4e55ba7596a0dbde6ee6e5d236bd4 d13fac966ee5a333bbfd30a3721c9ac55dae366f9a3e58f62fb1365e5bd70c31 c7683d7a284ab4ec4267b694c0c96c4fd931be7f3d5d59ed128fe5afa1ae7bc8 fc9ede6b88466b55d10a16191964a978083dc4babc58d0a40f561377a86c6072 ae5e3bae378770fe850545b0907d8fa8fba3b3a0d856a6eeff6f06262c1bf7f4 575dcd9444d468d15b5abf85d78d88bf94e32cca22b6907b9cadc43e5dbd98f0 ac6eba97b662ef83ae60405ef59075a773f00888431ab147dcd3c87bca49d1c4 5d6cfc98434bd786cf72443ff011f3c9fbc9b9025aaa4ec54577a114d5389da2 f7c8371672ad84b0690a52393b702cce8d4820a56dde240fb13102262b155437 53821cc120abe12bba178bd882881a13af04104a78090e9aa6cc1db99d0be6ce 7159d07cbd4b70a7635be6fa2663d508eebfef30c829d2569846001218060e4d 0eca1152849c1be9b9104fd1154e95447eeec8ce8972379a5b291eb80e8c9581 92d68bbec03e6c6542383136281b167c894e569f14bbc837930b01210134eabe e1415f0697204a8080db58aa52d2e2be27f570d0a47ce95328b06dca8375502f a1b80b7f60f7c2f7788e66d301c0235491cd4d1a69283c7436b2ab1a97bb7ed0 d9dfa222f8b385ab594afa99dc1d6b442707850038f0810f0ee291b167f69ffc 331ed70444b95188290af273c711c64d3d8ac257bf611344dff9e96eaa79eacd 46aba899b19ddae7c7a5cf6d28e01a0d1483006abec54bdb280aab5c4d5dcd97 d2b7f958dcf7e138c8a15984693fe1a0925204582ec8f65bc1e4aa0654d4392b 78c29649431886b236c95c11a3ace490025d83e07965b396fdd136b49b203fc9 e48a8bea97cb77c6ee0f6a5aafe249ab4a3194a802121ce314fb773f02a5a1d2 8c040cedc32a1ee958018b48ab84e563b6dae93c28036facafd6ec351d796004 7b9ae8de4845536ec7c02c4aadb202fab8e32c9fb7056d17a5cf6817679e30a2 e58bf2531f8f1521f5eb3f58ebe1ead4c81bf11243fea3332bfc647adc8b7929 a78d105423c6e34e5194bd8c18be0512af5a989420376fcb97176df17ec9922c 42e00d1987680c7cd96c3c81ba0c490a4fa54f11154f3f105d05b465f6711dec dc06391325f04875805f0be3294b4b412f425998a37bab0dafebb09f5bb79c34 4e31ff93a81784cc3b334adf4e515045a722b5f88737620b4098a7b38842a888 ae61df3e1a5a40e41315886a24c71e744d05fde20901f03c5d5747789a686303 dac5690fdcfc5e09f3a031121509455fa78fe6b5c878495f39c40e6241e3a5ac 629a1872e2332bea5c0831d1106ca169a53f596660252b63aed600b8388e8920 2f81241bf0ad676d1632ddf73c379e05c4315839ea8196f9fa4065294aa1770f 75f6793d29e585737657a8fb0e3946a6d2304f2241c79cddcaca3162b28ee02c 9ba50e511db84463eb2eea28cf96d3bddf486e44fb8c4eaf0a6c44b459dbdf13 5863fb8b31958d49bd0c097a4d15c76d00ee844d99ef977bc0e89287b0c2c67c 06d2256e846f85dbbf41a7059b2bc15d9c66d5d7693642901d17fa0c68fe80f3 d3f7234b6e8d7067658e23fd09cfdeb90a95582909a07f96292f97ead735b492 ec927e71bfc526d99249504d80cb055c747abba5538808b25896e8cf06649bdd d3ea99a59a6310f3ad7630c561691bd4c80caa040d5262f97894f77197a0aead d7c91cf5e1e53d31c1f249efe2caa9ec9731ac6a37a7808ed6bf57d7af9e2d2e b89489788ca5b3af8236d837771fb940fbc00afceabc5331a1077c5310e29c10 29d2ab375745b1f9a5a185fda81f086d83e7fda0acf1fb75fad4f2098d8f4007 ba799deabacd7eb4fdacf8f6c591089c5a2b2f6b319c4c365f7510780b79cf3b 50a61d9210397130ab5674e84af26a9483daf73286396cd7870dd1432f924a7f 4d81ee3e316bcb68e03b5638cd597404156b223c5e725bee4263861e105f61e7 1ac5f10be860430321dc09c18634c1560e4b0a3b5ad9661e80e2556c128439b0 76865e6ba8dcf4c14cbe896e4060df1ba588601d09769ba7021026df771c5110 95580fa36a1f46a65f46f5b772d5b951e019de057b7f6723784b79a3fb8c4907 56d4f53941fcde82ebb2b8fc64d4fd0a41d818377f3a2562809cca4d1a51310a 800bb3d1064adc548dedc24a2e644a2d5449a786cc3e016ecda95a8b9afd276f 3817725372e7c5a31820204fad03b293a136dd677000e1751cbe4329f1bf18eb ea0ef4e2f32c51e90f396b8ade046a7a88b66e0432077e2a3744b5f026641145 5ffac17e188d2bf165f7edab2f32fe43dbbb5978a359c72986683d984ca25e78 cbd3482a921e4eccb7cd67a412b64c24ccbe1bee8e4f381adb61368fc2adefa1 a42ea6506f058fb16fd06b536b730f436ffc840f9bebd2682dcf09980c38003f dce3a1dbc2b5526af31c1eb6153019f823d5a76f80af950a191a2ed55e06edc6 a14b7b82765422135866a09cbd1d36a7b47d46214a5b81aa46202e21e4073caa f5f16426d2820dd3b6489647cf1b4bf12004613c908997eaebdff04754c58755 c767bedb7d33763654a0574dfd53f3de46116a05c1024b29008952e4e8e601fb d4f3e59d8b5e0edec013a1601492c2513c5f2c22bc1ea069a346701cfa5dfba7 219786cba154ccbd331f26b582a4d2ff4721373c9806b02cb2ac42dbe07280a5 b0a5581788f9edddba13c9ecd70b3daede0ba438b9251ad17c44ad972138d23a 1467892b39093ba54622bc008b30f41cb54fdbd8ef8fcdca6d25ab538fdc4b6f a181ecc1a9177648af0c1c1a57e9668decd18cec4918b86cf5f1845c0babf319 a89599dd23d7545543247bf4a2af76af104b1858e28a173a11dde7aa22dec26b f6ef1987b8a297182a360a0aa0c6d95c9cda60a4286be85e7c4cdfdf39fc2a65 6d0feaf0747580e31eff7be26ee49ff392aa3ddd703d4af843eb81aca839e92e 27200390c9f3 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMBX9 %!PS-AdobeFont-1.1: CMBX9 1.0 %%CreationDate: 1991 Aug 20 16:36:25 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMBX9) readonly def /FamilyName (Computer Modern) readonly def /Weight (Bold) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /CMBX9 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 161 /Gamma put dup 174 /ff put dup 175 /fi put dup 176 /fl put dup 177 /ffi put dup 178 /ffl put dup 179 /dotlessi put dup 183 /caron put dup 188 /germandbls put dup 48 /zero put dup 50 /two put dup 58 /colon put dup 65 /A put dup 105 /i put dup 108 /l put dup 112 /p put dup 114 /r put dup 196 /dieresis put readonly def /FontBBox{-58 -250 1195 750}readonly def /UniqueXX 5000767 def currentdict end currentfile eexec 9b9c1569015f2c1d2bf560f4c0d52257bacdd6500abda5ed9835f6a016cfc8f0 0b6c052ed76a87856b50f4d80dfaeb508c97f8281f3f88b17e4d3b90c0f65ec3 79791aacdc162a66cbbc5be2f53aad8de72dd113b55a022fbfee658cb95f5bb3 2ba0357b5e050fddf264a07470bef1c52119b6fbd5c77ebed964ac5a2bbec9d8 b3e48ae5bb003a63d545774b922b9d5ff6b0066ece43645a131879b032137d6d 823385fe55f3402d557fd3b4486be79011d1f5bfae5c1f476ee6f05eb1d2caeb 269958b194521197b312fcced4867f3c8fbd030bd715d8ffda1dcd454b174e7a 1a97b59fe770e67702519d9d9b23d61ac08424d55fd4dda249cff0b56b9f3aff e9d0de215c02a52a6bc77155ff6b8cba5cd6646ba331254ac58ace650a967d3b 272331b87b6df06d5ab9d80fabe9f9ceac10139b61244814dd9fc295ed42d1b5 cd11c2e4beab318b20f51ca2c2930657e5343ab7bcf0e8870a0d12de4ffacb6c b3fdbdda481c2fcb84408d3d902e9a32070b2af6cd9317a33a42a43857c114b3 f4c3005cef9401f1c2bad3e69150d7145b79f95c9cfaf7a335b277e6435ab374 f6a3e78e124ac1e4615511f743ad65c5d778403a840310ac4902985f107fd33c 0049623e4c496cd353d2ae2a4804110c6a420a38ece5d5b235c5e35886a0987d 284e6110527b653b1b2c68c636ef423536180acadb954843eff4d9a82568a713 b682c574e30f793f093aef755c650e0e7175c2e3138695212d9fea7bd4b5805c a90985b134c6bc15a19afae0bfb3066363ca3e2568c2ac4559a69fc32feb443b 61243b4508b7524d974636855c83c8149d489b68fe18bd497116a953431251df bd09fa1d2ef66c85b997ab2f6b7c6d9d096cb43931379ff9782fa00c5f3cbd06 04265d16891ffc4f66e4a0307765d384c32aa83a4e4f89ac79ef8e76eed08450 e3466fbaf54f85324f0a4f04bd00ccc22d32e4132c53d14c043b47034450ac4a 843df14590e5231e492b11d4a00011c3d6e6f37e2632edbf6cff3902d64929bf b8fa083a2240fcef3f733839c9b0eeea1d5a2f357435ae71b7e0da54985d1dcd 073094f9738b4fd4a2ebd338c28cdcbba1cf3c6ba6e9937d4433ea6689a81e54 101843e8727e967c0072e3f5213d8d51a0a5d5d2403abe791b16368a0cc94516 e0ea65a3fa534bab0fccb104811ec1d8f7281292c76e15d8c63fb380731627e1 d778175bc7f3c82f19f0003940704ae2d89d6c68988b8ef3eab76a27eeb0a52e 31caff807f145de86229369d5977eaf464b28fd085469a556e205ed82fb0460a 3a21c3bda02034b57dedb862ebbabd8426cbe1030d3a9ef7c00879b162b0141d e33d2ef28759f77af23944c34b5fe1cd60f2f771da0708822a52a28c06b85d94 0d9e6a658093fb3dbf496afe77a934d38f8b40ad1cdf68a54dd3a3c941a8ace1 b59da77e96bcbd4d66d87260d3a12732536e744cec8188997d7ec0bede996d8b 042d2ee062b015414ea41761e90a14b1158457b60be807b496cecbabfff83d50 88a33a86125ba96f20e048c4d4dee62e79f4545ba2bf23693f4516e7b15fd7bb c056bef97ead93d4b5aeaf9ac807217b1e2e891f8e77c205ce2cdef3b78cfeab 61b9f34038ff9cdbe8089eb36e30c5ce1e509215b88ae3ae15037f667ee8fc81 aaf251518a8fce63650378d3860746a70780e361585fcff29262bca0b0d16247 cd24ef3051be061c44d7aea0f9c7b5dcedf7be674cc2790b2a855837973256d9 bbf338ef8c50815ea250181e5cd41b533bff8bde15f9e4fc58635d1bbb0f7e91 dc72e8c79e1d0f1f363347b335731dafca415c963e10ede64068ee46287cf7f4 da83b19b3bb6f3d9034d353992685db1382374afe10088327e08565e8ee145b8 8bbce87066f846df91c13a4ef187cadebc5499ec332e1f87010695d6d36bea8d 2aa9bfc562efc6dd8ffe0a1e2c81ed3c3e8742658decd1b594e49cc0a76bebd1 713b7ecb28ec2d37b35f09ec3ec6bbfd8aa0773e1391303a0f86a76bb2f489c3 c5233eaf2185d9cac866722596ecc67d8417d70eb13b5db9fecef9233a203759 8be1ff450e297fd840ae473651efdd5717ff5ff5abe95b4f894e60b045a30e1a eca1383522706b8ad5b27a2075423f065394e322dad592a3cbcf00f08058c650 f5eb81122a2a2fc1e144bb836aac7f9f8899bf31c957ccde26686e9323d39ec8 1dc3319df76d2660a9502988f731e2427b369a6d601f53b1102a1fe2d46f51bb a873589821c1bdce3abd08ec1271cf4073181a28ca93d1d135f97ecb0efd2fb1 847f944b0c9d86ec88ebc3a7b52f69c1a6bc7626319525252d024f4819b8ab33 30e7ee61374a00cdcaa3295daacfc3f578f8a128a5f1245229ad7d888df85227 03fc81d87230ffd9e2e52a2f205260617b92f026cd9019c0d99386483c2dd276 489f96bf18d9be3147377c31b612c4687f173b3bddb616a17a79e413703492f6 70a93b3f35800531f177f8493146539a68c1a68a9c6d2b04f8a345a3b4a586fa d9fcca9cc142f1aae763d424e898a33922000bbb75de9a80874234fd7aa52e2f f54e5f5e1b0704429eeeb9f160fb63a58c58d8959778958d0a2dcf283e60b4fd c01a6da101bb826cda9dd706edc1e47569c655325b24180b242932aa040aade2 91c181118683b152832e3975afb8ab02a4150b03d19f89895adedfc1a799e961 19b4707b1442530ec88279e79ef208a3902b103d165a01bd940cf63c9f745d0f e65d1f717a2b7abce99de86a56aacbb3daeaa757068157db43ed709b88659696 f1a833d412d4ff05e29d8ae200dca9f0037aca89e226836ec9932c77ec9ed624 fa5a9394d5ec1a15b8cb9f068bb33411a1d59807d41e1b1e80ce222c3e1d3375 2811fd6699ace4f99539cc50b82756f4f629af982bcf2011c0f5096dd8d61476 cbe2e113c7c11c1625d21abe93db6033cce4847bae17b3bbf7c4243bb92bc04b 9c95762a910bf00174771dbdeb9eef2285eefcf42794f28d8512fc065ac95922 eee0c285ba990762ecbc3360dbbd4691e6dd9405b7bd4bac426fa0198cd8c16e c3f33ff80078d501fb7fb3d8859b12017417ce0c1cc1217d1be45a3332ccecea 5a9478aa489dd69ad4b4319c2c510913e6f561cb7d51475cf3b302ca81011c49 71329872b49294f454ef56d5cd972b9f7365f6c9a2f3745b2d031c02810c57b3 edc3537400386334b8d19b7f148718a8002ea5b49dc0d34825434eccf66cccc9 eff518feb19b8226ca6789f810e46859197ee7bd3110d5d3fe1e123424462384 2d92c6ef276f21904af3c0a64cccb095b64a24089ab4809b3f05cca38e5d0195 6019a42f572b4df46a0c253704c332cac23d2ebb406023f60895b7600c7cd351 00e67d4bdebbd2049eeabae3a5cd9b7dc50ff0458e34d2ccef9b481e175ec5d6 eeb099ff5ec80c40de69d11e5e9d9ac8d879b6a78986a8a4f972ca1c9b068500 809264fa9df2e032fe4f0a999c0066a723553fcf40836707d0b53c8cad336577 54efd5f31031b09fb35e83c0da8f2baabbf61a3e1c0193e66fa170253c0eab3c c50ef45c95f95f5c50164acf152471adb2d34700eb38a9d30e115b41fc12b15e 5b880b24de94b71d5d0f299a2a60eb62c5282a2c73e564917bf85c11dddfb376 130c154f2ad01119636e89b2000830cb34d74992c9a6bfb5b2ed72638a4a8c90 52e15922899d7ae07ee29f038a187929458a647172dc89234946250db264ed63 e49bd4222cd2675dfc25e8de5d7bfe6064b2bd14b4a76993850ec1d2dbda9d24 d70b6c10fcd8e1c7cc4a9a4b4e17d2f367bb08a3becb8fb19aeef34b5b6fcfa0 19eaab900416030442acd4421f239067ab7f0110eba4577f9a2df98c0629785b 7f87a050eaf8ffdc13b7064ee330caebceb80c8827383c691ddcb2dbe4a218d6 3b02b53ba984ffa13e08e7d500a2d2cc51823eaf77f69bb820d6313339ac4b02 43adc01e5eca24334a1af743827b0fa0c8ede57ea186f32db7220daa6ee7576a c5df1e700d6f4c25421e286bcdd636998fdeb6f47a9698d91c6d029ae33dad1f fffa5e4b280eeab9282f87a54d0117297fe2bedd0c82a66c5fa5ecc1e25bc703 883ec21a25b520675991f866e828387d05831a0fb2dad94660432b8ff4ad41be 6f589d30f58643f023f41cbdf558a80ec769248e11e5e69a210b3595c5e2a97d d6d1342e43a0269aeb37b5b9048368e2d268b820ac1b675babc1f51872c7656a b28b612efc19de01ea3b6a5264360b45cf537e8675b4ed8df680149962809f4e e33d263d1b543786ee7197dda7f5abb86d6eb3b7521de11c15ebe3ffb0cf9fc2 8b0a62cdc43caec48122cd434938c27a1e34093a89ddff9929bc04f24baf869d 10a86755106ceddf53c39dea3e656d8917dc2017fe6cd572e817c44f44efcd91 1c30a634cb9171499f2b78acc670879853f74295308ecd218244a914039b8103 3c4c42a92d6bddb433fdbce8623b9a7901d4a9da6bc8c6caa6c87bbf0ab20243 3ecd77f502d747497060d8cb8d8411dc7dfb7a0e68fb6d937f588382a1016234 1025d31459dd9f48f653d82f15dec1f4ee3796878647ad1f4de95b50fbcef64f 1ca511cbd0583a926fb14780c706041512da0a301ba410e3b47be1f727ba976e 6a0f59228e5482cc5bd35f0a8f2ef1a38c5048129366aeeff2b9c4b4d25aaf3e 56dded79973470b95fac93eb5d3a2dda0ec423a03cbecbecfbc578128f86bbf6 e3275a880c935590db6299f1b4ce87b18193487f12ad8204f8a12f70f76e05be f56bac41a309ba5ffdbcc104cff55aa83a9300adab3b61a65fd2a849c3babaa0 3b89520597202659a8b5c939be31c7baadf9c22c92bc72e1e9bfb20db126dd0e c6dc4c4cd181aab45b0259953b996b1226ee78543a5cc8d54d17e29b10e4488a 7c11b7e80ed61fb6d72e7e99877496be4c2b4918034b5538a7675e57b6afb0bc 301dcb9f9d68331df69137a13fc3cf71b1c7a431c9c042875044d27621e11503 b3f8a59dee7aeba4902f385390e66d77c53ce89e4ffc00ca1abee15d5b41a7c7 285834ec349a36caaa79eace6043820f7361a2feb3b1ce86bc9d663d56b2645e e65e34ebd1688aa37b315b79ef4363869ac0af985ce251b2e06879beee022088 fed7f1eb9614232e7da42b8bc26f9005e47dd66b31a758344eabd8cfd4633043 16f1183d78098aa833f5184724c6f5e0aa1f280498dedd8da0d90cd7060fcd51 e91cca178c0237b25d38f71e0abc7c440804463a4c7608e51b6fb0d721fea1ef 9e0f856c45921c04842b7969c24fe31caaa4e864169072c680d04ff02d45bf72 98704d02e2b12cb9ae8ba90b21f592a9473590bbcb1170612c87ff12c12ceab4 03ef0a48ddfad0e95da8df20c5ffec86ce039d82718ef5b0dda1b780a35b97c9 ad3179a906baa4 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMSY9 %!PS-AdobeFont-1.1: CMSY9 1.0 %%CreationDate: 1991 Aug 15 07:22:27 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMSY9) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle -14.035 def /isFixedPitch false def end readonly def /FontName /CMSY9 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 161 /minus put dup 174 /circledivide put dup 175 /circledot put dup 176 /circlecopyrt put dup 177 /openbullet put dup 178 /bullet put dup 179 /equivasymptotic put dup 183 /lessequal put dup 188 /approxequal put dup 196 /spade put readonly def /FontBBox{-30 -958 1146 777}readonly def /UniqueXX 5000819 def currentdict end currentfile eexec 9b9c1569015f2c1d2bf560f4c0d52257bac8ced9b09a275ab231194ecf829352 05826f4e975dcecec72b2cf3a18899ccde1fd935d09d813b096cc6b83cdf4f23 b9a60db41f9976ac333263c908dcefcdbd4c8402ed00a36e7487634d089fd45a f4a38a56a4412c3b0baffaeb717bf0de9ffb7a8460bf475a6718b0c73c571145 d026957276530530a2fbefc6c8f67052788e6703bb5ee49533870bca1f113ad8 3750d597b842d8d96c423ba1273ddc63eb43f34fa90ea73a234af35fd9b24eb7 4f19626e9124df7acb92629cc87b2cf81c4a89b27447806db34393ddf0402958 e2daee0b4bf315f9aa0a2650d2e11ee289ffaec940d0af160fe7f29411c1c458 69d1ac3bcfe2ae4da72422549095f1fc9fec606289316f106e719a4ae2fd45ee 868fddf07a80e9a626bb43cdfdaa9dcd208b88fd99af20b27f9d6b5cda6a3fa8 8d5acfce8b5eebb38854378cecc3bfdac526514f1be9fb28ae628918ba942a3e 05b78c3aff808cf416a5ed01be280231b75a7aee0c66b0549713bef6b3cbc188 e625ba827fa5ac3e996feb1972b61e4c4784c6f2e352074e5c1cba27453aa198 7f93e9bdf9c6ecc5310fab0e4b5eb2794cd4f1b0eeac7dfb16f8429c0fa36996 4f8a86384416f40b66489e1c1d2c8b6720c7565347d5139e315370f86047675a 96ecede538fa53f098efd4eee0fbe21f668efb02ea2a234c7eb1b87abcbceae1 c0c28473378b5dd58985301756de659387f20cbd0d0a7adee7c573e5da7cc04e bccae5a6b4f5702ca55ec423e4f717ba82c83bfdc1a830ad34326505c67b641a 5909a7df8a4fe42359a870a9058dbccb1efd8e4184a2d1c42325be2efa7945a3 f85d13557ec3b5f47c92d6e0040e642f773fec0d28d6ad36c5797e528acac066 3a395f00862a54e981869a7b75e0b5ff99f1635fdc1490512472d19230e060a6 8c30a30e19611d0b3f8e69a5b11c0a8db04cdf3613bb74c61f456ba8a2a24e43 06217f59aebbe075e1a9fda49585e9221131bd63a597fa0bd63d049e230426ea 8d8c97b5e54292fc4845a47275d7e8d64a353eb5dac4c7bc139bcc3f494257d6 b5968ee58bd6afbdebec575bca24be39149194d6de65b8bd416872dd9da94e2d 81ec9b459983d9e4f95824efcfba97469277285c43be29b7afd405014654ad98 7df838ee27c5cfbaabc46efe5bf1ce0d3ea71c5ec24208545dfd38ec16886f1e 21dc92dea4b8b85fa98db0c38fefc7507c0a364d1da7fe7bf927c14cbf291033 6fe0ce98ba29c1d77eb7821cf2a103ebabff2c731c601b9dc2ba2a6bada37dcc 748daa872fdab8087edab4997a8228b3c09a7ae298b7996e98db312d7d119ea0 7be07eb49cc59471c7679ea174e20fefa20e3b860d69a84273130efedd630adf 07b0307843a068c98399161c5c78c90e3a7d35794de7edf58bdc16a1cce88fca 44d13ff57188814443f5e59409a559fffc28d4a560089fd380151c84f43a2921 d6ee28b4cfaa35804148aacf7a1e74db09ba2e08a3c85922128fd6ce62402c40 e1fb76a3570b6879f06e66865a9cc80e09025ce4762c00e9dbc477c8a7e342b2 31e1dc7da9c9cb18a0f4a00bee3bb107bc68c04b7c0c02c44ec2b9863da9db30 a8ebf2f8a738a763f72cf5351ca51f68de4a9b5e9eec993112a81ba675b16acb cc30dc7bcc1d85ba0ca16e7db96322e26e2678d9eaa1e6d27990c64ac17d0830 9f30c579f6a11c55ef1f9bf52aa8a55b41c86bab90b9add573f5d6bbf40606bb a56c0e85c0a735a2bb1a40b05a21f84e06dc3afb7fbb51e4da2765957abb8c0f cd992b0f2a5411b4f64554e242c3f650b3dfc1ef235200cb58ee3b2793bec78e 1b479949ed72b02ddf921ca325510dc3cd3cbf49db3ce4d624952fa9c6adcf11 268938d24443b7c00431bca83535f8951e217a91d224c80d85cf93518d2d06d4 9f96a7fb688c30270b74eb85d4b5206f6981820da9dddabd0a271b97229e37c1 02acd54cf165e8b23bac3f49d44a9383b6d78e54fb546fea0ed28e44d40a67a7 b3ee60d75881bf5e06b07586738fcdd20890d2629cc988a7d65e9669a75206a9 fa9e9e97ecf0e1ae4f328739aebfc574a57cccbf8e371282d161e2f9301da4c4 435246b1fbd249b9b74c46cd793166e17ed2cf63502c0a07ef0e461e97f05374 437f6ca0ddf767b5e320f87ba8d54807da489b7488a6ab92ef665dd6196fad88 b4e113a493b075d132e5cd5c4eda35f445b2aa567f7d995ab33ca9d73f542163 a36b57551ef304bd7c029a8f719390a75a7a2b36291b0846af8f182bb2978d7b bb3ede8bc0db56e3163fd2cba67cdd04fad9787f66e61178683b1917ebd773eb 2abff8fe6fa92d010db6a19ed04d9de8283b73bbd54329602d9deb3addc49e83 fb67c42e5157141498092991d13bb8634d5069ab8e151f4aca90ce09cb18457a ecc60ea7abc84fe1ad92d89936aabd0618ff9b50726bab014dbea5dfdb72f4c1 e7e044c6f0292e42bf201671b6335f1e7fbae1a278481941a9d50cce4f6ca663 edf30109364b587edad554eca9db66dba315fe992efdca1ecd3b1f41d2211a82 3a859d52062e33551fc0e29d208dafd3c98a8ccca0b204ffc0350d91e8f6b6d4 4ed08c9a0b748c8d52a36e1815a9d2c8a4aa06c3dcc88bc23cf5c924fcd92a0e 259896ab55b90d05eb391315c3270309f59566056f35646544a79279b533b14c b68ce27baaa7bba7908c00525cd35e77b27990d52f22b0d0970da19dcf270498 fd5d96ddb9194b0e60d91abd2dcb94630bb2b177da016dbaeaa4d8fb6985042c 3ee09541cd58732d8b492cb99b1ce72b139ad78a4d371381bb1b9700fe977329 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMR9 %!PS-AdobeFont-1.1: CMR9 1.0 %%CreationDate: 1991 Aug 20 16:39:59 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMR9) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /CMR9 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 161 /Gamma put dup 174 /ff put dup 175 /fi put dup 176 /fl put dup 177 /ffi put dup 178 /ffl put dup 179 /dotlessi put dup 183 /caron put dup 188 /germandbls put dup 34 /quotedblright put dup 39 /quoteright put dup 40 /parenleft put dup 41 /parenright put dup 44 /comma put dup 45 /hyphen put dup 46 /period put dup 47 /slash put dup 48 /zero put dup 49 /one put dup 50 /two put dup 51 /three put dup 52 /four put dup 53 /five put dup 54 /six put dup 55 /seven put dup 56 /eight put dup 57 /nine put dup 58 /colon put dup 59 /semicolon put dup 65 /A put dup 66 /B put dup 67 /C put dup 68 /D put dup 69 /E put dup 70 /F put dup 71 /G put dup 72 /H put dup 73 /I put dup 74 /J put dup 76 /L put dup 77 /M put dup 78 /N put dup 79 /O put dup 80 /P put dup 81 /Q put dup 82 /R put dup 83 /S put dup 84 /T put dup 85 /U put dup 86 /V put dup 87 /W put dup 88 /X put dup 92 /quotedblleft put dup 97 /a put dup 98 /b put dup 99 /c put dup 100 /d put dup 101 /e put dup 102 /f put dup 103 /g put dup 104 /h put dup 105 /i put dup 107 /k put dup 108 /l put dup 109 /m put dup 110 /n put dup 111 /o put dup 112 /p put dup 114 /r put dup 115 /s put dup 116 /t put dup 117 /u put dup 118 /v put dup 119 /w put dup 120 /x put dup 121 /y put dup 122 /z put dup 123 /endash put dup 196 /dieresis put readonly def /FontBBox{-39 -250 1036 750}readonly def /UniqueXX 5000792 def currentdict end currentfile eexec 9b9c1569015f2c1d2bf560f4c0d52257bacdd6500abda5ed9835f6a016cfc8f0 0b6c052ed76a87856b50f4d80dfaeb508c97f8281f3f88b17e4d3b90c0f65ec3 79791aacdc162a66cbbc5be2f53aad8de72dd113b55a022fbfee658cb95f5bb3 2ba0357b5e050fddf264a07470bef1c52119b6fbd5c77ebed964ac5a2bbec9d8 b3e48ae5bb003a63d545774b922b9d5ff6b0066ece43645a131879b032137d6d 823385fe55f3402d557fd3b448685bdd20eb05d5e7c2126132e33a59a7170609 dcf4871a5d023c9ef57d3362d9f2d7a440bb69bf653364105f16f4d0f03582f9 aced3d05cc76489b16e3fa8a446094d30038b06ecceda269f2eab9d19a99c7f9 39f9548f206c5a457a19270b2b82c43b091dfc5573468eaa3e7a4a32f8042891 d85e4b180fcbcb3091d2800e54c87d84ce9cad6869b5aabbbe47f40c68799893 d22b765295e1e69e33aa048b7ed98ba480ceca91f3ebf8ef85fe9a3976909626 b95ac5940d53f9b02215d84a44837ba25ed15cce0d504f1d335065594f3bc824 5405407591cccb11cfd4645da60d960c0b93f187b0cf7b105543c0b70f89af5d 264b6c026e3ae646acf145950202ec73282111e3e601cf2bcde22ce3edf6db23 516481420f26552ff4472d749811f27768150450d0d0ebe3c79f999e99b5c0f2 2eaebb12d97782b1bd91b2a1f62a76412548ad53c0dd411d4a08c0f071c2c218 63d9adb75a4621803ecb84c2bb235b620b658984b2d8e0c4637e2811bc8f0d04 6c8935afc70141e1b2d9c23bdb251d304b3378faf8928bd09686aa0340fb0cb1 dc48c996ef91530ff078666fad227a3589f50b605267212d3a65ebc1019a8eec 9a0739a00279471a01e1505c17658c10030fae32f274fdc8c8774b0d5406c384 a1d17068dcb0c2575c562fdc5a2176609bad9a2c255e426a4325a4fc3053c7b3 2f35f7bbc9aa50135f30223360fa2fbf019294b1d29c5e2aa489fe860fe1a879 5ea9f2098a92c845bc50220471ab711ba6e18c4ae211f10a172c60310c10fe9d f9ea1cfecaa5fee0fc12063f8f48f26955f5809f8ef09dbf7515c7ee361ce748 28581752d0169cbd3a850793875694c551826a537f8f736c280c09106a42a594 173592ac22d8837b551670e96f78b71486427834f531c345f233abe4153acf53 07cdc6bdfbf55788bcf0826812ea3d220ae12d403b7185c3dcc1d211f1fee7bc 12a6b005e4eb8dff9ea4f388e39d6ac968ca08b6fdbd3221c01021d4559a396d 424c14ba169501be4d66866be262648ceead5b083d49b76585c9c56f70533e7e 2252359fce8ead24b2c939257347f8d6fdd143d3627e35c52b49db4509fd17f4 fdeeefd92f148f2081e4b3facace9d2f891176179de908a0c4a44e41c066b98c c9ce3dcf52e7bbdac2633ec84bad3008f44232c789ec15d50459c46b7c7caa23 30d1e83197bdad5b30c5a8a2946d7afc54be2f545c6a1b715ebb37361b8e0393 e48a067acb7f3bdfd21a6aa00156ee0bd66b8469773aff77120d3e4336b3f031 2d60c7a2a0b8b0c19f0629b55f3dad107b3698aabd2c2938ccf4fea44fd00543 2f465312d83d9355172a9e831f112ba7f0c4993f4bfdce90a3b22fa18eaadd78 1751d563a4f1536cb3ce6184d5fddf213f931549119cb21bad565f7261e138fd ae28d876bd45463da8d934b68c16ffbd9bd5eb7adf105742cefff28cc76f8a5a 3e9bae64a9ee2e02ca448a2b57f3a9bebc3a8296273878f36cf4807f5ddbfa43 d146c8bfcd8a8306c6f7796817903672608a16123c92b658e4fea044c20ebfc5 0c4f23bb8fe33008e5d458181fdb28170f3f9dcc6b1d28d352f3e4a90d3a6202 2afa399269a0f4c10354c0e309a91aaff1ef2e9234aa68974a5332190251cb1c dba552e6d4a10cf186f87e110c6bb10c8b789b5e16f773091e5c3aa4b657f74f a205a3e23f8e505be3a6e96dd6a5eb1d95e7f150b31a1ce41ab99541b623cb66 e842bc7571bbb54c458b5975ee9767c3295e9745bbba4e3002833ff1e6211de7 eb7331bab0ac7f126cd378af226bc218ecdb27f193c04e3e3f818f6894d6fdc0 b122404f0f0850ac542115d025968d81e0bd23f0ab4c1d9a04511cfb942916e2 0d59ac848f8378b268ca1c20ad66cf2e84948dba48190d3b7478b0c08bde6518 dcaa565d35301f201cf3ffdc3b469ff611e989d5ec952b7ae74cd7dc13da329a 49f6d5655ff17c83f9474ba59cc9055ee7820a9f6eccc627a625e4d00f3fd7b3 3026ea3faf82675225f575e3553762574eedd95f0346862249726166fdee1006 db961c8d3275b5384c2282c97f686fd75aed35766a2c70685cd87dd58ae2f174 e0042e233017101bbcae56af9712b8310a7eff44b0777d64508c0286cf4e48ae c8d35224b200aac3f27619bdeb97979761fcdc39d253207f958ccdae512c5ddb f343c1a819547dacfc24df05bcccab980f32618dec766e5a7ce0be0b17e3737a 43ba6c9caaf4a1805246b6f72fba106f54901e50571640131fe9fd984c64e4b5 b40c9614d1e80eb312577da675887c9c6719aca79630226cfa9e0318c235506f eabe2f58a697dbb59ed465937c87184deb2221d7d32802d25cdbd22c7f80e35d 840b17c3c93d3df0ffe4de05d832cfc1ad3c5179d03d3211adf0f99ee6a1a37e c08bfb4298fca1e2d84b3fbc684e98514da22fcb74c42b549bd8ea1fdbb30fd4 5c5fdf8e3eaf5f3bfa2c732ff4768628a540e51672dbdce934f38d2b29eeaf8e 6e3f4525100fbbb0c3c0ecf9c1fd2348382feed1ee76c501477f0706ef610456 17ee23cc12b622a28d5dc3fd57e9631b6459738e03c2cafc2afb0d0b109e0a82 49667a14c1441bd94248bbc784be4aa28d1f283884d54d27c06c5257ead121d4 eca5f75c7945c9831e3a395416a3d3c7b1ff7b17d563321d3a06c2354b4044cd 5c9df75fdd53ff1b70eeadb5909d3ff382bf176e9c5e51b959bffc87260948ae 46c257a8621550c8460eb015a6f59780b875ac2a707a9dbc25ba763f7996ac8c e58421c7cae3c6ca50ba2dc27b222742a4a40999cb8e013c010f1d804359c288 dd7a9b3ca27b15a95faef10df9aae948733b3b6463b06c760308464ccc1eacec fb5f0d10b4196062541a375be9e2aa4138d5ccdf588b407ec75b5b0411a01880 607a3efbdc40204a668634f4a53a0c34a9770e3c0bdd31cd0faf5da94d595add 09b92c5749ebfca7e9cc5047cdb14a6c8ea223d1168064f29ea60332dd44b244 385dbd3ac78df6447b6da2d6a15d8490636d3fc4972764faa832101aee1a96f8 8614147091c2dd95b5da349787534be944e194ae8c54e822397ab3547cf1dc0a ccc479ead4a948f8cb6c697eaff75404ce30f0ef38fc1c4f723da3dcd4bbbc20 bb898ca8a5e3a85640bc80ab51e5cc3fe993358c4e183726e3d0bc820f97dff0 12011be5b6334dadc4a97d4f64f99fd9ec601630c93e0bdddb3364cb086a2ae3 a79dc738036d120ffb2f26516da23056a8180fbd6ce6d951a47117a402286c8f 2e621ff872633d7fb5f77d095b8e23e15274c9582f2c97b7dbf67d579236b94a 2c0a614fcef68c2225798490feb0440d76d29a5c5ac187c4fd1bfd539c8b05de 87453318cec85b34b0c3ee448f8cf12e476eff75144d77df3c3fc197ba5b97c6 4e3e37049d2e4309ace310f8e4783ef9f0ecdbf11e7357c2c477dbaabc673796 f325318d1c9de6e5c7d1af8816c3c55cef55a8d9ac8adacef917ebc862229e2e bab1414e1f071e32374930b2dffb0a341b05bbdfce1b1a91ac86f5a7d8bd4f10 9654b5b7bd36fa1890a442adebe3acb98b1dc4b7c82de13af53f861069a9b636 59a6a8958607443773e67a885beb464c73a65e2a103c9fd90f3425578f0b1d94 50ec6ea5a468caa17d0a6011907bc9d52bb52be62ad706186678f26254e8845f 38b8400ccf34e0bff21ecd360719217bd74326954fd06fd33e41f4c0f28b4d09 d3ccd9016760f77039c9c01e91a6bde25a9ab0bf1ab8552a5933e1739b35d525 376d8ee2a88fb582e7315fa0fe7256bddcc0192c81e60ba53cc25766ca168f5b f16766e953ff95ee36f0b2cb0e6143cd1bfc8d1ce52e5b6e2644be2164c8903a 87011fca20f18435c775cbdca8979233ca63237a65220a06e87e816b5e67034b b64efd5ebc81db1cceb853608779d6a14c887bd623744329c961d88b55abda2a 56cd2066442892add6f1b4b04f94ba5adf7b9f81138a2b054dead5223d23a90f c6df374e08b2291cde2f92fd8afddeebdff6089ab2bc52932f035a85fd722e91 cac5e91286ca174f881963e3aeb4b172c0f8670d842ed9fa42127e792bbdf620 0e9fe29e7f128a77d1951d99f31ba5b7c149d9c2d16bde82b9fa9ca6fc2f7765 521dddc25f7e9f718ed36f21fc9c8366776dddcc96f684661fbab20e88ea3ef5 6e39f52a5f5b5067364f263e3a22aef502f3d5843a5c16d90ebf5b34f84cedea cf694cce88db10208495c648db07cff394f88ce6ab5db92031465a9e72034142 14a59fba5cad8b31c22210915ff833e419ac89d217d3070a0ccef3edef1d3484 2444a73b167e3641e6e019fa132da997acf39f7b095f835a5eb45e1cb2d19c51 ab4f4a48b0b2c97109cdb2da48c601b35117e2d0706ee9cc90d0f339e8ad92a0 d1519d0d015185515068a6fa2523d55195fb4740a2b9b0f03e36cac842e3212b 609762d892b713c1f09abebe8f41df9e8797527a32fcbccd42f8cd9ad8c607be f1d84fb2371d2885a783436e8fae1ffc04b490d4e73fa056c9fe692037ae4663 57e840dcc665993a78934bfb5502bf1569fbcd741b065fe5f8892652358d1e7e 062128caaec6a4eb224277fb938489907e419e79543726eff570607fe3a1fb5b cd37b663ddfc7fe242840e93cfda5d62c6c2efa9fc9054f4a1ab79a459219bb0 27c150acc83f810fdc4b1b1e786bc681bec11da616f428982f267255c11ae76b b487ebcf6ea0acf682dde9fac1fe5e43cf826d611532dd94ae3a1aab01fe5557 6c2c88bc9d83b1297e744b6e9d32d839755a10d51dd8053d13089c4002ff9099 4de34e012b3a5b92c9bd47f352eb7ea9d2833934a9955a9edf13494e5daa270f 7e8e533483468c55fe426b5122a8da848c6b073f34c8cb3402500376120e7aeb 449c2392987fe35131d4e0ee308412e0f2b9b386bf977989338b7f18475dd32c 89746fca4db33086c97f6274e6abd832e230ccd921c9f1affa5bee5eb077e16b 203660f1e11a6a60023e296ce4d41bd94949df6b02fe24a56c59e9c3bb4b078d ffa28ff0f55bbc849c8cc6e3f317dc44d70c741ff0d0ded790d7ec406f443073 b1135b71d3ed16f451d24217c8330eaa543469350ae00ff2d8f1816ce7449f0e 80cf45af7f56f13bedac3315fe792b527b4a0fa9d2f9afe29713fd0948f9aadd 99e0b4df69a6d263a8efa5657c3dc990a99d3d76f199209ac274b345c2035fe4 c7875802120a1d457c6523e7aa0443e3f67548f514986a172fcc17c01de308b3 2ae403d10bcd605385ef0014898f53112abb7487c68919b1a150af52067478f8 6097d787dee96e2d2e87b64eadb31f57abc13ebb88dc3aca7715fb750cf8528f 5147965c429b1248c334c85013d2c23375e48f54f1bfedf9cea7afdd5fa3abb6 8ec3e482a16e13d46f12da9bf748acbe86edc9b2a2e11beab052d98c0425cdff c0dc30a38add2b7ff3008a6235ed36d325935d8bc88c7ca9720e014cac2d4cfa 054a94efb5e47a8ea79864111eb709c46848d9279fe201652fae65741f97882c 1dc16204b5d70c0e9f49f6d0ef2af6d5c706b4948e918af93a1e5e705480e35d 51fb30d91e63e3f52f39a1aec3b3a9326429a50aa2aaa9f77af4f91d19c47cdd 21bdc2ef7d50ad4edafadffc48bbdcfce0273d209972ede8a196a7c2459ecf75 b886916e2a39143f5beee85afdad274d357b0bc765e5f4b80d7b42cf8c8d8c50 43b0b182ac6d9bd2f8883833c030ef62bcb35d17db16b425871aa3774ca374a0 841159f6eaa36c2f80ccceb1485cf16975628e37d8510021065fbeb637d2fece 348036d8f84ace4426f9235649fea6e04788c039f519b2cc8f750a70f0bcf9a2 7df2eab360fbf6d8d814b7d4387cab1fb7b1e5fdc7bebf93995227739a5e976b 7b75770d29d5f9ad28864d4ec8ecfac90c6931bdecc3334e71badaf31186f661 7818d0e08afcaf0c431521f8ab0f942e33fc7633fe9deef846b13a2492be31c4 5d2229a5ae566eb338ad7a7689db504ef7bce3e90fdd553c9f0810b13abd1cb4 1d69f96e957411652cd522ffa0478c018da200370144cc0097eb955a4cba83c1 51fc8bbe2808782f37eff9c201ff0001a14a8d5b601a35ff2e7cfa8c453907cd 8eef3ada5fb3478d241e42b48f1a4c919b8e1122da464544704ec8d72ac39b87 69e4b7dd55daa2dc885be3c276b496f81ab9517a5291850657b58196b4b94836 424e629087fcde40a07cf05d0e3d4cb5d7b1eb21c1f193327ae44dc05a0b7470 927f259de216959c289547c0f7b2521faa3040ca8cf1186e896b1dbf6748dc2b 859bfa9bb1e933cf4b41ed7d699cd66ad06c47e1f1fb51251c9b0698b66b411d b2909ae7a32825f604782b95ac49129493185dfcc24787b612bc7d1a851a38b6 f2380c857c89f20b78ff57d68d76f0a1667a7ab52dc2ef5b7a1fd09d1bb8f6c4 8155032fc697a34b2680b1ba90b6938fadb1ba2e71e16d1d9170e8c134ad5e37 af04e22c9aef4156bf2bb5eb9901294c9ad67fb60d4bd0a33cea6cf799600980 f7166bdff9249542614c9b767936e6353860275c533144a26718fc9766ac6207 bab297e5783457283effde4ceb7645cc6ae56a2579acb3d2ec75bc258c14a26d 5488d29530342bcc20c6fc1246eed4c22647f2ca47268a86f135fd7e59352277 ce58bb503d9a617e00a19d7c5e73b98020a49719acc092fba124a9a6811045f9 0db01976f7eed33aea796ccbeb0b45461396005070e27d3aba74a671d1675ba2 d61c521f70208dfefac788c2fb560eea1177bd480160f52dd1258aae9dfa514b 92a3070cbfb49d692aac0003839c9fa0c55c18ad3b026265ea630ab6897b664d c327b542f2fd7c5634bba41294ab088bc9b158e1c35398b8abd3bd0583afbae2 d6744d8bea5deb0bd0e69667c15969fa5408aa32ba5225bffb5fe5d7e4558708 cfce572a1c4144b20ab887de994c59a25ca67aef23687c47ea1f60b3bd6c438e 3c00c808a912e6014f5ec65b1648976d5e056bd7303611c3f9be4fb1977a7050 d03118ce6b34f471bf2aa6020aafa4d3f53278beaf2d30288db2527a42393e59 6aad889f5c49af9ec6ad81bc0a87867c97d5bfa298455f1b12f7f3826fd2921b 49b48fa982373bad9bfe1b92938a83f2e513f82b66e095fd5c8d7f680a206f0d c1e5dfc00d002e29c30fef6f28cda5a5d57c60025de194056b7620d67a446fb7 6c70dfbda32570247fde6094aabb09a6f1f8525c6dfcd7e4b39a3270d83c2af3 7b548847d17e60ea98318bf27068cc4d149d69be02944f6f95386f0505c9a483 55c7a24d159bf10d6026f9948d27ff1946e55eb94260aad15faf66780df8de05 2fd023f0ff8e1852c41b0b4bac9f5ca22d7385c201cdac8127cc27ec1da7d678 d8a187dc1375753440cd72f52d8f4464711a482dd64c8ac6e99e0c7e3be15a42 0ea8a5179972b2848b7a7ba5ad2a9a190cb198c24ceb55a35a49787422af7a26 72eaf1e82cb345f16f034af7ab85e7d24d4e34a914e65171b0d5aa8ef17157f8 25fe542fcd48a278cce70c5ce0c2ce9c186734507b14e00214628c329610851f 081e571220609f12b02238d8e614439a0b70e04ffe6417b00ddf1002976adac5 603f7ed02e1e3bb434817dc0b333fed58af58d76a28180dd9af3f97de6df30b3 1a7242c55cd8cdc35c9cd4125123831a7ab824654f8c3de6e2dbecaff13f7aa7 a742c04193a559a8d3d442f9bd7d10c28871ab6a4992e59b6c5614f1c72c8dc5 708c55123422ad619a70de5633ce426ddbc3da6a9e9c0a79edc101423c15857f 77ab0d08ba59dd82d3eff2e20451883ce89f6ff9c171159f9b53adecf47f5990 ae225c0ec3729ce535ea19f987cbec69331a29ba928123f49e0c7d9e11702747 75a670706cb5c3a31640255e565f7d1ac7d528b0497f1a02e5a527c0b4158389 08fcfc4ca8ccc7f6c17289d47c82d264563db62139f27096084f918b3abb17d6 5b0302cdbb396919602fe6905779cc9a01589c1bb150e75a8aee454ec7e99d35 9005014cf9e28eb7d95fb04271d3ba282ad61a96595c6b19960efbf37acd04d7 0aacc45d0ddbe2575f9fd48544d661a552fc2bb3640787d1d1daf811fec99634 7b01de0227a96097f3e6deefc6c0e355666f7c980cc3df122f865f0c9e7501a0 5df49d544fc3ffabef25bf2af40e1f75641a2ff72c361b192b7ed4ff94617299 a746a4f9da1e2c20cfc7e0749c9bdeeaa5f956777231e00938fd21ddd0f1e185 a8de64ffad8eba5b79757b312f3311f665a2b8163cb06105efd2ca29f2059f40 519e8a090d813a86f2a4e6654cd09f88b466799967765f2d1c996308a100e3a4 6ec58bcc4f18a75ffd1806810091d72e36a9eeea03787e3eb0e74aefc3938089 e626bf7d2953f646a043e046c7bed4ee695f9d6012a016c0c3ffb58893eabca3 0ff3a9de489f12ba6597c285edbd33a43d6875b61c0e1e1034d732022206e494 86dcc3b262cb2218fb71acb9bd5befb9a956fc9427b466ea312f12491643e3c9 16db6fbb6760ba3f40ce5aa7de5b385895c2f1367013b295275ae96e789f7864 f0d889ef1fcdf8842b0c7055a4b46c6769317f311d3c0857257b08c67cb42640 9a64222b3da2dc02a9cc722c5b8084cc4fd52aa0a3c5a6694fec1e8ebeb4dd76 c6a56d1ad706dd4e99b0ae92ee168d815e5f6f4affee20496cdea9ee6b110314 adb9e15809cb3310ee1522647e5c655b505fd09700b7f9979eb08887d7ca4c21 43549ac59d0bd96d98230add3e8b4264b702ec86bff9e3370340cddb74ca22dd 67e52c40b9b50eac6739bf4112193b0ba5d2e7c3ca04459604e219b862bc0ec1 09498ed8b244eccac237b93bd50d0ab6610182c7a9a25d1e61ee6769745887ce fb560210ddda107883b01403c111c9c19dd90921b88d4949a2fde17b30af5247 c17415df2a46e98d628f5f7768dd5ad8dc68c7aa72db0d47ee0fffa35ace1590 3abe6d12c807a0fafe53087bfe980230e97ca6b217c3708225a670b3236379d5 b0f060109b66ee0faf2d263068860268538634fa9ee85811cb35a9c39a791ded c7eba1b380494e682a3d44cd83e02d986d4c0c87f7030db8909b432954cf46c0 51d7cfed7e6d6a2d4e7657169aba9eba71eedd9c9da5a4bb4187653a9b3fd364 1fdb43d2f5bd85792ba633b8175c3d9be4491f0f712514e066615cfbe404e362 fb1a440e878d22d06cc0c9db81601906d2db8d032cae6d89722f6c0c6b2d8424 0f9dcde114daf4d41edc41666814cd5b3cc934ce51783bd9b5c8efb1f8da67ff 350cf9ec05cf5127e1512d288bc42126e7de62f5ca0457da4cec2004bb20c6e9 cab822317ad1b333089bdb528ef0bf643237f23ee88b011e881e131b8df0c286 c03cc37122060c5925681726b63ebd4e3cf40899cfde16b5449f99d2bad8b045 6b23a20ee66dfac0b635e33b7c2682d021bbb7a46a0c2eaa551098315145a334 443316f9196d04b4d4865f05b345d3bbcf07219c2a9bffc4e558f963e0f66398 2ef0bd1c90dd1b02c33f0fe4a6e28e3f3434488046eb007a840ebd88dc06b99c ee8de59949c86fe38472810d420a2f969bd16b8880c0ae8d8377aeffa95e03b7 a09d41d334c4968ce825dc7bae7d2c52d5d6f4b0b9422d119b788bd0c3889a5c 49b65af37068ab5296a919be576dbaf14a9408f4b28e147594a70e47f82854bb cfc7f722a4fc23b355c91376ea3bfbb051347658f447e2f2e948e8ec9698425b 664b2b377d4ec83fce247b5918126b449415584a2dc28495ec9bbf247015274b 6ea82fac11f0cfdef9fe21f662935915c8dc8d32c9ae5d2b8b9fccdc8541bb23 bbff8ead5a622a4f7baa9f1b2da5477639ed375ec21dd79b8294668351edfe5c b25becf3cf99a776ca545ea2b3ad214cd89db19ccae3de3ce5ef03abec2304cb 569c844dd998ec6eeda7e6de7ba756b56ab49e7ddbf5a974c3799b864077aae4 81026caff80ffacd2372a69dc806614db58b006e5d7d5f62f5f849a1fdd6c5a9 9ee6e1828672f2036377edfce93d1b184cb5d5f77f490a9071f812dc784fa764 883da51d41e23c8398c3886ceede76b78203e05c26ae5d046badf6d12782b5c6 3c9c50a25f7cd14ee2b3e73e54b7ccc08c37069209efece219baed9462179353 7b38523d620c20584cc134d3d02c24b48a6b3feb3403c12e42d254d19c54b6fc bb74d3bb02ae1119700a3028e582acc75de132a30568db2740efa0a7ccf56c66 a84492bf9be26eba5efd5f2424aa186d2e533d308961b353b536002528f069ac 94b19cd58cbd5714c3ea5f7ec75fc6f280e640eeabb558e4883b1e1526bbe1d9 eaa046bfd9ab3846891d41290510c86c24a1caf92017750f4c0e23971652d6c5 cb8f5f13ef2db8963e204078884973aac97130c522465f1454d1959fc0815962 d054ce117ac09e6f795aece31c59c8be5cbe12d53778e7f981eaa986bd5c8b08 313868b9893b2717a8f0e7aa14f28458cda01e0cbc6340dfbf891e64bac2a441 b5c1028dac01af9fa74ba18b7e079a453c9416a2a7e9181bb4365e69f634f986 8fbef10f76717817dfaf56fde926586e64a13afaee47b27f559e293a0a0657a4 c2115d601fb835348ea9e707f15b67ce3849a0abc517f6f0f3fe7aee2cc6282c 4f4ed96169b35ac133cfa7c412f0a62dc2339190ff90eedaaa3d8d3c6f4f8111 5c74b54238616bfa42c12950d733ac7581e36c559dabd8405b4ec1ed54567b95 cc2899635228e5e3335d5df83f7480f0300426ea6a96cd4c134eb895f519e87f 2e29b4c52aabb4caedff819c931798656d2e450dbac048803aa091d012f7afa1 18881a3c80ea1e751e43e9bf3ae06366536fc80dcf55cd2ff477808b23fca0c6 10815a619468b3cab9d4ffbed50310f3a4836fbbfef59039b3c3af15e615677d 4c0c7d013e4e99463efb70cca5882f361d1fb6c51d4f9479d5bf33636c42ed70 7a5f755fa070f5e1ea081def47dc102fdd4a7d764c1c8b3d03cb32829d7104ef 7b2fdb08748da64ecbb5f78410ef208900ba04d3962671214cacb0c14bf06804 d5790cb18498f9a2349370d9a58807578b381ec2b2ba1dd17b5ddcc90fb49068 15aaa90de9854ea1cdfc060c97c9b72d9520ee48b03facc8c9eb7f5d82979627 733c89e307d72a724570407cdd0072277ddf3a9366e8b8751b9d38fa1574e0a3 29955085c068a0c55ddaa2e20fade71dd49ac17673b77073d4fec7165489fc1c 81168e270e28267288cd5b723b3b80f4bdc49e85ed7dbcf76cfee65bf4b7b2ac 0fe1433bff6704444e809e11d9188f3e8d07e4d9e502481d6e4e9039e31150dd 367b7e472f6b3b5221e8b3c2cdf5509014a782177a882a7ed88ece07144f8323 0c006d3f16e030184a058949ce99261fbb69c3b1f309be3ec8d728a8090e4a73 00ef8f9dc3420a3729006b3dea4099f6fcdb1603d8f76d4f3a4aff2309009230 0068a97b0f01388865dcd7a3b6846413bc482a149acd6a15ccedbed1df8dd329 384a5e82b618e3bd4abca59f920be208a695afdea6b68f75676700403b84386b 4fc85b42bae12959e47c05a4c108bd8903cbc518ea6279f5f4d4cff06c7b1138 10f1f5b92028281c0a47b2eb978771282bcfcc4f257354d709b6e47f6c53a1c7 d3eea7ced542cd92b755e7042c49bfc690300799327a9649ac5b56ff8ac4e1ae 7f3a5c4ab0dbac062d232b94793c86c3f3efd2081f0d8cc4b582b5e09f41b9e2 69d111d0c93cb1bd41ddc01c49cf8b648b58e1a7eb03e3b01b82882ead1662e0 cc5cc1e05a9b43e6cc861b815e880391daefc33c37fce0cb5391bb725a2cd82f 6b57dce8a65f7d1cc14119417c7c37f48deb5db049c8b00e3ee6ce029413a482 1d31844a09e59b18318288a82e3712b0e80bf3d086ac24013493c9b0d87e2326 38886665c1ec3aa65dadfa2f6a189878eecccd72c24e557d851a8e69920dcb73 ac8eef81678a67c934da8e6cee84eefadc36677990ecc464098264845b95669d 8bbbd3d9aae1f8ed2cc1e0fc4101d6d5d37b9ef1c5ba3337a197a0888ce3081e 87518818976788b37d1e5dcf68ce2b0a257f28d6e48686facd832236ef233bd8 3fd21609de1be46e33a749b5b16f636c7f4296eb77004297b3de06e7296ae776 b428ee8fd4669365305f0570afc4962d8ed3466f172fd0b0a317a9ca27bea34c 9fd16c4efef1cb7d909bbc07684c72fbce637e9514115fcf371bceec132ee06f 9d669ca44a2bd24f9831b712f73747ce4551a567310e25836df8a7809dc8eb8b 1624492fdb0635bc17e0d1cb1b3cd857b181179294d4c707cb4e53c420b4ccdf e8cc77ba7f542aa196ad9fb502d473f2c0f46e6d5d3a697cbdce7786e6cd421d b9dc882819a04d74f0d8d73c42d594c07b51e6e7b28a53a49f80d06c25080afa 8ea28916eb74ed96a9e6c2f89d347cbde61d1b4ef9911ec2fc68d4b892cd5860 5338028b51b7d11e3adea78d2152da9a950ed8a4ea71f5f65698e57873bd2b2a c861eb3778cf00380d78ce6680a454daadfc049c65b6a59b1201a7b0a3cdf7ab d525441746b576b385cb7a500554ed42756100e24b86850d8edba95456120f52 3ab03b1e35e1483395690ca54b3b77a35a6a5c268eb40593a0b531ca48ecf6e6 c31dfc521a5be525171247c918a055ed5dd4cf1b7e47893e1758668b1ee8a75b 7a5f54dd448d223507cf01cdb75d39c73642142843343a8c98fcd924684cb4fb d72ddb381ae25a7591ea0bc0443bfb4c21b59ef7ce15fe92e62c02fdfd52b8f5 77dcafb4ccf822f7de9c18050197be02fd5dd71f1460371acf97fef733f8f70e 934e44aee9b7b0ca6465c9ef1459255e9818b29fcab964c3a6927ad212c035d5 0ac2394670e93507e59a54cfa623c16c70bc64918c18575f559db82fb588623d 43b6a9ceb20c3186d1fc06680e7abb61ccd595c4cde5355bcc200ce50fcfa915 8941a0448e83621e8e620bbfade75a9e95478f0797f612cbe0d7e17d71d096e5 19376f4075bb03900db9369969cbd37a0c05e028d9e5f798b774a0aaa37f156a 4dbb8adee42c8df6b0b7eb81e91b0efb36cd5ad3599729764dc92ec299d47b87 ee9b8b02bad0ae452596f7cb1fe0bc04b6296ee9d5cb92b9ac03763b19afdbfc 035e62923ad496b7bbd243254fd858dc77ae2e21cf642fdad49b5bb4706b38b3 4282ceb5a4ee07212ccd686764aac23978629ab8e5a594d0eb369967c2461369 e6b9fc4bd93282a44e70382e113d6e2de23adb84d542b6faed9acfc2026b41a3 efaf7b8aacc188775b8c2e2fd9a72fe53976b06b95d713c6e629dc6e38e93d43 aedea36da72e168f58f86b6a16b390e758ed787e447aae6031d916aab403df13 b99f393a37924d7cc8033d8d2f3d17b5a3460e1364103c1a8c4f447b241580a2 7cc1f8707d6c4123ebd6f953e1137fba19fe5ba0380a8d727810f68b23e7e276 96f3d9f866f81daf6e1de40e355b687a8d6f66d7eea5e425cfddeb9feb9ad551 49297bbcc777c0a5295cbf66e6dc3368fe3271461df13c6c05ffefb96728fe80 956f84919b5f508b4b107d8de49263af054ad88e220a5ee718b437c49fd04794 297925b91cd6cdb38927a18401353a75d59acf95a52a3fa4e475b8f8aec9c8d0 75994a26ea8554433addce2416c0cd371ca499586f8df0a3f24d46da22599265 4c1ce960a4e41af0347e4f32db95cd522ab0734c4297f3c93269c311223032b7 211e6f540218b6e65c618495225528b575b409eaf89832860385e983edd79e3e 365aa9acb276098f00870faccc0ed4307204bffb29d948606d1f172c4f19e224 e9911aaeb778fc2ffdb4c55d77aac03c486678fbd0b9f2717d50bcc9cb08e77d 1e9fc23cd22ca17d061bed98ef32f488c3ecc969f11ab6bef41d5619c1c2face 7d6e59d74247dbe0062704b943d29449296f0001518c37d1edeae20139124614 c1628490e71cf5c0ab6bb803d937e412eb0948d1c35d60fab9c47237f30b67c5 095b3e5e78c902d7ec6d8bbbd5994323d539bc91c371514c920cc3a9ed777c94 47e2c8212d9ea02f6c02d18b6f2a0873c4658a01c6e2b178abbf9355143c8000 31f4264ed6dc14bfffa6af07a343e1cfef161501ac8669b85bca34f8dceca1ee 36d2cd3088dde267fe28611b723700687e6227b3caa7f8d47899faef7f74d92f 8cd30d8dd06b1cf4f3111342fcc074c152b4d59f8591760fa581d6d7b58a2ad1 f088cdc6f8091f287c0f9a33a13f41b8d938362f000302a3695f99f43f8b7996 a57c36b10974c49b3bee404a2e5d97154f7dabf639eeb147d2738d4474a2d22a 40ed9487cbf4de4f14dc78b3ac6f4ddcf3f36b1c0ac6c095a4034ace23988d49 efdfeec1f0bfe44ca1162d82e2590c05f470cad05a022a3749d8960013c2f0da 928ea75dbe266c8e6a26a42e0c437139d77aa73a10aa7a3725ec6631f9482f2f cff8569f2e155ce28162d136136ade8cb36f9a85863be64ecf6ef35aaafafb93 af996aede2a8e20e8fe965076030bc95c353508ee1e0e53899815c580c0331ff e813ee6f7327ad90ce863bbca39ca542cf225b818eaf33e808f4ea4546821a76 759e06fe18340c88ceb494e0091f322dfae90db405767876f2093f769865d4f4 1f222310250726ebb11055322f7a5ce0bf7eb37c1319618f4c3f8c91f0e490af 82ca04318832fcb07ad4e0d3ff7f28233a4eacd894de268b9819330d99f4d701 bc62ab232bb2c84a0bab57a3e383a1e9654409c8af7899088310f1c15b277a1c fb7bcc3da1267a01d3f1eba0e392a3014611aafc1aa430adcc9f890e099c8fb4 90ff50f9d4cdf61af38e311a3d0669ced05bf7b2cf9fe7798683b506524686e1 790c3738536fbbed23ff9ce35b7b59fea0db04c277186bafcb3f19f6a121d885 0455d555bf4b8df194812810d0628ad451169403aa554d447ae77b2375354b43 13c0c257ace52a00e4f3a8a8f48569d69f7bc2cc8f007b03d4c6df7a87b8124b f710f2aeeb98abd8f5e79e33cd8fcf67e1c0b61b27815ea90c7370a3ff223263 950c97dad071325ec308ea16617dcbf409a95f9940d6e18500b54e26c3f0f794 45ac542548ef0cb387c4508908b5af1aa3f7df5df107fdd546ca1e1da4a9ea5a b5d26debc84ed3c5c080fa5642554a892b7bd244048d16c44dfeb8cbebfa9a5d 7762c661a9dd7abe67780feb1980e8d0bdd7933c56e150042eac688ec8434052 506521221268996d1f8e210b73df003e3b1aaba65661ff084c074b34e331fcec 509f8d07cce8bb6cbe3aa28bcbdd46ff59de0bfffabd412509b61058f43164c5 72ee772085444c77b9c3288b9fa166ee06d9e5a08f23e1682cddcea226691906 919e7f7a1c384cfd4856e93f3682d1295352c5caea543ec7111ac7834953151d 5c0a01225f95f797071e353d77e8e581a7e03d41879318422f0552c837a7a225 a850611bb703a4ee58cc43dd46e670f77bfbb84416100bad883206a402f3cd45 42c8f304c1914fb93f3548610f2eab296df5013ee17380b968e03179ecd80e0f 4f841439efac5591009ecdd6c23e7ee0de55d4e521ca372ebd57f886c73a5488 622326faebe03e5b34d234647dffefcce7f89199bf29bb4230c5a7860993d642 374c2956df46d005f1e2147b38768a8b033271b1a98415f8fbef24068400c749 e30ba7f944686b73c6c5280714ed91b4b36d56cb4a98f3f17f26e8445eaa4f18 91758e53c8c7555e4115fd2998bbe65832eb635e2da8a0af25715eadf8c1c6a1 1ef2b808f10f5fdae4afd00f741c59961306b55f6e984e670ae893fbf4f9df02 5281f26a363d5676d82c07bf2d77435728c30cb8f98fc0db996f31eaea06a11e 20e5f071aec866163efabe68eeb8b0857c6ba09aa984cf45c3996d1a8866889f 5c070fc0393e1356e43a58f9c1fa33b3d07b048fbb9ba5ec26f9b45a73c34e6b fff97c2fc2223ac62e84d8ac6c6f55b3b0fd2f3711d7ccea5d9e158f127b84cd 2f9133225137eb51315d833917bdeb01b51cfe53dfaa3d37818ad3acaa493b0b 71b461ace9dfb2f9e0eee45f78767f6fef16ed8a50718428a2694aee16d74f00 096faa436059ebbaf37dc11c4b33a7b3942247c7e85e5d281a988ba8146c6680 39e802d9349d5f4aa80081d249898a2535919325409c3fa75a8a5d04339b5e46 df7da2f4a3515c75730a0f02d0dc71e762512e91ec6d89977ede9e547a5145e2 ee61669293b4ea5f15962b273ed28691c1e264d62d01974406f36f16ffef3916 6c9d60e2e491df06ecfcc2f04f6a89a8b262853142f5df37198c3b1077d6cc66 d15dd03488b78ed5c35b9652c9f4c0ab1ab8244bf2120150c3285c3af1ffc1eb 2e65cbb68eb879613d41409a473bd906093939ce53e22cf367c3e563fd2d1cd2 3a1d710fc72ca67f6cb9cdde07e86e352b3f59d3159f33614eaeb34bf0fbbe8d c3316e90e99064ef83ab1114e2107d1f52c4cfe0ea8530ad2d1ca0b83e8e7d63 a45afe24bc2c03222430f4e525c5019e0209489ee8ee45e7f6f05e15c1959f0c 5f1b165ff068db07ce3f18b82de99ac08fa5bd23cc4c323e25db340a216a0c7b 08ea44e56bba0c4f09349cedafdb5a359be87eafcab104ddf3365bcc35f4ef08 31ca7298f71b54b4afdc2f5fcd9239d350b2de4a36377de4e95897e4d0c52c86 afa417037ca05897ecc43bf11657bc6438b01210bc6a840fbfec0905a81653bc 41d999e3254fc838f3db3ba05ae2bd58282bc7aeddcbeb0fca67da7daf48db97 bfaf504672e8a28931fc41ba67ff66c0965ac20c03692620210443ee91c4285c 8273ec96f99c6951de4d82be98ff23dbebcbf0d027e851d6525101222a9cc410 1e414179a5fd9143bd5c52090b2b5383fcc49b24546cf714863480f72ff2cc81 ef46c027b2ff61ebe6dc3dd9ee430cf14cd834c68f1ae8db65dea8ad0ea3b3b1 f0c15912f2bbd59801d3b22c8d8fc30595e1ec03c865470555212c30c195b802 8fa70bdfdf4e2ccdf25ba32c605f5bffb9bf762e626964ed1b5b947724903657 98166ac6f58bf21eaea538ff2f42409862532af7ecadd923a21ec8df726b7db3 b3fc69b4515b5ec32cb11f57584084de286b153648ff7be4bcf28461706e2fbe 7db18ff7ff9bf19c79e341446f8d9480cb363b05c26a6344a50019e1b45f3cbc d0c204646ca71cdbacc08be5f8ed2a6abd4508d04acabec4bbc1be7af5e41354 fae888909d7882fa2a0caacab4afb5ab36c47015daa666bd234a45baee8de57a 42dc5ab721053b813cbb6518cf38ce8ecc17263c083510a47a2698a907dbb0c8 db8429b1f043927058e7b661aa480659bde959d92220bb841f8fa757a6fd2144 23cebe4ccd9e818f8f0958f0bfdbba0f0c056c44d6419abaa0d76e8e9d067213 84c66936b9799aeadbbb9fb5cae1454249be30076efd64028b3a9b051ad8588b 46353cf268aca60097677a747866dcc890cfc8c3a5649b727f6b42677918d7e2 bd8d50799a1667736dfe8b1c2e5facc04df208854528b9993b562a7b7fb651f7 57587727f5e8d3f8f4f3dfd90685a8dab87819db5c881c89cf5485602a868dda dd5e0179a945918932be46519d1d4c668aafff3932c1c000bfe0d144d7c6f5da 2288a008b66bd45bf1c02f3a7780a9bc58ba665825f4282f976e76aa73cc55e6 faecae16e3be981a87a9e84063be3fbbaaaa70d34aaa789bd0a40b81e81ddcc1 26b034ac661d2f8e2fb091d097f9df2816a055efe0e5d2516d87cb2bb6a8e9ee 15d8fcd0cc244ec281c9e002f9e688308ebc0d3d98fdcb969863ae7070f147d4 ce32626a4b2331e83c8dc2ca065161cd59fa81584b71afa8716713f59311d938 eeef5c95619b7b3979a3f24f6749b03c0fe5c94199183b35fe97148118fcc836 f1984f77c58d1235b3dbf83043516cdf03eb490a9108c0ec5f43ec92faba4533 3f9f951a4df6bedac3aa1ae34f53497dcd8420b5e230012cdc201793274abfa6 63b89960999856f9140714ca882d46a7ff5d2c641f70b3bc0c4fd5e481ce5154 efaf36e19eb570e836003a1638d6e43ff5ec5aa73f7413762c4cd152e3da8a25 4c6fc437bda6b081f5dae22d8b087f847107dc5ac69885f5e29a8c81b2a48dd5 7f3917e962585f9a4c678f9a9d207c96a26f0e71dbef632085e72fb1d3a80797 7100e69bd5701d76c39364643ec96e9045067c692690a10210b0a7bf89ac6d54 b464c9cbc8e806da22b80e6b2177b6480dfd7b55083ba848b970aa7c1323e6d1 fe023e556539eb7928deee23f441a3f083d4521be9bb72d073ed554efca5b001 52f94e9396811f88bbe157c0456b52d61966c311faa221c0e1a1f27380328554 eef24c754722c07322fd30dc41fee3dc7faa6664c2e0dd98ad2268f4712629a4 48a44341703082d9b617fd5fa8cf2ebf809a839077baed48c591b168b43d74c7 2212b4317a28b8d36871c495bd3610c05a5de8e2c1bd972a08f1d93b3c64ee5a a073672f7694b4accd10940a963944130d196c38ad658d341bf5cab576e1dddc 6641d30b9c2dd2c65e8999a7e9e9009c1e1b58e1aa8eac0bb6ad3b9fe174c77d e13e5e4c1601760e6be2e050f556fc70bf11611f8e7328e6ed9c5e77a8a1cbb4 c9d94c7c37b0bdda804378ee8393373b54492e5ce260cf7f94306e7ab0b4802f 047f06ac3cba2b4cd7d396aecd035ffc92c80d067f05a8281988768ae71ca116 15ec425b3d06abd32fe6ac3fffd8a36c636874b326a6b8e24b0dc261b5810092 060aa63712064de2c84854aa899ebcc57cdd37ea015b563cd58da3b0af11600b a604456b8be9f235d1f2eaf39ba1c222d422907d44b8e51cc6298b4cfadcb50b 06be8c1860c66e18923eb03f8fa5ea5e2a45847c5289b6324e673ab0de60a733 27c4ef13e3cf6f23e338a6554b18090b9211dc61c9602ebddd17a449e6e3a3a2 e9505782e4faf7ec6be96b392a880c04e21d248586ea3f13f0b916a293879cca de986ddf0981bdabbb26e56502f7c7f6216ca0c224f9143909c2368cc50c7761 c81de900bd85ec5629e570460f32ef3a0b9f4f36a328198bb7af7fdb31776a90 e889 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMR12 %!PS-AdobeFont-1.1: CMR12 1.0 %%CreationDate: 1991 Aug 20 16:38:05 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMR12) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /CMR12 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 161 /Gamma put dup 174 /ff put dup 175 /fi put dup 176 /fl put dup 177 /ffi put dup 178 /ffl put dup 179 /dotlessi put dup 183 /caron put dup 188 /germandbls put dup 65 /A put dup 67 /C put dup 68 /D put dup 69 /E put dup 71 /G put dup 74 /J put dup 77 /M put dup 80 /P put dup 84 /T put dup 97 /a put dup 101 /e put dup 104 /h put dup 105 /i put dup 107 /k put dup 108 /l put dup 110 /n put dup 111 /o put dup 114 /r put dup 115 /s put dup 119 /w put dup 121 /y put dup 196 /dieresis put readonly def /FontBBox{-34 -251 988 750}readonly def /UniqueXX 5000794 def currentdict end currentfile eexec 9b9c1569015f2c1d2bf560f4c0d52257bacdd6500abda5ed9835f6a016cfc8f0 0b6c052ed76a87856b50f4d80dfaeb508c97f8281f3f88b17e4d3b90c0f65ec3 79791aacdc162a66cbbc5be2f53aad8de72dd113b55a022fbfee658cb95f5bb3 2ba0357b5e050fddf264a07470bef1c52119b6fbd5c77ebed964ac5a2bbec9d8 b3e48ae5bb003a63d545774b922b9d5ff6b0066ece43645a131879b032137d6d 823385fe55f3402d557fd3b4486858b2a4b5a0cc2e1bf4e2a4a0e748483c3bcf 5de47cc5260a3a967cac70a7a35b88b54315191d0423b4065c7a432987938c6b edad3b72ad63c2918b6e5a2017457e0d4ebc204a520640fd7c4d05e35ea5486f a43d0e970787203855daccb1ed0b16325828b13b7c767a1a58c87902f0546ea5 404440fa6526975783c2d7a9572b8e5d5176bac598b8960609f49016aebf3763 89c1adfe6a1ffc0c53b3acd9d168ec3a278fd4f1d9b085dc2df701346c9d0887 3d230a161692b42a45bb5da343b4edd839dd60685a59aaa49fc65cd8e2ad2a9c 5cab953495172a1a9f40d5f38e922443a519dd96f667201a408bd1d89e35f4ab 98e2f68c3366efc14b5afe1018d9c845d808d4f8e07ea8168518a171ab4d6e21 70eeac099eb7ef46eb9781384da1fac3b3133bb718bc80082eaea88759745188 f266b31d0c7e791d633f16ed94e05517a32163e74cbd96dc5db066f2a5313d6d 7f09465608cb404613e0f058073af000e5bdfafbbf9da0c0d5c02a3447f2cdc1 f56481901e34265c26d331ac3f85bdcbc7c51ef9eddf2b9c189c5253f8e74282 d6f053d7d183ae17ea175e5ebc401e67d21a9fea139cbbf3bb1358c713a75843 b39a69aa2b1a7b975f53ff22d1dc3bdf7acd17afa1da21568310c68241b31d3d 03bf404bd30baf9cc19c75b958bce7155f03cb0cfe2cae0327aad4b603284a51 7c26de75b8c6f6aaa9debe4aec08ca4b646d787800acdb445bb55d10cbc2237b ffab58a0399b8e1a4709eee6012432005487a6979cabfd75caeaa480f411a990 8b6d3a2e7e6937783279ac9a51ac69390985d83828feeec2ea288a657e0f79e6 8ac3451a6bb1c8989c512da066d6dc771548f2da3b78d01c03e2f8f20dbe256a ecfe73c9837cc77b3fdbd5afde4dbb4e9cb251ea190bc02294ffb07541eb8790 bb302b063b53bcb8e3cae3ff033850f5bf21072f407f1134ca902ce03b5e354b 240f69028fab9e9bf83fde7e2d6a33307d43dec03a88f1f48535256794d9ec60 166c338be2bd5ef8eecafb1b0da939ef59cb28101d2e34d591b334b17908b443 57e1b0ee4e53aa653283e8e2366214086211683bfafccc1dd8b55f6317351b88 91508e38c20b38fcbec5dbe2574e4603bcc4fb393bff27a226ea4b13313b0b29 7bd72928e62fbb99c5bdd8dec29b30ed5fdb242d173c5b35e453aef26526f75d c743673ef0f9f2e922de70cb6a52038d320f9bd5d7441ee37428384b62db750d 70f5d88f3e3fad43d10fe3f506bf46b774190b268728fd71a923a8bdfd004238 cfc1e1bfe73d63d9d6e24fed1ce31283a70588d637881103496b61371cea43d4 2580358f68ac9da161368d56a4918539eab5b2436af961a93c47ef3cf47c9a66 b363d41b064eeb68996d63b0fb7acdec6efecc8eacd9921cb07ed9537fdc256e a2cbabc6b05f4912d80b17a591e78d5ecf1063488aa6ac6dd94a956d5c0087e2 88f2edb68513958263f0533ffd27cc8b36105a0da7c56420649ba14b6018c8ef 0c0159f410d31be57057029e164aca475c6cb9821b8fba817e5417eda9f26362 bd80ce6d8594afdd56b89fda7054f12adc3b685a0da97b08074f5be206c66199 e7b21fb08156b4484942ec8cb437c73b3efa396353bdce19e0d651d162f89bc1 79e233338a59afec821369dd9a0f6ad11a61f9e2af29e7d8c498aff434d64274 904a82c55f6b008f222c22fd7911334660faad7de43ded86d1b1f93c82ff96bc 3b22ec1caa3235c4c67bdd9dcd9aed31c5e4660baa49f847bb3b08919bc7c85e 328888f676e5f99e1e66d66272838d2ab453e93151401098c514cb0a911b8d03 4a7a1bd01e1b7b8406a8a925ac817f7eeaa8fe6fea0007f5378a2fc9b4496ca2 ff36ff4ef8e4d9bf470005547b4233461848a80404a6a1671ca9df8a5023ea2c ee16669e72be5e2218691ee62e5defb42a664a987522465e8d3f20bbda4838f6 a456b5a04010eccecf1f98cdf87533683af8e0ac1cfbfab94a46eeadea8d957d 40b1b4c198b3bb3965b1757417f81ae9c23371a1e06ff458294bcc3c3b3ae2c2 43b857d584dd4c0f36615d7d1e5dde10dcf0ab5ab603da16fda543e414d0d8e6 b97e67da148753294bf1ef2c0ff426d40d5941f1d655667c0d0b079e1f6fc377 8f407a80e7621a329aea6884e89471b6d8653d9c0a8786893b0fcaa02f2d2bf2 564dc3e2c2387b7b8000742f95e870809f893833163740fb15095186b96d6cc8 ca0911121b0b72078e1062602223a463e225b729fe237c0e5cd728977c13f6d8 37340f93e6e9cd4f56253f31d8171e1c788606450b9da7b8fff3ff3eeff87836 7deabf3ed61bce369d08cad768dc40cf6356837b759d647eef52d88efc7fa53d a97d1be3f83a60dafcd5387fa97ed3e553eaee60cdf75edc414ee6398effc63d aa36ba834e8f90ecc18be66b1433032cae4b3b64b7cebf393adb9eacb041ac91 24c2ac02e5436d0489b18ce2eb8be646e5651e4f19f30c997c0c06f1fbfd0ea3 117da456b60806c8fea3c6478a095497758d8f8686dbb618d54e9d509ffc8206 33dc2e1f6e286fd7e7abae6037021deb231339395c4c3232594bfa8b61a857e5 1b45f4ef9edbeef6def1fb3183217a78ccceb28f7d2949212c783fcfd146077b 20834f865f421c6e4bd9141782bc13aee8b6d1e1cbf0a86bbad07c0b5eca3538 d0a990b6da46cf597ddea367dea603e419e5bc16d50a75cc40c91c8b2c3b271e fddbf35a01957485cbd55f75097867eee87c8f486d8aa299dfefc758a787660d 292d8fe530641dc581a5c258995d7da7f5d78125e21e0950c8f9598f5b184393 a8a6d7d1f5e02359974e3972d31aaf5ac70b975225af2d0d0d270463cf409181 c9f16ea1a6f96fa0c81a72f03a4b51e2435dd034a43653622d45c9400b2ccf20 9d50aae2731802cfc2a3840c78c353f9fb2afcd9c246aaa5f6565be3d64a4762 e26cd3cee073ce58c66af51f4f7e2b24065c02886f4e027836e022f32d23b42e a614c9e9067bb8f5a425ced3fa6a18c43c5f709a9867fe994c00e28a5ac39030 d1195fe3618ae6f488dca530c92890abec53ade69b324250c569af59b7b2b228 f3ac325b6ae2b17470a19a817a29a6550db2716ec739aaa884df099bbcd02428 5f202374bbe444ab7a5945bfd987bce1a4cb750f2c0a6ad495d4e069a2146d75 242aee097745f73fbd6c6bd08d6e2535c0a7338b586da204501d67f73b34639f 2b0727eaf182b550379096f7d2143e658d2c70ecfe73edae40a17f49218edba9 e9e07efa077f25873f70ea1da518488075301bceb3e697f6d5c01808d9c22b83 fd36d857e26ca60d63fd67db107fb7b300ed7fe16c8b9b3646d795d22e61fa90 7efdbb54ebe837a8c6cbc6f99c24a7167449b5a4f09d5da12c3080c45fed31c9 49f9f0624d960f6780c1bad21a19c97b105d61fcb0a00cdba0d5e2d040110b63 fd5dca5f871ece63adc5ee7f0a6189bf00d07d36eaccddf61d963d004dcc3f4d c0de6e63d8cfdd67600fc02af2b8a1a81be6e1940301474a5f969c26485727e3 1d91523267a3e5b08fca7f26303e8ad8db85ee2501f3cecfbe1aa2568dfbce94 d03b9a669aedc694ec8f1c30df5f0ce2745b0aa96c777ef9afe77a2659814563 8721721241e418408ee09cd85c02ac52c4bba218bece0caa493d7f10963b4c66 b06567affa4e9928bb37ae6ac69a87329b2996400383881e32546389db0c3a49 06a8f1807d9dcc73306a496b02a478e4b54ca60764efdf763e3af22928c098d6 e4bee0a7a3b7cddb4323a4006a2531f492715f30803062cc9cd7a754a20a39a8 89111f9164626c330f9272578b2621006c23f720fff8a88d555bc59e02bbbd80 c1550dcc70c9b0723693cdc5ffe77259205bd3bbd0b2ea66584d4ede599927c7 47d766062a08501d58f89cf458236524eb8d5110933f761a0860c5a797b36a31 5a98f0d638a0839cbe78f47aaac5ee0a2cf9deb599d2532c852e1e51f7cbdccd 36c671703d95c5e63c82c6d330ff81782c77ed13b50b7f46f15f8ec9e4dc3f19 c833925a1d5a770fad25c5e3c6d5a329730265994ed5316e0b799927078a5396 f5a3179d4aea0634fa7089e97600df2cdbbdb9df05838e5a18eca7064bcb796b 67a782e59c17d63e6a3cff01b9260216e44dbcbb099da25723702f44ab6ce7c5 df55cb966cd86e9993a98ba6b18b56200e0abde9643fff73083b0237bcb5afaa 65b6ee586df6234d62e353285050a35906f98cd84f21e755cf47736fa62f3564 241ddbe5b98eedad46b43e221c61ddac99580ec606d26724453df966a70e4e1f 3ad0010294e8155fe8ff9f84eec82f57c388b0a4e682fcea551b35d4c4fdb810 09f739cecbddfd6220b6d20626c84b5bf27eed87f5e6838865dea272cfe89139 f4d4b75cd52be8156014d9da47e3ec156d8b126c98e23786d08ba5fe62a0a88a 3997fc88dcc3a7928ff50444c189cf76ddd929ede3a0ef648e0b92c4cac95d6b 6e1c7b3994858e32504de520efa2f9192e784ca630774ddfb0c6aa57c3cd0cfc 7c3782af36b93e1304680eddd41353e99099daf9dbc913f0038fa4f9c5bfa621 722c85b41ce071d9f78dc319c56c0e8465bfdcd4e4a5310dd257670b4fcc8368 1d839f8559110d401680b904b08fc589ffea45d91f9a48d299b3c5fdcfba9356 8ec5971f4c1fe7a4afada6c2192a9dc3100e849925e26b81a1df5520048bf404 eae9695a0657512a53c1ee0f6cd3eb12d0260595a99d63494bdc0ff7e581e04b bdf43212665081131835593d0d551b370847d08ae00c94e1d9897c2c10d37452 d6974644578aa680408038f344126ed66a33ad1c70977054a4bddb8e3367f85d 169148f40ff24efe1efaab54790c4e16a012f29b6acbcfc6379f99ee27ad0765 9300777043b613feee73885be24023c27d70c025b3c2e5f50bcba17416baea6d 8840d2305fd6b72eb3cc9b52a1a41872dc0a35c15a9160d47af94e6052ce7537 ac6b6d31f9dc995752f049e42f0401007efea363c6373fd449edaa64f5198256 7fc12e859179d3ce95597f806432367b579d87166859a06ee24256e3e35f720d 89cb397f3f7e6066c353217849c29ce445c08e871815ebd23d9eba0e8da79d51 40a836b6574913b3ed1c0b22ed03e0d6dbaa5e4e9f96c23fc55bbcf8d1849c94 bfb1c9da8981bdb823a688d58349cc0828ae71154efcac18bdd381b8f4df675e f0854b9ae3b77cc1f70a96a7f8f57aea1a6595f760d860990133bd72c05d8ce5 7b1a2e267507825166fd4cf8a20ec4fea17480c11c07b6f786038d3445f4f84c 3ef97c10081152f22bce131be8f224cce93aeb7d24b357c04142bc45e7662b87 26b7510340f51f1c99d6c5469306fec4380ee1d9043e357367f7c6af9cbcc38a bc3d93a7fbe5e0d147f0915d462819756e6a5e1fe23de7b9e43e5a06c6032fca e44b3f613b5ec04938afc0497e6bd66748590001f4a80215f9a16b78326ede88 b257b8c83068cfded4662284a630fd263d09912f9f0432250f6b18fae72b6dea 1018abd04cacc9dcb8befdc12213fa82116dc3632708818b5d3969d5f61c4e21 c2dfa36b359dc4434e8a6fb16695e61a874a1f48810f61fc3807ae6e86cde9fe 73538f37f49dc6b0ec0df00496fd308db421d87b79d40eba431b66eadbf75f34 49335f444f5111daefb2786d3ea1e4c4ac9a244017450fc1bf0c7d70125c107f b2efe1ad8e9e727936f8df7fd19991f9f1b29732529f16f8104fca6c8f52e214 15be7cc688884de88f984cc701a11348684129979e7f78bb4f27c5bf1ad1c662 b98933d532536dea0cf5d2d289f4db68145e43ed401bb9149a377d01ce8cabc3 b51633fa037bdc0d229f6f5bfd82cdaeedb1a1303eefc7a31e292395cbf05a96 7170f56878d3aad3017e50957ff41c8b2770fca9bdd73f2fdc62dbe99c811254 bda655601b072f38b67395d0e4a769f568b48f05216e9532241b83f075513476 34666b23a67a71759fcde80da08feeb25c07ce8e6212506c3484adf78505974e 375b9dc37957c1d2d8e3251c81968a24de53108101e6949b766631a44b0df201 5e21d1ebfa1f3922142f936a027b57f3e019c9d300aa69994a0e2a680b3f0728 768540c536f77eef76147d1641bd2a05d393f291db85663bcb560f7a9a236f75 468e0055b4f5169d436c750a27bc5d9ed104420152c813c3a179dc08b0881318 b5ddd1643716bd0f43a86ba5f61f881c3dd339d52cec880a2a6158bfbb16b50a 5c55b68b7136f1311b002ebbaede1ccbfb23426bc54e4b0db9da54241f992974 bbe184effbddd65dcb0ee4b9bd7a764f47342a1bf80cd01f3ff46179679f39a1 35b39b044e9c7b0e44d876e5176a6c068e94e07769cffcfeffffaaae7a96a490 4d3faaae804c9762d0595ce6dcf82712c855361d540a4eabb7dc24bf88829d2c 71d784a7a4905fcbb8fc495fcdf7469f8d73aaf8771fe72bffc20232fd677eae 2c6e19f3d213bfc44acfbc62e24faf437b753e3b9a3989cfde5313794da59c0a 2151766022daf6f473c173d289046da8ffa4aa2f95e41c10cf969fdfae2b403c 4b2617d75e7b9e3193ff9af9205913138f5401ef4bf05cebb6ee979e4712e2ad 23727453353e08cb8420eae5ea88265120430e690728b0c2a1283187fbf604fe 6b21a20dca56d08426d872061b165ead6bc24a7ed446c6282e04836a8ca17e3a 1b22dd6b88ac44af65db843717c94f43f47ec8f3abfbda2bd95307f466715b91 3214ced5577e4e0a81996cf889b935ab7e42b8a612943dc4d016f02565823e16 98656dfa1a4d8f0d09c5b04f5e8f38a4e0c58eb92a4e426d6a036e5eb69aa0f0 e4746411afd1a16eeb6ab795df8718837d2cc522c08f0611ff75268f9115a258 c9184b0d9ac6c4b8c30dadb35d9a3fb025d23d0e28c77035f20b406a0f6c8978 f61acd757d3a3e027079ce907a3dcf4c8d94b143c4ef60f5e94e31dc51456bc2 84bbeecf3d387c8638afa9855fcc299831a0263d6547233746e32d357e8205f1 ffb5a29a987cdb74fe874974386148c5b8fc08359bd56781fe8b466f01a3edf8 eb9be3c5f3869e1e3626c1bcce8466173ff314b6e6c058b2a02012befc985cbe 78a939e6dd2c9d6216d8dba7f59553b559d669e4d003ad3f3c9eb03c2f3a9498 5ee66d92d76e8f18fa711b69e138ceb08d4dec9d89f1f82cd10a559eeb40f270 97d4f384a63868d2a1f4c67f54981d5dadc6e425199a2967751c1969cadfaa5b 67c72efca3a01b07d63dc7e657ed580b7da770e23659daf39ba406b5e1abd80b 4233288ff300882421f88f9b5dbaac54862e2801d403290af9eb1d65fa69a92a f4a35a65df5500da7b10c79fcbe1784b540e8c8479f2079d066f2db56ed93147 99e54545d2523975d85f3c1e0032b33ff5fee9ec8aaf97033110dc15cd06d497 b2bd28fcffd1e02931832c3d8689daa6daf654a2506e9a1feaed1043d422346b dbd02932162e248977832e7154aabc03a7473f1a4084e8d38a8b26ca60768b50 a9372e8d37ad77b80cf65efd43b798e896216feb15e6fe0bd1f074742002bea1 00eb71b3bc358c3f7805329f7012e5cf99532df699a788bb92d5039daef73794 4ea3258527b164a81f31f30706b4dd0cdffb5a90875e65849831082235e59ecd d06a8095091b0a35b676cd4e12019b072b90a6fbcae73f8461a2924dfceed4e2 6625573c3f28e43a1aa132c757a887f4665391b238b91837b145de1e54458e7d b188b11f8b650a91d7f4103ec9050fc3db2a86478f3706f9c0610f7202412144 9c2c447a9050a11cb30be39157c62071bd2f0b53c6f9cd5e5930ab1a6d50b988 c75cf34d24f35137309bdbc860f6b9cece5dd28e40c52906b493c97a2cd5e292 daabf4de4b84ad63c251a0baacee27aaa6668bb6bf69142fe4b2a118d7c14eab be1af5d0b95cc7e7b86ba3fdc0c5adc24ce4579c3bc5bb565a89dc1e00d75f92 e8eb0db6e640008dfaa4732a16365ae5730a2df8ba8ea488beb29a652f9b705f c8ea79afac771f3c9ee8ce71d4b29f700757c71f5846565b28c9e7782155c560 ec8deae67b1da29af48c71ff8379ed962c49f53e398c49c413c2f3cd9ae6ab8f 18d867828c46cca61635588e809ec4536c52ed6cbddc540032a0398da0216323 28fb5cf035dc1f2f7aee46cbcfb3299ce952694ed781a5cfe387af63771f7f79 1f8e8ed22cad58b92b5e0671b0b129a3dcc427a5d86de25e63600ac1ba9d81d4 5634e020c6937ff5621988f3ae0e85b7545ea64df3e85b89916773735805f912 85a205ef143fffb0fd86356ec0dcd26cae841d247c5a2e4f32a96df973e1e796 9167df1c10ce2d6a181c15d5b3ee675b6332ed0bdf616b997e8565bc0a55cdb0 ba537f236758f646f6c0a1c179243f9cb59db4bd64c5daf2af996f3b44259221 6c5129041594c1cb020c9be81fb71af399ca944643af3d2176c835b46cab1121 8d2fb4011dde401ce18329fec2 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMBX10 %!PS-AdobeFont-1.1: CMBX10 1.00B %%CreationDate: 1992 Feb 19 19:54:06 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.00B) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMBX10) readonly def /FamilyName (Computer Modern) readonly def /Weight (Bold) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /CMBX10 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 161 /Gamma put dup 174 /ff put dup 175 /fi put dup 176 /fl put dup 177 /ffi put dup 178 /ffl put dup 179 /dotlessi put dup 183 /caron put dup 188 /germandbls put dup 40 /parenleft put dup 41 /parenright put dup 44 /comma put dup 45 /hyphen put dup 46 /period put dup 48 /zero put dup 49 /one put dup 50 /two put dup 51 /three put dup 52 /four put dup 53 /five put dup 54 /six put dup 55 /seven put dup 56 /eight put dup 57 /nine put dup 58 /colon put dup 63 /question put dup 65 /A put dup 66 /B put dup 67 /C put dup 68 /D put dup 69 /E put dup 70 /F put dup 71 /G put dup 72 /H put dup 73 /I put dup 75 /K put dup 76 /L put dup 77 /M put dup 78 /N put dup 79 /O put dup 80 /P put dup 81 /Q put dup 82 /R put dup 83 /S put dup 84 /T put dup 85 /U put dup 86 /V put dup 87 /W put dup 89 /Y put dup 97 /a put dup 98 /b put dup 99 /c put dup 100 /d put dup 101 /e put dup 102 /f put dup 103 /g put dup 104 /h put dup 105 /i put dup 106 /j put dup 107 /k put dup 108 /l put dup 109 /m put dup 110 /n put dup 111 /o put dup 112 /p put dup 113 /q put dup 114 /r put dup 115 /s put dup 116 /t put dup 117 /u put dup 118 /v put dup 119 /w put dup 120 /x put dup 121 /y put dup 122 /z put dup 123 /endash put dup 196 /dieresis put readonly def /FontBBox{-301 -250 1164 946}readonly def /UniqueXX 5000768 def currentdict end currentfile eexec 8053514d28ec28da1630165fab262882d3fca78881823c5537fe6c3dda8ee5b8 97e17cb027f5c73fdbb56b0a7c25fc3512b55fe8f3acfbffcc7f4a382d8299cc 8fd37d3cea49dabdca92847af0560b404ef71134b0f3d99934fc9d0b4e602011 b9cfb856c23f958f3c5a2fbe0ef8587d1f5774879c324e51fcb22888b74f2415 50d7401eb990d4f3a7af635198422283cac1b6cd446ddbcbd915db9bff88844e 784c6bf7389803d9450b0c21756a017306462c563d51ece66fcc9c831843ecae 1fefc1a232e2724f7baee428ae03aadb95c3035345c15e9922fe49e1f2cfc980 237316572dbc57064edac9b0db8913a5e2d45e97e19a91435ccf8adfc835b585 48e74b291446d689c7f2f8c4325e8356e974ae30c3e2977477baeaa33d141fb7 80f59351e84bfc88c87b3a4a1d25e168b9d134554f6a581378c7d2d6eca8ac09 045cc3a5e0ed86f147133f094029e3483bebc81cfde69942cf645ea20d0a2b64 5140ccc2f9cb4a3d969f4b0a79cd3329b440dfcff5285494406f3dd08d804c86 df191e57232f6f1f83df6430f214e03fa5412b1e13d83c60c52a698bc9a38159 19a64162af7b83a9468fae9507c6cb55ea80df8c696dfbc3296c663902d77e89 a181502627281181ac8624f65be9de5fb32f056cc7dd7cbc7366a91717b5892a 34ef6b441871c6993da3a81afc9bf70ff3842a21a29c0e49da1ccba37dd6b920 2702db510b8b1109acf4c27ee8d676bdbd16abe189f34a9b61532eb777457698 cee0561838eaab2d3939c5093afbb215bac433d1918c739b62566906bb2187f3 378521fb52e70c18886e1aa15f53a1f8a169528cf2ddd54c203613ff88e619f2 6c9c50c2c3b8b8c868a88afab1dc8472e7b6f3f992a161723a3c0904865a7c42 3281601eee91f35222c4a71f343739f102eb43145a47e4fac3bd666e4c114a90 5950618ecb1bdc29f90f6ebed1d8325fe6b52e14a8870e9b4bb088e585c71b91 493c12845a101937e3473ac5e9ae24f7c358f06d590d7618e1a1d5834d87621f e3f5432b655eebd4ca61a7b00dde0aa740796ce88a43d1c6952f8d2ca63d30b6 dcbadbb0dadf13150a442714675dbe51ff838f2e47ebe8cd44f1eac6ae5b6ceb 0b07af03f5d3896ff935a198aa635e337e367e1e128d15e31afe3ffca8245e41 a3e17011340e49d52fa1e322b435b4f7f2f49ae01f6a319f68d3d786c24be810 1e1c975a8feb5dd7e4922e00e3a08cacae5a945e1e8f8a20f1fe9534153307aa 5ac7424759743e08af90b9bcca7447375222a66e2edd1bfd423b1bc50ba0e544 68ef45c89036a20c01e4a5f27f9fe3e02cab3033c6d87574bab265c69d05af1d 48b6ada1cd04622b62b82d646cfeeea510fffe46b3992356b9a78216dceda375 1e3f6670d9ae871731741105c99a03b430ef00e0ba2687c8c18b520ad8466ef2 e5d4c5d11165e1582855bb54fa9fec61cb41dd05a5e4e26e4dabc7ecc147b933 2811e4cd7fe4f2f9281a740c606140afb28a9748965eac6028273fcdbaf40635 732a68509e0da5b482ea3df988e4df9874ad69ac20bcad8782a215484e6e98e5 fb69df4d50fbc249bb3a785a9b851a861ee3a660279594b07c85fb16fbede6ef a58ccfa7988f74c15a0ff2df7b21c73a29a1d650a588129826843432db2a459f d27b1aca6de903be72229b9acf4c51dd5e6e8992c9834a8df850c0fb6dc58261 beff16da6f2b7eaa38ceb4db83b6f2c8294e84bb9cecc8f47839fd66362f605a d4f388d99347bf6c5febf6250c0cfac73ca22beedb843b9e70a1574e032f41b5 ba06e192a9e3d3d34ccc4b266dd865336745295d76b1d846182adbadcea9ac64 2d66bf439bf259720d801d2f853285e75acebccd2d30c748204821d5931c0f8f a7fec8f4be3ead4ef06911064a7263b1d97f957ea930e6b542deeba619dbddb4 84f649b91f77ac3a5e04e82063dbc0864d90f0c64d57ee000b5e1a4a8efdd8be 5c678f54658902071136709c64b6083a7828d7cb33e3989ccb29a5ceb05ecff7 696120b142a411dcd588028a56af4496d0c8b621dcde899eb2d2b67a0f5c0586 04d7bc72d8dbfe8d44ef6ca2609d5f5ed9ef66b91e005dcfdc0dbfb7104e3abc 4e02a68b43b1236c337cbeb3b0d1968e577d8102834dd572d35536e4bf7899d3 a7402ef6a7b0c044b16eb26a2b902b02429bb13c6143a80ee8b38baf69bd0469 591297fba96b2600f5b35c99d4ff7fbcfd89733518c044731b02f27b415a9327 f86cb54833a2c171fc0b5e022ac138057e4b6c6fba8dffe4b2f5193cb4967cff 2e38befb0dd732c63ddecba643a93e3392c37ec994279af06b3f23892bbfb8e7 01c7c0e4b8db7f09838f839eadd26ad23639c66640ad571cfac2a96665a4060a c8fa4f9f16ea231aabfe85b29f6788940c2e90864e438786ef38f5d16f9a5b01 c5a050b5dfcf4975074439cc24948c61344d833266c0f8d3fd8b73ce70815ed6 84779f20ca3a80a365f6891aa2c7245d2b77bcfb5e411aeb074a9d36c803faf5 e3299c87a4e5ef035175478b68e8be4168922c7efc48fbc4842f2441e5aa7f05 955c4884e17a1ad99adc69364b2f2784d24edf6ae042830c6ee7039923665164 5d4b3644b08615403a961ec104f0e17796eca34b98130ede0811300cb5ab593e 362353c0ffb6d50b08ee965c55d66e3b54795dc06a7703545c908df51d7e4b11 68f9dde45c5b76b3dc277c3989fb2ff2f0902647f93be26b3f7732f982ac1224 1d47615b2fd805839c44bfedbbeea87ab08422ba00c56256fdd282dfa48c0124 fbfb586f5518d05c664ddd2d597a5fd626e103e458cf6406ae4a6a8692f0ec57 677da88dda951316e09d0e8d55816084a637aeb3563a0d2f5dfe36e3e00523ad 49d43e8546386b13e7b5021f7e1b43a74042f2c1d77add2868c6dd4470b37a09 101bb80a110a49bb4e2b4a7cb5ac59d262d6eebbcb01b62d021b4e858fb3d4fd 9fca4c4925ec9916bb64ee77e23e3bf009af8cc2c689b68effd9b2a5f0f3832c 2383c483692a21c940e3fb39b59bc321a70953186dee4554dc17ddde03b12e7a ee07127c28228e0e2a5e4fa23f67919317209e60bdf68103cd31212a845037e2 1238f6c6659bbf298b44b8ba3e44c0d87bdf61925bf1f1611509c075ac41b227 5ca8b192b873ff3e497ffe41f54309b17839cb4bd58eb1c06b9cce1c0e05ef96 6c673786185c9916e94d9a4a7d8a700be3408157e7e41cb76089cf4f0a4feff8 68600fdd996e11d3a1b1d84de4c284b9f684420b9211df6145855639aa17e905 9dde972821294c52cbbefc274f26e5db39b68efab1ea776cedf518ae6c80fc79 d5e8dd8dc94e96ad2410ab792707e5cf834694f321d64f2100dd4db903bfe008 472911d2470e5906f44a107cfbf62a4a355353c81e3ee5775dc116a5818c34a9 a805a3d2086e4585b2e6146ddb4a27173051f42c1b3747b4b6e4cebb33147647 83f7290c441758255f09c1974a3550f8dc5b207f522b0dd629d886269dbb91d0 84c3a7d561ab9d2190796b22c31df3561cbf8df67718a630ee4ce83123a366b2 430fb03d21cd895e418587ff2d83a916c9e4bd2e4a163db12c74d61101b3f911 3af9efe77ec4e3dc17ea2c24d4ad27f4d74b7d3c1978c0e8d024db16f4f353be f68b1fad9b173b66b9a12f58da4ceee54fc4ca6e513ee9e1efa78be370059c64 26021271a624b4ae489d131ea089399986ef074a72938ef05d369cf5d07fae2e 37208023486985ce409bbfec60b4e23cc761b00c0a76bef1945735fffba1bdc5 fc816f5661c5eb269f28f059d21e5a41e6db036aa679630208c99719acd47124 ee01a7d95c5d2fa14f51595594765562a6067bad4597596b37d8a9e0d5e10ae8 c55309cdd167bf31e06be3e5597c44198209c8d33736e42ce9ea7469ea00d155 07e836eed7e0d3d962220f446d223a1384c89735154ac026200420b338bca071 b641a8948c75d10e9e6bd4aa37b72d391c0bd56894ce802ed5d186a3152a6b52 eaf0f4b52e60422ad6bee9918d612ba39ea3d0d5c15ec54419acf1f9f75a44ae dc3c2de401326a56a465f1778aed91e045ce2f1a2475e2a539014e3b2aeb67d7 9bf4df9c63657d16b8892e87f32c93163240a7a0284b3db90a6b4cde6c8554ed 6f9b184240dccf5f3a55b56b7f4c4ab29a742297ed5c28373c715738ea620534 f0d494bd429384a14ab03e683bba7392002fbc4817b0fdcda64098322f7a5084 0b2ac7b8c1ea55be69567222cb16aeac53b6f9f23146161fb77cc9946c3a6539 af4725bcef180587ec435c5b8644e3d742bef14d8ec986c9241228cf2cd7ec23 bd81ee9379dceed95b03068c572849631c330126f86fd305d421793029af5f97 0ad5c032c5a1c4a12fe4c9ebd8c2b47a47b0bcc8e71b1b7d78763f4586db27f0 59ffb7b0ac2f48e1f2b141831ae70775400e794c2d5d5e631c71fa551c28f417 61f151d94da4121ab103caabae6308f766850cfc9ffd395321aa347f5bb1f0e5 386325473a320e3ce3845be78540a0999bf16f92c9998b80e951fbdf5ea5e0bc 06ee67d00fddadb23511c121f9e8e11ac8183f324b3ad720da3ec631f743d73b 89db3f100bd905aa711eaa4c52e754371f9daf93b414de80917d0c9cda174d39 46a86cc9e3dce2e4648563d27f795f7ae4137dd20c48d45f922525f4e4105832 9458ae4b28d9749e36b9c144ece6d02d53efe661aeb03668d6500cd2ebbae2e3 7c83e70317d643469911082d726c1be0e39b4d51b5243b7125a49ad11f747325 36543efcf029a25305db55bd2189b4d85748e012a05fd47ed7dc4e0b74e79fe3 19f39d4dbba737f06208b671a30b71a6a61ddfb9c236c02c4c91b19f1fb94a73 45fc9dff9681397a0cd5a368866290b0743f31f335cad9622bf7b9da43563e35 a0235f521a319774a4a2b7bb5f7efa589430716ba44a8b2fee1b039da5826d0c d7444c4e44427e7d061e65713282c0fb1217ad24fde3fd77e55151d15fa4dc7a a77fb18bf3d2b9fef8f1d9f69f11386cca57c2d8565f721dffed77dc9a977dc9 a171bb7443515627d421cdcf44be5c063a5e40920fe60e1ce8fb045ba13bcbe2 4056954822024a014cd99e43d8e2b49ba9900229d2cfd178e8c5811530a2e3d5 b3e3c51966a5ff8c382799234b38e1867788b9660068ebc53b211ad9ba523ed8 8fc7e8c50ab3844625d9adf4bada392a1da166a8d9bbb196763b9156123d763c 2d8e6e370fedc3ede6d1915d0ddc4ace1b8076e1be0de649c7036e0c2fbe2da2 faf5c2b7c5e6824bbb7dd168a33fea646539bbc0d1ece7cd092060478823a757 3c0b0dcab28b4892d1f79fdd1325d77ae2b988517c4b5a0a33f0ca17492d4455 d3b1feaf865ac590daf266e09d2327a4e0e39cd9e28aed285ef3398717773043 9de79e16f36467f57f0312b4f7509a98d2e49e4df473d2f1a60e2db919809725 4186b49b1d2b129368c6a8d0307526c52313d31cc0b7fc86780768cdb2094c71 e2ccf172acf2fd70e0720933c9c608e674edb12aa5126ebbf5512cd0f896b3e2 a8ae73c9275716e668a91b1a8d13605586bc4c33bf5af9c852618ac9e775f78c f1a762f0af513c3e19948f3b217269eda2e21104a3612d9558b1c6a9e6b2aec9 364b61a7249bf3b8bd58668e913ee053e5f9dddb1bf06f595518f1738c59f6f8 6e9b14766c861203705c49a0fe6704c74d7502c8e2719d79e5eb9b24a34d7cbf dc09f59ba5ed0a741240b8347f42dda26c1337940b8bc32f46cfe262911f4995 caec328605ec38ea99c5c7648f5ca45dd20d9718866e6291c45b4835f209d5ff ae334c6421867e9d1c7b70d0c6969ca66f331168d555ef4dc56af6cc50cfda84 4598632b7cab2296c7faf7620fa4d1499327e3ec943338a21914f23de859e841 9863da93e00e1c41a8a2c2ff84ff9810f2b1a05d00b069925ba2e1579bfd9805 526771d8f68087e2db5b9737eb33d8bd45cd9f59a388115c4e24f1b61d357ad8 ad1c1f8e7102512d0bdb551fc3d93ecde824f92265b2a3a76a5eab4eb0daa99b 88d1d65220f2a9634d672d1369f510ef3c2b5f348e39e79cff77c3d493a255df 86b1b25cb697ccdc1d48c5ac7052954d064c2191f0212e7d3bef6b1ff29a81ed 845b825b923756fbac57d90433c07e191dc60f803d200ee3a32a49677491099d 3162c7eb719f49a5d9b14a1f99362ed54cccd31fb5e356d75e2114c3e0548b6b fa579b7b85126777462227d7dc61cd6307e7c0283d48769212be8609d2b75d30 02eb09ae9c7bf42b0474c5858488848c515d1cf8dcca6d76e45379cc0a507206 58005c12e1c087c0054027cfa5e88757565c326c331f097fbbeac99b961bca3c 67d06a8047c72f4fb9fc28289dc26d794bd3f8a96fe2d61433c89e152a0860f2 950a926fee361604d1eab41baeb9ceab3fe11a2e91a00c2bcc37962da01a520b 9d221e76cc0e29eefcef4bfd8ef698dee5cb6511b852a371c5b9889978374518 9bd8d3e7d448fa57b4906fed9d2c50d2e8abd02c3f4d0501f367865b7e9e293b d68a98b1f8667e9bda65d02e4959f9c287c870ead87db49ab7ce83416bfd940c b5ea32f71c990ec2381517ba87862b0ff7f01cc82a07757c7473792ffa9fa130 1df0be47d15069e7ac49b05c181e326779c8bcff299e6e4f48c2c6699d47bb7b fccafb2b10d1ad60363e8fb0b23f9727057f9ff11340bb3ae6ae68d83b460f58 50625e7872587c5833841dfb18ee16cebb3f5c4ca598aec4546a8f9b1d531ead 465bb1e274d3826e963ecd5808dd617f13a7b3ed4b0ea7e37810e8b668a25f8d 667c1ae79b3e9079cc109c5e5372b59e0e71630e0c91ec887c32e21436c3c28f bcb876f50c4724d62b325cad5e6ff0463336e67062b1a47cbb94f173bd552744 ed649ecf741e1f3508b60e7b0a6ef8edeea38db17fd3270515365b329c6b710a eba357f776c12af31443bb9fbabd64d76f6f4d43a26d71b95a1ec75ac6f24826 8fbe78e57a70b38ca60f20c004401dddbad210ade8e54f64ac11bd32ae6a8d21 c23b71ceb1b4fbd3108e45bcd4e28be989dcf2e068e1c4605166e7837ac2bb11 65bf02ebc210996fea2277af6bcd6f51caf27d9b67ecee2a335c93754c7fd02d 2a113e399ff475db0a8f5abd47a70d87249e1c92206c3fd24a2e6bac67da22e1 a191707a7425686afd5bf677704d9d52d319395acc96e212faf24b610c6d1c84 176fb9329991da4b33a746a6d4c44c80d2b53476ad38757632a98aa1b0f4253c ff8f068e7d09458dd9afd1b71c3e4386a3ac1e69bf519c2f352725fdd3473d4d 82896970d1e8d826b2e5971bb26713e55434de1e2d1ed968eccdc96cb293ed7c 812b417073ac4e908532e105e88bc182c71f11f95d791f40740021d46d0ae5b0 8e4b69c1cca3c52db8932f39756f29e35e37328dca7c9b709e37b3ff1df81154 fff174030be7cc02644d7bae3c65e8268007313586d986c64e893847de478c96 1599d7a3316e952102fe95a7bd0003ff6773b80b1fe69aa7b8f3ba95566dfd38 40b0e291887e4e241c727eab4cd73aaa626ca23c116f6f3223768c49a341f3e2 84e4385764f20f6c40166e3787f31518c32502054ed5e9a00103dd9df0c4d27e a430a2805a64040d45e44dd45f876b8e07ce451490e0e18cb2887839e2e4e4e9 e1a12d6a3bb3875c4d994d0bf700edbc4c9d6ef36369241ad691e4042ced596a 4c3dab5bdc7ce2c17399aa653ca59906b6073cf37340165b5031cb9f6526a9c6 d5f15b3f7a922865c68b586687b00a06c4b86048c5e462e1c6d70a22e136d108 b47b84113d3c2f21ba9da1d2b4a3f3e91fafb1169cd29e8ae450b9c697bf2e45 a066ade4b1d48360fbd944f215b72c20d4b01edb3f7457c962477acabd38ee20 972468b123fccab403580bb9efd6769345bf56398a3a7e9007e0df28c689b1ce b34424ecc0e1f931ac20066f7e2931a87a2319e35d72ee0a338e38496889dec2 0eff786e99ff75b50ff347a0d7f25295308f8c7e0b0f4b638a7ac5ff6ede3a54 cc0f42d9b3901c7b446d50ac3b5727978065ff936e6577fa49768b95517daf7b db4b0e71f18861893288eddabdad50d34d1d25b29b6e168b38c493be3dee2c1e b1de0656e3bbd5fc90f3e3a26be7c18bbf880b9bdce0aabc7bf1c79f0320901f eeac7445e06fbf997a2f0285d907365acc268d125ee709e58cd48ba455a99226 633f80b95ae1bdc3e4c1fa7a46df28dd81d4acafd5d569f5682b9357529dd418 12fcf55ba4ebd282779037cb9cf80a05ab032a5fbcbbcfa0a8c69ed1abc5985f d001d4a0904cddd11d70aa448481dae438e7eb45b0b7d5ee3ec78865f4393ef8 758acc33805f7b2741838b5a1936e044683efef70c67b80a7fc74a4b234f4824 030e0b0e0fc501b419b067d4ef6126946358118ca45638c92c25e057bd75bbc0 c29fb0939e1db776e4dc84147ac43ce992d11d399974ce655b079882fdb34692 4ea624a335a6a8f5bb8974bda6943dba621bf064e5c41e36cb3fa23cbe1f7383 901dd26715188bc6b6d378c0a5a453f6da284c6553c1e357cf97e95c7ca2e1ae 389865e3843a17ee0cba3f2ad55ed7a98c1a84c334b8db46aa5fc389e9eb4957 dd8a90230c1ade930afcf899f1c9f703222f4cf186f8e5483f34019d594ec203 f48d5d3edfe0ff95cc662391f308e950c49a1fbe8d2ca67c6da3c9c15b1e84f5 1669b880f1419dbc960ffea99337f3df1d910cd2dbdbd153c9359774edd59e78 44eba9fa3a527036905551d6f7aa1bb6510d9f20b4b9a5d4bbf19fe30fb087bc b5c3da2e52705d860201cc005ae7ffe01287cd1e171b5289af8c501caa7d0a2f dcca03587d421eb805b27ad02f0cfb8b761ed3ae84eb4b5b0fc4aaa9b6a146dc 2ec9f64dd0317f20a890fb3d5a16bc011f2f62fdd0b32fdb4d7bb54d62eab6e6 d1b5429d83dec527db23d1cd8aaf9687f0d54daac04c4bb84968d7f5ce11e832 c0493ca859c517c84d3c10f03369704af2773e96a5267004e5d83ef68c4ade79 f42c1bab596842fa1ea06b076ea17ea5b857ffccd8ea90d229ece2ff9ad3d933 2fab6343450b3fa7436f70ae0ccb2ee7ffa248f896aa2a1c12e13480e2133643 afb32037293d12f47e4508da9f91aee20a47eba286773347127e1d2fa589e800 a2ecfe8e54c37d569dbd8efd0d54afb77af24ee3aadbd93e4c517585d5804f69 7dce4b295c592b52de329b0a9b8ee210fa41a39a61818a5492cd40a1e2b56716 470f51c678f98c77327ca7d09c3a2ad6294020214686e6974ab234a71f182d81 6c7d2f93bdd0feeeba3d4b2f479f9a9af93564808d725412e1ed1daec7f659f8 1acf5e793350aaec4054bb5986f45c8d996709deb3504939f71257d6e340e51e 8b6c4f52a25d912b9bd303381c4cc616f90b7a5fc775474b1c6e0dbf6473bae3 6a458f44d9c1760569b857d0e1cfb13f0d0cf830568dc55f237ba7a6e8539e9a 39d91e0cbf6d80397e00259fe8ad7499ad2a339b7d9c095aec57001dabf68704 cd58e3167a204cd5f26ed1253d2ff65db0aed1b280b4bc7b36838bafe9b6d3d9 cbb5d3fc4b6be43dab1bc1c5de794ca7bc98f3fadb08fe4ca1a8541e6ad4dfed 19a293764e22ce2c10b6f4ed6d7064a4213a7025d38171e416c7f702151b2222 ad612b0f2fc1846c2d90e9cbdf9bd100a304b283da8489eae5195816cecfbbbd 664f6a365b9fdafab827f075c6caa3e0a31f6d1ba96711f7ecf1e125b10f54b9 cf6199a6842bd9874cc0a7f981988279c2eed8b85401a277fa3f2060983bbe16 b0ee4cf3c269efb2096abcb053339322f31062b4385cb7fa271cc9746e1e7d0e 8e7b1be997a8f0169554a565aa00b157fbb12c9077c54d4246615ecbfa34b88b 814d140a162bb11626a27b9d7079b8f0ad2adf9a08c180c3f3ed41b2f269fa7e caab29118b98276a44493ad4a4073779c5c83ada1b3f1f6cab3b97bebc76f156 aba814cca1263e97ace2f855fd07096ac9ef7d1f7692e2d8e1d78aa2d9247200 b118328de184c41a1ca44651c301b576992ebc5f41dd65b03c40bc23a4933025 5fc43de20c589cedec103101d83a921f392893b573df550198075e3b5b95929d bdf825972adde06ed0ec4391275009e1ae428888791a6f641c655805324b701d 1cba5fd7bae965458bcaf12bb23d78850b4a2c255cae3a18bbfbdc22e1637038 71621f9e1a4885ad61e17f744d83211127afcfb77e6d38891c76be4f90e9c054 875be515cfcbb1587a51ea75e437aee5c7f71debaf305dc771c1d27eaee59ee5 da072de37c06d02af578f7baaaf5f6f82fb86a8e663cf2f78b857503873827d4 49770a1e349f8dd9cacdc7f2f7b9fdba7298bdb6dd7a5cfd2867a7a99967b07e 8f34005ab47e41fced752bddcc260272a1162f2121c0213581769f7377deb657 54644da590f7805eb47e27a9700174d6fc6688e330872f74d97dfa3b8c7d8578 01e5f9d016dfb397385456b87d52bd6520a9cdf604adff907aa2f02d50b9aa70 5ca9087c5a81cb871a0c8d61634c0c9190e0ecfb617f6cfe068f039f55edf87d 1ea36b8aaa9928169715429133e2740685f28dc2f09e6cba147ee6bcee40e47d 3869d0f83f772c02840406c45682e37885d20891ad7454dffd9b97925e138d6b 1543cb519043df1f7d39a01e5aba5947636afc70a250bb9e0adc2b4c665a69ec b322e9ed8f2e305ec402d83e4310b2ff1a3908de9698bed9fbdb6debb4b48345 d35b287fd8238780d9905b7b1518c1093ac55fe3f0154bc6facc4f834ec982bd 77c9d898a132afd7f4ee5402dbf73cd44d4e6867a1e915325b544d7f6b60b4fd b70a09d473058dfa64339a09606e00eb030e15c8cf3171d8cb3d4bf8c326e680 4d9de38e2534fe3c062529597859b04a434b412626bf04bdeac7690ebfc19e5d c247e52ccb66775ee41d413d1339dff09846599c1ed9856a455c772b0c31f399 e6e96302cb8716fc95d6269b1606698f018d4edd669cfcddd078ff48142a642e 06709bde09522a7cbfb62ce8c8f90567e22400367f2c4a67d9e7c268ba3cb7af 5984941441927d00f5e7d868616506bf85b8e8e799529408df1a765c9156b275 a9d2fa2752d254fe7d67d85820b326cae939ad9efe76705d846f86f371e926ad 1a01ec62972ab851d2b6b7b0778a9023d2e86b519aadfeab9ece25b12de31752 69c723aea5cbc8aa24e4e6c4426cc97337a37391e7aadf47f2bd9f21cda6e6e2 e26ce124ab00b3a44545e265cf2c8792e7997fbe7204fe1b90bf21d8cc6a347e 2b177d581fabb771d966657ad7d57cfd5cd300a968463f954ce0d9582a7f5786 07fca22155d4c1291211193f8cbecede8b36f611185639900f4347c4be0ba622 b64d3591fc74dbb0223ada7a205a0aa9014e26a0069876ccc3584ec0f062a9dd dfc81590043a6f87cb51655314070e94afd5ac4e94a1650b763d90a9bf7aef6a 65fa649c015a70b3e3042de4d5321f88f38c4d91a28ffb0bcd71d9aa3bef750a 4e0bfc6fdc78e0f3774c8a4d553f67b1297d5835930fb331b47d83de070e2463 799f3f6f0242e176fdf1a65a6a5510a9a202a831a70c5d945e1be659425c93b0 a523737977f8bb57cd5eae9a37de412a743362d90a16547f633f7a9ed3d34b93 872895dfe7ebdc306863a8071106cf0dfe69985af0e3f49204286f181f73eb0b 2f04d2122967162a1f3cad0e0304ede3c15c1d8856eecd1efaa4ec48536df5f3 6a8b1b47cd396a733dfc609e91fedf645289a9c3e9966034b658f20407c08ebc 43f9159e1a0a19bc4a01b0f42f500cc5681fc512464480bb50ec3bd8f1742ae8 70916a692e229a643f1bc16ac250941c5c486a864ae8d219f7676bbbee9a7609 fc29c93805e333951d1c69a2e34351d7c85964bd883964cd51fcd109c2306a1e 7f707ba27c142acd32c0d62c63c2e9b6ca8635374c527fc7b8210ce9773243e1 00956f7793832b0b357c56362eadb3f7ab603d1a52dc7937ff08663ece0db0a1 5376160edc2d6e7968d8831fded11f145698ec33230cbb538d371d1d4ba05e87 e02f1f80ac46e8cda76d0240dd9cd1346ccb380c43596bc8257b166557293852 8ff3279a9ed1bc21326c61b5fabb36e9feb1646c3474d75255203e6b7fac293d 52285be65bad1aa720d5817682354e419d2da941184995f3a2f61cb0398f63f7 7cafc72d070e65230622eb60592a94f205a2c5de3d5ad4514377203b6fe2b207 0c0ae25653eb902897f82926cd628e4b27451cc062f7b83fb99ccd6a687da2dd 72b325df5c1712675e48a7e66b38ba7dcdf43200f0471eee73cf0a98c37bbd5c 1dc252352e328e84e716cd0e8e5595eb658b8a56ea428f47ae57d25b9dac55b9 8cbe4f88402c8ea2e9420c9339c47209dfce1eb51fc697328af9106e954bc0e3 8f299d989a67a49bfa20a37b49ab2ced6cce2b1b86d7bc9b98a55ac62a464de4 cd761ccee6d8720a61d2a12d87cb18b3abcec050914974e25bdaea8caebff47b eeda31ccb8726399a71c6056cb8fe169daa2c8298a0766d1ac6ccd084557fa93 1f1adb2933187be438d23a6c4b911c494d13c978d6cd902b655ae2bba5820184 bcb293f44fcad61a5f29b73e923ae390efe7e36be9f9dac3448c25f991f5838c 7bd3f02a4be29d138eb9393da06c40d4c5608e8c10fc6ae528face6869422206 8e31610fd715424738b62c01cb7360e3e644c03133378d213c39daefaa4c4cd9 7d4c62a631baca0bbd72bc90d73fac14f7e8f6706a7361b44d50881bbf03de62 67de3b54af68a0574e0a7d2dced0c00493858c9f022774ea9c18e34925611fca a4c4c0577f68e24be22e29cfa473098dbae1aec9eee3eac08791df7fa6ac3231 caf7b42ef8d3979aa300a21c66523181cbfb95e37d2e884a9774f8de8a8ae37d 735a4ba7c9177959bd7b8cc7953dbd84134893a79615958752cb919e61e4fa3d f95179164b33a0675e7480bdf0adc39be20a62621dc7bc7d6dd98eda106c75cc 851682a4e63b40f47664726cddd3094868c8158aaac66b47e218ec21f13729e1 41fbdd4efaef25fae07fe7d67dd4873e3c22eba182996315cd06fe39bacecc03 743cac6b27083b7497c24ce29a19157b1c11a5eff0102aa7bb84fdc000256d74 4b0b35d769ea39483504f61f4aba227106d82bf326805982a033f8e848fe01f5 796b2ec43fb2df8aa5a15f3bbc9bb3b31b73d42690eb63daf5ad4d86b15106e1 4093ceaca6177f96a6207d5df968c4a348af0d3f0a32eda2ae7f246e2f60917e ba6ef0d2baa202ecce83885a78b462bde7939805b8fea7c7366a17d7776c3e73 7b6814344dbe704db7507d6d7f5bd3bbcc4c332aad6cb1da57f8744368e1aa0d 301d158a4f0d0e1eac0a781b61e2e1f8501958f589aa7be880c6400ae7f0d325 7838a14f085f0d7cc752189608a76f65c39e9407da2fad4e19bfc7048b8c40e3 2bf11228ff6e06d465e7e32defd5b1abd8ca4c049e9dcd47ee6209c38f4f2d5b 4b969188336b3bdf12df80e6dd4863ec33a90c3be0569617dbf0a1bf3a8b5143 c736e9f8bb8736f09ff7f778f7b01ccf168aa0d511b813039a53a581c05684d7 3a78c4c79aa88a4f1912282419f94dcec9a890f9d8a54f769da92ec563af6dd5 cf57917ecb1ad4bdb99175e002347f0f0c32330d03b5593f2e625f7d68e8a436 41cc5927bfeb29d49a268860b8a98d4d6140c6a45b6992a832ea1ccabbd20ebc a8d5795ee8064aff2e4be5e1251bf95044aa0af2f80b27364ebcb5c5a8b148a7 32c39a91b9ef9da177ab016742f6928f2db5de39e7b9e21bd1b1ce3eaab4bd5e 3329a6cd593cd9792ec65bcdc64c2b619d9d6c432b2baf814d69a029fc83bd9d 07314e737234564dfcee8f77ceeb803a400c20428fffa35f7a4e5132622f066f 3ba3edc3bca729daad886289c009759d8f9a9b68b73683b94aed4c809d7d3a1c f31e62c25f43ed1e693b126f379ea47275c6af7e92faae4c8f73eaf3b1fcf411 59ca8484e9eb326ca3c892b55ef01d733538ea00cf30ecb1109ea592281a4a46 89d6129b0b66a92d0f4c888769c53a6f81b3c2a61c337fad5dda4d45c6cd97d1 17117cec3a20cf9378b412bb7267eaf0ab05e2785ea97a2ff9e4c5b2c64c0730 d6dbd95900d6d882cdebb54958b1cfb36aca650d32bb07233d37bfa0df9066eb 80d2728b3a7c9012b39850fdc7d0010aad789b3b483b74f2dd59c5b5f956f13e a6ee6799462fafbcbe7678ed53c7d30a52a78767656496a799a5537675ee43dc 35060102bf02438458cfdaaf6df38c469fdcefcfc65e3e4bf76e119c275b3e7a b082cfddcbe5c9ce73578c3db355cde9a9f47fbc0c02cc532e3113847b5ce894 f984e034f4c9448dce310fc76f7bb16bb6d212784a603d8ac724a8478fcee575 c0264a40e7cd452982ed984fcce47e0d1c0422d1b84bdce6a1d2562d2927ca7e d71a4bd510f84816fcd39a11317c8f5c42b9b76e20132341f4c55b0baf6e5725 7e017d270180f7bdbb1a5094d9992b8504fee81a1dbafad935ad5512eaa6e25f b8478a859a1c635b66d8aa2829b2bc1a2588a335966bfcd356415f83c81407de 39a96dc50a7133963baedc380237baf6f01f7107f2534ee990b8afd46b952fea e5763cc00d46515b111ca8f80de5b002b7603d71267fbd3524e0b0c077a41d0e 24b6d9f6694cba1fbdfc02665e104c8f883bad23fce4d158f19ed5e618fc6472 102605f28fd82d77fd7eeff003182a1d0e12216cf444808fff82adeed9d47afe 25956ba63c313f2a2fb9f5f00b52d3b3d32118b0edb961e1aa1f90ae4f9ca40f d3dd228d32b4378a816429904878c02308fc2fee6b021ca70b976ed43a61adf5 fac9c0b397e8687840cc5447b02ca33748a7c4aa308e3ce9c3e7ea5b1f226bc9 5585770239a8293f90bbdff7a6321ba213658c0ced10fcc7061e2030385ea6e9 6679110b7f05f755c1517959f2f8541d47012429b4c98a944d1582b03dd44b60 2f4014be464c454359b3579601d78d6324d9a1e7694b3242db2a012ed6b4abad ab225ae01dd495a0e8992dc9bb706eab4a354e9be972250141dc7302d506f7f3 70fe7bfe7e08f774b9d8267905a15d59745cb7449f720792da377187eb64e713 2319529bd3c8f186c6f23371060549582ce7f49dc093803edb35320c873a306f 01f2f221ed53e95ed41a8c5fca8065b76ff6a4108abc724a4bb5d4ce310564ca d1e695725213e0a24af891e1f90183c27b854e214eb91d97793982d12cbf21c9 e086350d91b848e85044d70238d1ffdbe1cf7f4230c439e8f35986aebd9b923f 6c435a9f98d3d5872a3c75b7472dddb3a430bdec157e93b0493865ac96eede69 0052b5faf58bdc00e93be17025d1edae7998695f1dd9c6297101ca87aa50f4b2 17975ac27836b15237060079164055d73c310f24f2a3181d472197e524c84d2e 7c44d466c491c9db3b0e48fb75cd1cabb0cfa14c5f1e3ccf72645a0c5355921d db85f324cb2eb4dcc7720d72c006fc25f0311adb13a7cfe7a4cdf4ee3bc56073 9f531e9ce35d1deb24955cf138daaf3579155c45f4e2e19a5831fb0485a7c3f0 838e90886ae17333a962b3f0f28e2f7836be835165c3ed5fbdf5bad5b80f823f 9135e8ef286dc228aff37e56b2bbff876fcfb65b1360298d53b3c11eb714701a 8e847d88b36c4ac5267eed4ca6032cdee94294051c45f5c6ca5c808c1809ca5f d3e2ec3ffd167b05f5f2be700936b67867ed7669beba3aa16c40244d9125247c 6b61074a5d1d08b3b888cd07aeb6451e1eea82ca9ab527cecb6b65c71cb5e3a4 9cb6efa9cfdbea531c31c17426fc2ff5dd9e902dbd0c99e20c4b3df5ee52cf30 30c588e6851f41ef435ffcf2f80071f5181d10a2f323b7d1ec139b8941f5871b 1e1b6914650e62f079cba694c4e1a051fd3d509dc86c64bafffe8d9f58be8f68 a3d3b69b2ea0eca449a0050bcdf45211b82bb09449ec3335082526b903897d2d 2c3ab94efc2394ba1b11715e0b23ff99f9d496d052aa6f356bf7c313efe83f2e 701b176d96e2bbcf09e5339c1051501bb3a232138f9eec507485d2b632a8dc43 b91830ca097d1eb93bee184fc5dd6407f2aaf331d4bbd523ccd84703eec2fe9e 01b46e00196357c2da209c2858b72c78a666e42337620b192e906d4c4bbeb2eb 97099f4e8d7da97f0c3e9c828ce1e748205c819103f2a6ec0079392799234b2a 25e2e0df49fe800962de19dc5276a10d787532b09fe0ab89d68f661ba0d472b0 ae33c52561ba482c62dbe7fcebec75dee40527b689a87abbfdc7a1767523ee39 c501d1ead72969aaa1183dafae2b2e95c2340cd9ced96642ad2746bb552b845f 7bde36b2fbd5e19db7e64392e6e03db140aef7af2017a485238b8591f6bf1d29 3f57d6d67f8292b9a66c62e34c92b61ac0485f9c3e6ebcb689f7944b19230182 7a9f05fa99636b3526a9ede4b3fdd90d4fd1c0ce4758390207f5e65d085fefae 06db2c2c5a72d5db8b8c808bd95973a7b084b4337f9350cdc883b361132ba6f6 92c58287327b91485c44efff913346de033419e77ec1e3028f7a086511225eb4 2af8687244c1ec1c469bbbeda13a261e48bf27043223da3e21a3d4120f2ad3a3 645c2d69af4463376482f20aa99971fa3d41b41017179cc464cf03522cfa9302 1e341aef294536c50a8cd0b578485a961876125ff520e95818baa4a8e5ed20e0 5e64844275ebf58f43b8e8ca5356665fb78a23cf7258c1b768a4588d202a8466 4b73fd4805a6486548548c434c001f01584ffde31d917a841db4d17336c41e50 24c51cc8b2aec6bd18ad622a41d81589460d9c484c15e85f02e43b4db212a649 d764d244ba2acdcb7ab1cfd4b299d3cba3a035f814f66b3f3b2708138748b8ba e272eab5f59e96a0e7590d1b38faf3a8dd648b1b61bdf0a89f9bafc34764b9f9 1ad0c52ab719d64d17817901a97deb171158edfe3e1c40a8ce7c094b18582772 8e1ed078b9f8a01e77443bbf01a948e19c1f37b0ea6748d704363e4bb2352021 cb6df15756d5eedfb022e3f869cc4274e4c5ce043e5691b41f41d6d4333a7645 748cf3d4ba111dca36c8a664c729ece687e263697dc5e1121316ba4f51b7883f 60b7633c645b1699bb422c7e7151c4baf274ba06a706ab7538af464ceb2f22f4 9ce8c756bf8e09d7e52c6045043754766144c9377fb0670c30c38348ba8fe997 322e32011017bc0e35a2b8afa2b4126074ad46a6d15f6762253dc253f8e31e68 626598828458c40649c47975a690b3c2084d3a256b6c640d666f14829ffcab3e 5baa649c66eab287ef7e1b1dce76ae5240ae5200252f711cc870d1d0d45d6e0f ff65767c764b832209cddad08dd4c6d1782689265bf504685843f941bed476e1 62cdc5d15a8d8da294b62536e765283353f94c5c06222b8af93e5df778844cd4 c1dbdad385508af1c0a7e59dfcb9229c93e2ceac06d6be84af0f1634fa3d3c4b 5e6030bf244c4609dd6b01abba550bdf2382c397e3dbe75afd15398f73a26c8d b7a861ccbf26eb26ffb7d5deb435e7302ff79bff8cfc6b2f02c1bb808b34172d f7abba9371356d99ea015aea223ee156b8048bf6d37b2cbabc86e635583aaca8 84fddb53cbf2f4ae8a26da6add27ef92e9b7677001790025cce10fa5fee223d9 41d6792a67984a1113d084542bf6ecc88b03408114d3880675118e510c8cd107 588f175c17df399d8aa5f38865385a60bfcc1a5027b1de646bf4e74e6c324108 6035a7d9dfc4158e7116aa592b8409823cd26e4a826029b87a6c1bb2485f93f2 008fe0a5db159cec121b4e7aa0d09752279d6e2053b68669cec454dd79913939 faa5d164e211926bd48af790ec8d8d4a5ff0de446d60a58cfb77d08832eabdcf 406f62200369f59bb2ef4e021ad550e605b83bb4445e05de65517662cc0f2985 c33b6044ada5a473975a238c742e7e9825477e59dd4a282dfce09387114f7ded 603fe31d6d41f259c42e6a1cfa25bac7d8edd785119f1b7d26b5558a41622d3a 47aa6bf79c862f4a8ce30ed57fc487a14d9a43e5fb8fe52db5a2bbd8f7aa591d b100bb155703c756559ef45fd6d4dddde4d3dff048101e48db3778dc4d7d159b da946af5b3bb699a4f9769e5185228529f3190d1447b4eb6721f086c1adfdc45 60509495029e39cf3f1b8c350bff433506dd3d1605aa82f22f0ca2c4ac23fce5 7097708cbb0d6f44f029cc74fd1f9d7e74cc9fbe80d843a1c801f03862e38a23 b26003a7bdb6684420a21962c68d6682eb30209c44c07f8b5a7c610ba3bca184 984f7616f3c49686ec467ce46c4b7ac3b2dfceea9d5bc37de9eabf2923c06edc 755c5c76c02eac435cd196b43b399a14aa0f182ea3e869903796df6bab2429e0 89df3fbe84a74f0c47949506d0e42e685aa4bb66354f90c745df50b87567a78e 8d4eb4fb68bb6117215d869da549cd7fca2d6c4924231745765c42e765e5a345 390690618fba4c631686b25c3800e0ae71ff19f50b421522afad474bd1315e8b 7843c52c0bdf02c0b9357486da81755e9e2aa6c828b55d0d776dbf087e6204bc fc806be8501758f72331fb48a2d15473ceef7b89f0e07a604336ac3c04257f7d 5d6d64ded5423ee776100bfbd88c0dd8835809bc08109fbf0485b730b9d3a408 f21b15e0811f36c96a6eecf51fb1863ce98676fec14d2d78c2a55e85de49bc0f 35b8b55f350552f01aadcaa549ca8018be88b7d37f18b88d7508d36ccb3f6bd3 d593957e75436ee04d15453a4eeb311fb61c75a977b3332d21e6a7f09305ed12 e3c3b2780803fae9f09a2f1a7eb9d881d20ea7ab834dfeb673767f0fcbe47b48 57f0dec0b7e04ebb38f007ac14d23e6c45dbefeb7f7b1ff35b782f8d061f5c43 a31c06c95c8ee20061f08bfbf06e745a91316c562c8e4354a3dc5ac833abc867 06d8e1d3e1f4fc5d7c16187eadaaba35edf2cf02aae20e74cd2d3364a0d6e636 c734bc15e1989d9c0d5bddb1a7d3ac8ac0bc1fd258f8675f2a890329cfa4bd63 a76f6b998b7db2647d2fbee462c6dd54c7d996614d3450bcee8c2b60ed41869a a44e38870fcf3efd6093b80fc2abb8ec9baf6f6d7fc5a4f47dffddb4d5da83f3 4dda9a7f3f9aecbd484b07527d5d439e27aa12c9669d51bec687369fc34fc771 303b256c26e8e6b2f50b73eb3c41a03387972d57067a6a8809138c7d72b24095 122e7ddd1afc578949de6d31950f01fec3053d12104554a082735217ae741657 6b0a0dedf98e671324432d271af97619f95da930526dc38ea1f7f30be365d086 0cc102c1aaa914db423986aecc7a62e219ed3ad1c4d340d553d750751a28cae7 fdc89a49a8b0b640902d8d701977168b24597db7bd08dacaf41c9bccdd7df604 b8a1eae14c58f37b4919ee79e2f659ea08a20fa45562bd1d4ebfb905fd2f7f7e a2236f46db08ce0e67e45830f1cd5b0937781e6e6478746d85917b8892b941c1 49e6e6e6a15f76acbc29408c75f6766f789646920768ee1d74a3433e821bfcb2 c37287174902bc120553e0248f22b15bd22dc9cfda40d5dae1a372f5fb8dd506 686df2170e2e80d2bf95c9f4d749ef506b575a957a2b02f987fda5073665e1c3 195f93425c52f0767ae7895300f9e07994ae84b115f5cc33455162a3161234be 9cd9c072c78054dcebfe8ff40cc471a838ba13ebfc8c2df5738d139cfc93790e b895b4d4967fecb36cb13494315bed2f7fa8ed236b65715b0f9d473d594655e9 60058d6e3fcaf3ae3bda8cd4200179a9a125d74fca4334b96fc251d104514bc9 4b6e727a1a8480e0b69d891616b3b4e93f473d02a96f66c6255f15c610565f1d 8188ca57c77b4c94ab9273f4a9ac06a9931e369a97e8369db20aacb887bfe70e 4f2b1b9e1d3dfc731d8ad33748408b4c5a3707766c39bc8f2a6268ea46df1125 8977fb72b4918423616cf89c3f6e24fa6e36beb927aef1a4c4d93f7eaa6cb691 f5f0d57beb7c03944006bb78fb443d39e5254cc83b521b86fa7b389b8b3529e7 4e90001fce93e03323d8dae7de2f9dfa735e5813523a58ba958a8e84ba4f4c93 6a16cf0570a66c3fe5ec28d991b6af73e5ded6ba64e896892a29e3264017f9f8 8072596d37e6b90c79829d2a712bd317ea19358bb92fdad513ed0db438c1ed59 a869bccf3940a05e574172744e535320548941978e38d92c2bab49fc8e380ef1 815a70a02bc2ea5a9f7dc99929b91c72f9fcd4ef1f5d00afea03cd8ffe6362c4 cf28267a3ce3e7b9c200ec670082bd510b7c7ed1 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMR17 %!PS-AdobeFont-1.1: CMR17 1.0 %%CreationDate: 1991 Aug 20 16:38:24 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMR17) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /CMR17 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 161 /Gamma put dup 174 /ff put dup 175 /fi put dup 176 /fl put dup 177 /ffi put dup 178 /ffl put dup 179 /dotlessi put dup 183 /caron put dup 188 /germandbls put dup 67 /C put dup 72 /H put dup 76 /L put dup 80 /P put dup 83 /S put dup 84 /T put dup 97 /a put dup 99 /c put dup 101 /e put dup 103 /g put dup 104 /h put dup 105 /i put dup 107 /k put dup 109 /m put dup 110 /n put dup 111 /o put dup 112 /p put dup 114 /r put dup 115 /s put dup 116 /t put dup 117 /u put dup 119 /w put dup 121 /y put dup 196 /dieresis put readonly def /FontBBox{-33 -250 945 749}readonly def /UniqueXX 5000795 def currentdict end currentfile eexec 9b9c1569015f2c1d2bf560f4c0d52257bacdd6500abda5ed9835f6a016cfc8f0 0b6c052ed76a87856b50f4d80dfaeb508c97f8281f3f88b17e4d3b90c0f65ec3 79791aacdc162a66cbbc5be2f53aad8de72dd113b55a022fbfee658cb95f5bb3 2ba0357b5e050fddf264a07470bef1c52119b6fbd5c77ebed964ac5a2bbec9d8 b3e48ae5bb003a63d545774b922b9d5ff6b0066ece43645a131879b032137d6d 823385fe55f3402d557fd3b4486be356c29c3aec91ef17f5d31183b1e489f1fa 559a6693fbdd04d4f7e99886d8cb7cca13d4aa9ceb34a708af22e69ccef0e504 c3997075243585edf60b6447c8d01cffb04b6e3ddbaa7da5891286861322a795 e9d990fd56af2f5c2b35801a0b07874e4ac3170481d232e150443253c92a8b05 513d4a4154a99d91f629ccd30376500f5d16aaa9b203bad6350e4b19424c0e33 75f2949bc1927a6f6221252f8a96618e646aa1b0810753c98becc26b37837775 24bca72b818d314074c1c91f4e1f4148d3d703d12d179ee6970bd55d04aa9a9d 97f63f2c7dbd129ec2ed3ba5f8080270ea5854ea165dbcc061e2f47f1aaf0997 2ac9a689a2a9620b91b53f6b5092884372f5f7afca495f331138d85a97c5bb83 d8072dc88010fc89108b60bc06d4f93c722e8908d7ce3c1ea3c70e9e65edd769 7db17ce0e012ad37d4030f33d30a73fd655b7a2e572f3378ac933dd75082f2f1 68702be19bc60cef6bd5f0ada180d21408c04b7f7db9b6dbaefe09e809a80ddf a5366d10930d3e68ca53e4721ff525853f4c784f2c2c3aa0129a34d9df00debc ae4037e4c0fbdce3989f35964b4c07e7817b805bfe8c15f0c0ebf226cff606b6 2954f0f42dff8c214a6537ab666d25389c44db7b5866440bbfc137712bcdcc89 c68cd1adfd85648b1ed29bfb45a564b02172137feef782d604e0d7e1f1737c96 719cca9e4b9dfdc87e5999b886a15ac572183df8607ecfab5eeafed9f2798b3b db56dc26f8b6f000eb0ecf24341c969953e317cb01bf72bf002c07632b5195a2 8995c0b23034671dd2ff7f0334745a5d09646bb6027b54034f376bea19419a61 757e497a619513e955d2550a1e22208ff446f974f02c629d4eec9342cac41e24 3eda835485be27f1d1a6f2be3ac82262b74d067752a8dc602ec14c9f3007faa7 c3db96201a742d9df127da560c6d8562103d07478718f7ceb6cf2247fbdefd09 808d21db340b46d3ef5e3aa916dd70500ddbda934bf3986fc3d83c428a7cba11 6b9e119d49a0d478e7c61342d57548ec3121a2d61bea86cc26a705d20449e650 10828a6858e0167972ea0a733db1df20209184276fd0113dd9e03618c9202822 38fcab7508bfb54d1908cf37cd04320c804c1b8461d26a46739bf73361dca542 5798b4d0eb02db8519b2d29572c29c0b1d9902bec78c6b2b7e6ad3cce0d35b38 2dd1e23c35ab2f35035d7e93352dd72ba4600e3d625cd69bab22c72e506654c6 d78f8f44103c571dfc9067b53f6d52de0d2b87eddbd62a0ac395688022734002 bf128554b21c92b68bd7f7b8aaa6f210cf716a9efeca440433051a93f2b3a965 6d518e5fa373d5b8746b52622ba89da0600415186ecd933f53cadc1d5276c82c d42e4f8357f0e58d32108ebc10b326be4dadee651f971d270bb874efdf038953 0fdf9d3d738dc91dc616fb4b0b134310e07a61b33232a469e03818802b19af96 4c4f16976360e356c8dcd7be3de0565e099c6cb6347134771933c8a0dc266155 0394d11ae2e44456b7b5d973c93078632c74f6573a967bc2a4f5889c08ff5fbe c7190d4e43a4695bc82bbb25f66c3f1c0f2869ae39857e40cb3cd010234cea6e 0680dd1f4430d2a2b3aeba072f82a95d41b6d199ec8607ecf6a1e1beb0c9ad25 450272b15caa79b889726e5793c34c4b6bca65bc58e722fc6f5d1546ab7ef661 abcd8d7851764de536755a4b36e751c52b1b6cc7e75207029d8461f435519576 4eb3728e58d00f29e78ffc60eabc7c8867d40c1a64e070bbe09e9902ff6600a7 6bac4b074617843298b23c63f81be934938dcbbb539a0b939e6be4be2f15405c 443c2d058c41045da706480c18bef6ac827d1d2e801e117355602f41080f1c06 3a269dd9c2612369ab8e0bab04d31488c051d39376393bbf36e7defb9444717c 77db0b8707a6d276f678f8a46d1bd31c5a70bf398364dcadc4583c5ce48e8cda 8f96cb268ac71213bea4f8dabda246277bb0f8aec9755a560cf8e32d9f2c9e32 469892af31ef10ae88f9ef99d09911675fbfa7360d63a9be06d5660e9d5dbed2 b20ee6a00eed1ffe8af97727b7c1b814477959c720abf4defbabddd2e8a3337c 5dbf3ba2e29e7560e7268fe9dc7b189368f03eae307669e17797e7b9bd7f77a7 980369d35879ef33ed3af4923418294f21fe59fcccef15801f9099e8075edf58 929d06deaaea0b763032058ad46ee4fff044cbdc8b75b9091a924f12b251e1c5 cea9b99d556c8051f2d73c03484b57cc358ac6d1e0d98d7892a5ec88be9403ae a3107215b8068c0b948e7a5022748cd08fd7263ab388a062f68eaa8d4bccf836 c815ce3861043ae50c37cdf2df3e436123c6e32734091e50f0c018b3db49cda5 a123d4d348c1ffb3f25d9d1a6ebd874857e1cd1f83bf9b71acaf1f80549bcbf9 19b34ffb5afbd120e53dafd588e895d9916300c8620d049ca4b32a6f039198fa bfc6105231ac3efd177266e5f6bae1f4b8902135b92a81729c76c8002c3ae9b9 f7de0d88a5f87cfb9443b602a5f439da1b908abd565ece3e651543b2cb3ceb34 3fd9403b7b9b9903c1f6155c4e1e1412420be1bae08eedd56274dcce5f6cbfa9 ff76c460b0d480a9db4124f9ca36a8794c22d180fcdf540ec5938f7d363c8b18 aa3c19b0e8d107c1988ab95a135594d60105d5045c24b63d3dcf565a770a6968 9587b88a90abc04635670ea31cd66134d8dc880b5125bf2680542997538c98e1 f17a72684918b6bea37cefda315586457d2a70a0be214f72e2923c5f1abc65b9 592e5f8ece98e47dab23e59d82bae2c8d9ad65d7b759b29f99648ab0fbf0586b 9303950354dafe8468e8a8ee3fa11a0a178b9aa5def2dad23cfbd89e2e3dbcd0 56a6ca2230f9e14e48823679adeb6a20acf2d6025c0d1b02f390548084d472bd f83c4aef684b891c0d3c1ac6a3aa33ba2bd36e5cf705f70702e3f155477296c6 5b001282c18bbaeb6c49edf9b45cf2177c4112e75b563462c718dcb74b47ccab 5ec84c661d3c8cd717a67e6aa5186b2d31f99fccb9c539ca000b2306fc169865 661516c266995ea340111af315a33f789d92aeb44427e053e925e521c7df93b1 68e501ffa0fa193de1ac62923bb914f8538c8d398680bc54d62f066586efb56d 78e89dd602fbf98afb4c37a3deb09afef5ff983d28f242c44a286311672cf229 1658f8113c6efceacda4f203c936b666f7da606dd88e7c251dcbbd693ec1ee18 d5ec8bb30de71f34e373b8c87693a4ad94817b7591aa8fbad6536415c9959bf9 ccbd161835c86fe497137599cad034ab6bfdc35f1edaa202e7fd2135018bc86a 37f16c36f32fd2e0f3658cf909f22cc01b93fb945de885424cf201bb208ab635 4aa1788a1db4b3139d58ec60f731ad23f35996299e3cd7e6f6d84a76d4019677 1a4353e0a03e91c3814f815dc4dd1e6402923475551c1b1861cb337fb8967974 adad7757d256a5986801a420e69a8a36b16cd5bf18a1f2d3ac6b84d4a1be5de2 03a4c7ae159c9f3cbdb98f56870c9d009906a0c3b276c0f3817a0df170072ae1 34490baac1ec6bdfbfbc4e70982587891523eb805f7802fc55ddc010c60716fa 23b9857e56f51dce0940acf609b8ed45089ad83cb28be99b5222cebf76ce17ee 434b12caf317af1ac1d072cd6499738f086d2f207c921a2b0fc523a89cc0742d a2f26d4952f69a498088514e4e6404e21846f7d9c8f2cc7249669ed21f2953aa 1407effda6220823c3406b1906034b8c34e782af47b2f3879ad4fdcb778b942b 8d14790694f7babc1521c7757cba0e8c167a6c266862e8ba9382d087c9ed72f0 ca9e5dbdd6ca36bb222d3b0725b082767b80c5ab28c0db8de78ba02d16db19bb fb52549aacf7eb49d460fc858409b196de8749ba818fc73381122c7620e99724 88bbbfa3dd6aa6e58f6d53634d17c0ea02e42c410105720102e0a29b03d9826e fa3bb68115ca0bfafbdfd19f826bd41a1c1a78ce1d6be4a0c33460d7a82518d5 467f055411881f6ecae470dfe64f9b73697f6bbda70fc0ff4063c917702db07e 415d7644018b4c898744fd6776010cab8a06d082c5799de5e290a6f185219b30 3ada8182c9b4f515d16b0d90807011cdf740d1b06c024134864747fd85f0021b cbe6cfca28c889eef36b7247885af944b746558eacb439ea8b0a75c4d27292e4 64c760725db4f03bdb08be55fdb9072ab3319240a3e1eea6129b60d922c2e489 c6bbbfff13eaa90a0061d8a6980d4b9eb535b149edc3d6d55c96ac1a4281ebe8 427acb4045d48f27568902f104a8d7c91b63121e10262276b28aced91e2b3d83 7e8a75398052fab9e3ed25ac712a66ab9dcf4e0012cbb8cd96cf37b81af7f89d e470a97493a2a7d34c57420c1e11274119d79aabe15e46353c508dfe899395f9 cb0ee50687eedf3b2b187497663182cebf8e11eeee077c3d961fe585cb049efa f1d3eaad22682f291273d319f36ac40114a131317d2c2faabb786e512013b631 62dcaf6a905dc1e128f94067d8805bc79fdb042a2b6958d4abbf61aaeaaeae56 a0753f5c9e4300ee0bd7ece62a7098a75c64fd6db66793b8270703f86065944c c5851c0fe3e3755e4e42ca1dfcc352dc008b45e3ac9bba75ddfc8cee36c3f764 cf2dc841524cc182c25cb52cac7e565eb2bdcf7702493c2ea52476b18a93e487 dd5384de7e38265f9184ce1b8e72d894a2285d865651ce41d627e0915ec06252 16a32ac9f62ba99bac41761992890c5478f172ac05f8b45546c1c6060693b3dc f5b808b134511baa518b9ac80e28b260e104493a142ed3705f7f369a3e77a672 41caf074076be2ce9398652ebeabfacb2758e1f9ed787e45abd4aeb29db36c9b c60fac16ad4d0890c089b49552ae5a91435300a4fc9dfff470349ed4577e5f1e 0f5b4463e6ef6a5450c4e2b9459438d1220d1d042285ccd07f901fd479efe920 111aadcb6b75ad3aa64891d57d3268fe5356884dfcb557ab5409f5a312fc3da8 0d318409b00a0e31561b5666466aab7b5f33e05a683b5a0467560d48bd306e79 fcb1a08ed7f46318408d0fb1c6a74ea6026bf5bf38494ae1ecd73109bc644234 4eb3be07143f89a082717fa0e0607afaff1b617036ad24a26d4189183ec9c094 099026a1f1b5fc8e8384ee76de55a0fe02d0855e0f26bc93b83ea9a0632b6134 473af285e78e02ca8fd080a5864e81367a380fbb1b072ee22ccb935bb91b5fb1 9ffbdb118e4e85b1c3a38656bd3ba5ada14300b5c4180ad6a129c1becfc96898 1ec872ad2c3ec7c16b47baab49e957f595a1ed1895a0e9931a27882c22eb9fbe ec4d0d2c4e286d95a6aface20e9aa84dcad186d271139e6ffb9e49f11447574e f80210412502d08e900ce744f8e1e0c3b21b519837a03dc4534090ffd55f8c78 1ac699f55696ca90991426706f266c41d51c39e48ce7f78dbe99da90f8e57e51 2c417f5c2460623e6f0d5b37c2ceb31eb950c98966cdd9b4d1e2f7116b9038d3 8a36ff5b2494cedbf6c72ddee39d89bcb401da7d8fe9eef9fc1d52d40f23c28a 27af65e9cf6087a31f41d9086e518f9154a42be7b4c7fe48011ea3c1802cf061 9891ea055cd3690624b0aad9f0e4092ae8ad0b8e8d79bbbcde36ab16d16a4901 7a902586001c0d8a1d1a04329558d6bf602b03690d6b74b3fcf6a329269d065f 20bc5c3ceedb24b2bd94b9c16e8052e4576f2fb2e3024f55fe346522407c3e74 71fafb7643bbbc38655ed8a0b5e7f7c00feefe76e400d87b1c02705ad53873a4 ae0279796f53f9ec82fd953eca77c08d1405f098be850ee0399fac0cfe082fea 10133c442243667578e5536a37a4e2b53efc3c45c67ce128d3ce7dde8eacae78 4d9dc6bfb18bc90a1c882164b83c5a1b03686b79bc5f9f2905339dd7470864ca ee5e40920cb5773edb897397af266d4e983bf9acecf51c1c65c2a044d84aca51 4ea9e381a35cf65388776f6ff6e7c5b2dfb4311c4ee8f14c5e337413d6624379 88c9a1ca906afbbf72fc891e8dc0e54e3032eb1431d5d29a9723536d9a2135b9 2ac06393ba6347d1cc060e9700b3f285a21f9e8c113b8b2555751b828a0fce43 2c6cb493e2d92b45a7ac95351cb53beae8f466bbec50dbfbd57e005d8b35da09 8f4de088882cf2c0d6ee2df937143dd3ed2b42e0f12e739089f2820041e854d1 f25a185a1e7a0526d4a6d98f207db78040c2e6e1ef6be11f444f579812b6a22a f365ee5a4fc76c89646538e5a32183b9b9e36e5a28eaca09002afdcfe20b5192 b9cfca8936ce3c1a20231dffe543454ecf7ebc54bc6c569ae9648b9e7d44fd7b f9f19df9d43be5e32863f84f558315a04484e2457e1ab2601ad2d80eef91db01 a2820fb952e7bec55cfa5d6eac26ad4d352c9dd20332a9d322aa6178237617c2 e53f36e21a92dd6607833942b9eb39ce11692e24b0c57b3bc69527975ecea7cc 84a7ebccf2cdc0a349d49a785fd7d5c8d9f2deb6597377ef49510db2a8d0c538 8b45a4d6379eff327ee05ff89eb781f78690410ab327cc40abf59fdea15348a8 73f8e98045d60504248379c4b741d43fe6acde80f04160729e75bd6f1cf03bf0 bdc4ec75a55a13e2f33282fedd58b94c6546f42323817165d516975ff1f0158c 7f8498d1c0652b5a0294e63b25f0a32186368f37f2223f6794f5f706d61a4145 6860f08d21932e0a0004595beed5c6bb96e8a2035217c26cddc08cdfa9da8623 0b49b10a615aba63365f3fef3eb7e57de3fa842e2bd5420ca5cf91f9b196d22c d1aeac2fff2e174c08d3fa9d323cf9ff9503fd58e86ca2927f0776178afd3c75 c79b4597014bc7458b37f5f1c320c425fbc00acada36beb08f5eac138902bb90 1cd2a77d942fdc5a5eec2dd532c5557c0c913a62c6c2f91f9cf0a5c6952a2145 1cae1f096a987f7281adb839ac9073b6094c5fbaa1cebfbfdf120f63cb14a260 41d1a99d61c96c1f126e455ea2bb96b0804c21c9d3e7bf21131c44f7fa8f7429 201198cfea84b9c7c7a4bf237e99b710c5ae9ae59ee16ee48ec52e95d86b6d6f 2739d82d1da2789eb796a5926b84c0b9de584c35952c3830ad2510d56b4136ac 908e780b44afd4106871ff13345e429d40f1854f0a81b1f5bf96633b3a06cd45 1f9e1e227c0ece33177cd8a02cb3100f8a98db284e26d678f3957b07fa309209 c56d1ffcf8c15f42916438a8cacd5e50b41a61f98ee722791e3ac5f26d9b88f8 2315048a6deb75ca9115114bb5ec3fcb1598fa56b570f5b79b3e4c7b6b429e49 62d3216b6162ce14d97f60fe9b3f63952c124cd65022161714cd04fbb6c20351 1fc59d1b063c4971210fc99a6ce8f0fa3d6998051d4c8a43fe5db374eec801ab 6d81760c866b2d6648302e1e459f944f67ebb09d075910251ee10086f0441db3 072446c0c4cda3aa8f5ea9bfdc3595ee8e276b8ddd297b4f947de8823434bfc5 88dc75df6f26a3836802e84179bba067e6c23dd4692e2e6afc55fe7bfe6e23af 5f1f1bf2b458b7ce2531f36efcccc53acd46eca1999046cf02e224eb3b37f781 78c195d764b1a51403f5b6879317cefe768391d3d78a5d5fe5b5a57feee688fc c524a75eaf763db6e62b3f4d1ed2ee69abc7456334a3f73de404746b51567471 930fa17a05a04bbb57d4cbf4036e2cee5bdff6151357ae5ac086f01815778d0a 3c1406a67d35e669d45d820494e2a35f81d1cd5e2e35a822bbf5ce042c655d8b 6d0ebc220247dfb888242a9184dd84d983e783da3016dddaa020b844b6faa537 1d2d5ba554e15596cb215d32221ab634eb7824572a003dfa94ab8e9f7fb47de3 165e80942fdb6059f6e2d31cc243946c9840d27381a37aac9ab13563d4d6f913 ebe4a508e18f4b1fca9a3c1086abc751280f90608dcc2d98986bd817069922e5 81b8ecf58e93493540e3be12255ce32f98489c75cb30dc41c507b799997d33f3 3b075c190d6d660d7b9958e180e93a844f337cdda61dd93082a33dd2926f247f 201fb06673feddca4afe9bf31677aaf3d34e8fddb8bf9b5cecb086e6016b6f1b 8eba23f7dbf9efcf9d140c3a2ec9ee772ea82ac436bdb3105bbfd39ab195f37b 06b585fe62d4125b647dc225c1715aa9fecf1431ef43eaff660740a018b3fa62 41ddf4c5a37e41e4455f4d0401c2d4d38c53bfa89a7880526d7407866f41744e 88f5145d08be6716f42de44556fe6a1a664868be2b0def557e468a5b66523b6d 8f4133f06b4869e4d96d63de2de652025c3faf5cf49ef6d1753ed0b64c99b167 22ff3fdfaf5dc647aaf04e578a5e7a49a0141b5c2b58eb9a338a842d714ac342 098a50778b9a92fe3fe6cde022a9bab807698f5a9160c13f296b4df4fecd1c89 9a98b431a3c0069109889480f9175f782e0a891b9230b3911334f7bf3f61c019 251c66f0e2bd206c91e3f0279c972512a128e49b62f9bd2815c5e154264d13fd 1a7b47fc552b31ebef454adeec7208cf7a5b7a37f6383acc139623c997bb9407 4d965f89c4ca6de358a7925d397a9306680ea0d328daed772dd9f9712ef7bbb0 2a52ff258d0a5008e67fe004662ba1e5b17c88a024ee0cffbb8c884a14af7f4f b27b05a66068a7e25f0f4e9579273a0422c994972d2939407b64131314de92c8 6310f9ba7f551b7f97f271af6bdd01c21adc6ace58ea29b2547849d1744efa01 608ef91f01515d6e3ee55d8cb188d0c40f57e13af6b1b0ff5ac29394efc6102f 85958e3a283a2b713776a6696d13145de666b1ca8b1423a5d830dcabbf2de09d e7bf14e1d0e3931a9877ae8141e6994b127305171409758a645b7e70a27685b3 7d7e93025c176bad0b98118ea4a2f4eac4757c94888c32e3bce9ef441f42336e 1ebcf571bbd3fb212e21c55be98b64025c6d0198a2664363e42e430f12c2fda0 dcc04eaefa30944e8d0018c58ae90d47357a79dd54d87569ed35efede01edda7 b89f83db33f440cf0a985f869b5eb6751ec9e83cac2a7b45246edad460f8b5f7 c2c38a4b967046bb11080e04e68d6792b5c4b22a0b275b2d63d823861ccd8d80 e5dc31a99013ea3fefadaa3dc5a65bae47a78d59650d0b150ff309ee5b1e582f 3f69131280c308ed684174c768cc85f55365bc068bbc360e49a92662ec0b29ee c99b1e44 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont TeXDict begin 31969931 43810646 1000 8000 8000 (top.dvi) @start /Fa 139[684 1[684 1[684 1[684 4[684 105[{}5 1328.35 /CMTT12 rf /Fb 135[497 680 497 523 366 371 367 1[523 470 523 784 261 497 1[261 523 470 288 418 523 418 523 470 4[470 8[523 4[705 862 5[738 614 4[705 18[261 314 261 9[470 22[549 11[{}34 885.568 /CMR8 rf /Fc 135[502 18[420 75[518 25[{}3 774.872 /CMMI7 rf /Fd 143[1107 112[{}1 1106.96 /CMEX10 rf /Fe 136[820 1[820 820 820 820 1[820 820 820 820 820 820 1[820 820 820 820 820 820 2[820 12[820 4[820 820 820 820 3[820 820 3[820 67[{}26 1594.02 /CMTT12 rf /Ff 190[653 10[441 3[441 441 49[{}4 774.872 /CMR7 rf /Fg 133[515 543 633 3[400 519 3[537 664 972 330 2[381 1[528 542 515 576 479 475 585 6[756 10[844 6[920 9[861 553 1[307 33[631 25[{}24 1106.96 /CMMI10 rf /Fh 134[789 789 1079 789 830 581 589 610 1[830 747 830 1245 415 789 1[415 830 747 457 682 830 664 830 726 9[1544 3[830 1115 3[1168 1418 3[557 3[981 3[1128 11[747 747 747 747 747 2[415 1[415 4[415 39[{}39 1328.35 /CMBX12 rf /Fi 135[1363 3[1004 1[1055 1[1435 1[1435 4[717 1435 2[1178 1435 2[1256 28[1980 1865 1836 1950 7[1291 1291 1291 1291 1291 1291 1291 1291 1291 1291 48[{}24 2295.84 /CMBX12 rf /Fj 145[553 6[553 553 46[0 21[1107 12[861 4[553 1[1107 12[861{}9 1106.96 /CMSY10 rf /Fk 130[581 1[581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 1[581 581 581 581 581 581 581 1[581 581 1[581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 581 1[581 581 581 581 581 33[{}88 1106.96 /CMTT10 rf /Fl 133[797 946 946 1295 946 996 697 707 732 946 996 897 996 1494 498 946 548 498 996 897 548 818 996 797 996 872 7[1354 1[1852 1354 1378 1247 996 1338 1347 1225 1347 1402 1701 1077 1404 1[668 1402 1410 1127 1177 1374 1295 1275 1354 1[847 4[498 897 897 897 897 897 897 897 897 897 897 1[498 598 5[498 23[1494 2[996 12[{}66 1594.02 /CMBX12 rf /Fm 128[566 4[453 537 514 736 509 594 368 453 467 509 566 566 622 905 283 509 339 339 566 509 339 509 566 509 509 566 7[823 1[1106 1[823 792 622 807 849 751 849 823 993 694 851 581 427 823 856 723 751 836 792 779 823 1[566 4[339 566 2[566 566 566 566 566 566 566 1[339 396 339 2[453 453 339 24[976 1[622 679 11[{}69 1106.96 /CMTI10 rf /Fn 128[553 2[1107 553 492 584 584 799 584 615 430 437 434 584 615 553 615 922 307 584 338 307 615 553 338 492 615 492 615 553 4[553 1[676 830 830 1138 830 830 799 615 815 861 753 861 830 1015 692 861 569 400 830 869 723 753 846 799 784 830 1[523 1[861 1[307 307 553 553 553 553 553 553 553 553 553 553 553 307 369 307 861 1[430 430 307 4[553 307 16[307 922 922 615 615 646 11[{}86 1106.96 /CMR10 rf /Fo 134[1635 1635 2238 1[1721 1205 1222 1265 1[1721 1549 1721 2582 861 1635 947 861 1721 1549 947 1414 1721 1377 1721 1506 10[2340 2381 2155 1721 2311 2327 2117 1[2423 1[1862 2[1154 1[2435 1948 1[2375 2238 22[861 44[{}38 2754.12 /CMBX12 rf /Fp 190[595 15[406 49[{}2 664.176 /CMR6 rf /Fq 134[523 1[523 1[523 523 1[523 1[523 523 523 523 1[523 1[523 523 523 3[523 40[523 10[523 523 46[{}17 996.264 /CMTT9 rf /Fr 141[486 1[655 3[327 2[327 39[890 6[327 7[589 1[589 48[{}8 996.264 /CMBX9 rf /Fs 242[1024 13[{}1 996.264 /CMSY9 rf /Ft 132[512 455 540 540 740 540 569 398 404 401 1[569 512 569 853 284 540 1[284 569 512 313 455 569 455 569 512 4[512 3[768 1052 768 768 740 569 754 796 697 796 768 938 640 1[526 370 768 803 668 697 782 740 725 768 5[284 284 512 512 512 512 512 512 512 512 512 512 512 284 341 284 2[398 398 284 4[512 22[597 11[{}70 996.264 /CMR9 rf /Fu 134[824 1[1127 3[616 607 2[780 867 1[434 824 1[434 867 2[694 3[780 12[1127 3[1062 2[1430 2[802 2[1225 1[1062 1192 1127 1[1170 53[910 11[{}22 1594.02 /CMR12 rf /Fv 132[636 566 672 672 919 672 707 495 502 524 672 707 636 707 1061 354 672 389 354 707 636 389 583 707 566 707 619 7[962 1[1316 962 979 886 707 955 956 870 956 996 1208 766 998 1[483 996 1001 801 836 976 919 906 962 1[601 4[354 636 636 636 636 636 636 636 636 636 636 1[354 424 354 2[495 495 24[1061 1[707 707 743 11[{}71 1106.96 /CMBX10 rf /Fw 134[927 1[1277 2[677 1[677 2[877 977 4[478 977 877 1[777 3[877 16[1202 3[1102 76[{}13 1912.83 /CMR17 rf /Fx 136[1533 1[1173 813 825 813 1[1173 1053 1173 1773 1[1113 1[573 1173 2[933 1[933 1[1053 12[1533 1173 6[1322 3[1592 4[1533 67[{}20 2295.84 /CMR17 rf end %%EndProlog %%BeginSetup %%Feature: *Resolution 8000dpi TeXDict begin statusdict /setpageparams known { hsize vsize 0 1 statusdict begin { setpageparams } stopped end } { true } ifelse { statusdict /setpage known { hsize vsize 1 statusdict begin { setpage } stopped pop end } if } if %%EndSetup %%Page: 1 1 1 0 bop 538 23380 a Fx(Ho)-60 b(w)692 b(to)h(Think)g(Lik)-60 b(e)693 b(a)g(Computer)f(Scien)-60 b(tist)21245 34076 y Fw(Learning)579 b(with)e(Python)p eop %%Page: 2 2 2 1 bop 0 -2070 a Fv(ii)p 0 -1627 38191 45 v eop %%Page: 3 3 3 2 bop 538 23380 a Fx(Ho)-60 b(w)692 b(to)h(Think)g(Lik)-60 b(e)693 b(a)g(Computer)f(Scien)-60 b(tist)21245 28076 y Fw(Learning)579 b(with)e(Python)28631 38919 y Fu(Allen)519 b(Do)-43 b(wney)28652 40951 y(Je\256rey)520 b(Elkner)29199 42984 y(Chris)g(Mey)-43 b(ers)26998 52493 y(Green)520 b(T)-130 b(ea)520 b(Press)27153 54659 y Ft(W)-85 b(ellesley)g(,)344 b(Massac)-28 b(h)g(usetts)p eop %%Page: 4 4 4 3 bop 0 865 a Ft(Cop)-28 b(yrigh)g(t)5094 835 y(c)4809 865 y Fs(\260)341 b Ft(2002)h(Allen)g(Do)-28 b(wney)-85 b(,)341 b(Je\256rey)i(Elkner,)f(and)f(Chris)f(Mey)-28 b(ers.)0 2917 y(Edited)342 b(b)-28 b(y)341 b(Shannon)f(T)-85 b(urlington)341 b(and)g(Lisa)g(Cutler.)456 b(Co)-28 b(v)g(er)340 b(design)i(b)-28 b(y)341 b(Reb)28 b(ecca)342 b(Gimenez.)0 4970 y(Prin)-28 b(ting)341 b(history:)0 7060 y Fr(April)394 b(2002:)555 b Ft(First)342 b(edition.)0 10344 y(Green)g(T)-85 b(ea)341 b(Press)0 11586 y(1)g(Gro)-28 b(v)g(e)342 b(St.)0 12828 y(P)-85 b(.O.)342 b(Bo)-28 b(x)341 b(812901)0 14070 y(W)-85 b(ellesley)g(,)344 b(MA)e(02482)0 15717 y(P)-28 b(ermission)477 b(is)g(gran)-28 b(ted)476 b(to)g(cop)-28 b(y)-85 b(,)511 b(distribute,)h(and/or)475 b(mo)28 b(dify)478 b(this)f(do)28 b(cumen)-28 b(t)477 b(under)g(the)0 16959 y(terms)341 b(of)f(the)h(GNU)f(F)-85 b(ree)341 b(Do)28 b(cumen)-28 b(tation)341 b(License,)h(V)-85 b(ersion)340 b(1.1)h(or)f(an)-28 b(y)340 b(later)h(v)-28 b(ersion)340 b(pub-)0 18202 y(lished)276 b(b)-28 b(y)276 b(the)g(F)-85 b(ree)275 b(Soft)-28 b(w)g(are)274 b(F)-85 b(oundation;)298 b(with)275 b(the)h(In)-28 b(v)-57 b(arian)-28 b(t)275 b(Sections)h(b)28 b(eing)276 b(\\F)-85 b(orew)-28 b(ord,")0 19444 y(\\Preface,")490 b(and)459 b(\\Con)-28 b(tributor)458 b(List,")490 b(with)459 b(no)h(F)-85 b(ron)-28 b(t-Co)g(v)g(er)458 b(T)-85 b(exts,)489 b(and)460 b(with)f(no)h(Bac)-28 b(k-)0 20686 y(Co)g(v)g(er)406 b(T)-85 b(exts.)653 b(A)407 b(cop)-28 b(y)407 b(of)g(the)h(license)h(is)e(included)h(in)g(the)g(app)28 b(endix)408 b(en)-28 b(titled)409 b(\\GNU)e(F)-85 b(ree)0 21928 y(Do)28 b(cumen)-28 b(tation)342 b(License.")0 23980 y(The)298 b(GNU)h(F)-85 b(ree)298 b(Do)28 b(cumen)-28 b(tation)300 b(License)f(is)g(a)-28 b(v)-57 b(ailable)300 b(from)e Fq(www.gnu.org)h Ft(or)f(b)-28 b(y)298 b(writing)g(to)0 25222 y(the)381 b(F)-85 b(ree)381 b(Soft)-28 b(w)g(are)379 b(F)-85 b(oundation,)391 b(Inc.,)f(59)381 b(T)-85 b(emple)381 b(Place,)391 b(Suite)382 b(330,)390 b(Boston,)h(MA)381 b(02111-)0 26464 y(1307,)342 b(USA.)0 28516 y(The)331 b(original)g(form)f(of)h(this)g(b)28 b(o)g(ok)331 b(is)g(L)15145 28289 y Fp(A)15587 28516 y Ft(T)16156 28731 y(E)16725 28516 y(X)f(source)h(co)28 b(de.)453 b(Compiling)331 b(this)g(L)30901 28289 y Fp(A)31343 28516 y Ft(T)31912 28731 y(E)32481 28516 y(X)f(source)g(has)0 29758 y(the)342 b(e\256ect)h(of)e(generating)i(a)e(device-indep)28 b(enden)-28 b(t)345 b(represen)-28 b(tation)341 b(of)h(a)f(textb)28 b(o)g(ok,)344 b(whic)-28 b(h)341 b(can)0 31000 y(b)28 b(e)342 b(con)-28 b(v)g(erted)341 b(to)h(other)f(formats)g(and)g(prin) -28 b(ted.)0 33052 y(The)341 b(L)2376 32825 y Fp(A)2818 33052 y Ft(T)3387 33267 y(E)3956 33052 y(X)g(source)g(for)f(this)i(b)28 b(o)g(ok)343 b(is)e(a)-28 b(v)-57 b(ailable)343 b(from)e Fq(http://www.thinkpython.com)0 36705 y Ft(Publisher's)h (Cataloging-in-Publication)h(\(pro)-28 b(vided)341 b(b)-28 b(y)341 b(Qualit)-28 b(y)343 b(Bo)28 b(oks,)343 b(Inc.\))0 38352 y(Do)-28 b(wney)-85 b(,)341 b(Allen)2048 39594 y(Ho)-28 b(w)340 b(to)h(think)i(lik)-28 b(e)342 b(a)f(computer)h(scien) -28 b(tist)342 b(:)456 b(learning)1024 40836 y(with)341 b(Python)h(/)f(Allen)h(Do)-28 b(wney)-85 b(,)341 b(Je\256rey)i(Elkner,) f(Chris)1024 42078 y(Mey)-28 b(ers.)456 b({)341 b(1st)h(ed.)2048 43320 y(p.)455 b(cm.)2048 44562 y(Includes)341 b(index.)2048 45804 y(ISBN)g(0-9716775-0-6)2048 47046 y(LCCN)f(2002100618)2048 49530 y(1.)455 b(Python)342 b(\(Computer)f(program)f(language\))i(I.)f (Elkner,)1024 50772 y(Je\256rey)-85 b(.)456 b(I)28 b(I.)342 b(Mey)-28 b(ers,)342 b(Chris.)455 b(I)28 b(I)g(I.)341 b(Title)1024 53256 y(QA76.73.P98D69)h(2002)5461 b(005.13'3)14335 54498 y(QBI02-200031)p eop %%Page: 5 5 5 4 bop 0 10557 a Fo(F)-258 b(orew)-86 b(ord)0 17110 y Fn(By)369 b(Da)-31 b(vid)370 b(Beazley)0 19235 y(As)449 b(an)h(educator,)471 b(researc)-31 b(her,)468 b(and)450 b(b)31 b(o)g(ok)450 b(author,)471 b(I)449 b(am)h(deligh)-31 b(ted)451 b(to)g(see)d(the)i(com-)0 20590 y(pletion)417 b(of)e(this)h(b)31 b(o)g(ok.)631 b(Python)416 b(is)f(a)g(fun)g(and)h (extremely)g(easy-to-use)g(programming)0 21945 y(language)484 b(that)g(has)e(steadily)h(gained)g(in)g(p)31 b(opularit)-31 b(y)484 b(o)-31 b(v)g(er)482 b(the)h(last)g(few)f(y)-31 b(ears.)832 b(De-)0 23300 y(v)-31 b(elop)31 b(ed)386 b(o)-31 b(v)g(er)386 b(ten)f(y)-31 b(ears)385 b(ago)i(b)-31 b(y)385 b(Guido)g(v)-61 b(an)386 b(Rossum,)j(Python's)d(simple)g(syn) -31 b(tax)387 b(and)0 24655 y(o)-31 b(v)g(erall)299 b(feel)e(is)f (largely)j(deriv)-31 b(ed)297 b(from)g(ABC,)g(a)g(teac)-31 b(hing)299 b(language)g(that)f(w)-31 b(as)297 b(dev)-31 b(elop)31 b(ed)0 26010 y(in)400 b(the)g(1980's.)586 b(Ho)-31 b(w)g(ev)g(er,)409 b(Python)401 b(w)-31 b(as)400 b(also)h(created)e(to) i(solv)-31 b(e)400 b(real)g(problems)g(and)g(it)0 27365 y(b)31 b(orro)-31 b(ws)390 b(a)f(wide)i(v)-61 b(ariet)-31 b(y)390 b(of)g(features)g(from)g(programming)i(languages)f(suc)-31 b(h)390 b(as)f(C++,)0 28720 y(Ja)-31 b(v)-61 b(a,)470 b(Mo)31 b(dula-3,)470 b(and)448 b(Sc)-31 b(heme.)732 b(Because)448 b(of)h(this,)470 b(one)448 b(of)h(Python's)h(most)g (remark-)0 30074 y(able)398 b(features)g(is)g(its)g(broad)g(app)31 b(eal)399 b(to)f(professional)h(soft)-31 b(w)g(are)399 b(dev)-31 b(elop)31 b(ers,)406 b(scien)-31 b(tists,)0 31429 y(researc)g(hers,)368 b(artists,)i(and)g(educators.)0 33554 y(Despite)408 b(Python's)i(app)31 b(eal)409 b(to)g(man)-31 b(y)409 b(di\256eren)-31 b(t)409 b(comm)-31 b(unities,)421 b(y)-31 b(ou)408 b(ma)-31 b(y)410 b(still)f(w)-31 b(onder)0 34909 y(\\wh)g(y)421 b(Python?")644 b(or)419 b(\\wh)-31 b(y)420 b(teac)-31 b(h)421 b(programming)g(with)g(Python?")644 b(Answ)-31 b(ering)420 b(these)0 36264 y(questions)d(is)f(no)g(simple)h (task|esp)31 b(ecially)418 b(when)e(p)31 b(opular)417 b(opinion)h(is)e(on)g(the)g(side)g(of)0 37619 y(more)495 b(maso)31 b(c)-31 b(histic)497 b(alternativ)-31 b(es)497 b(suc)-31 b(h)495 b(as)g(C++)g(and)g(Ja)-31 b(v)-61 b(a.)871 b(Ho)-31 b(w)g(ev)g(er,)528 b(I)495 b(think)h(the)0 38974 y(most)434 b(direct)f(answ)-31 b(er)434 b(is)f(that)h(programming)h(in) f(Python)g(is)f(simply)h(a)g(lot)g(of)g(fun)f(and)0 40329 y(more)369 b(pro)31 b(ductiv)-31 b(e.)0 42454 y(When)499 b(I)h(teac)-31 b(h)500 b(computer)h(science)f(courses,)532 b(I)499 b(w)-31 b(an)g(t)502 b(to)e(co)-31 b(v)g(er)501 b(imp)31 b(ortan)-31 b(t)502 b(concepts)0 43809 y(in)429 b(addition)i(to)f(making)g(the)f(material)i(in)-31 b(teresting)431 b(and)e(engaging)i(to)e(studen)-31 b(ts.)672 b(Un-)0 45164 y(fortunately)-92 b(,)381 b(there)376 b(is)g(a)h(tendency)g(for)f (in)-31 b(tro)31 b(ductory)378 b(programming)g(courses)e(to)h(fo)31 b(cus)0 46519 y(far)501 b(to)31 b(o)502 b(m)-31 b(uc)g(h)501 b(atten)-31 b(tion)504 b(on)d(mathematical)k(abstraction)e(and)e(for)g (studen)-31 b(ts)501 b(to)g(b)31 b(e-)0 47874 y(come)409 b(frustrated)g(with)h(anno)-31 b(ying)410 b(problems)f(related)h(to)f (lo)-31 b(w-lev)g(el)411 b(details)f(of)f(syn)-31 b(tax,)0 49229 y(compilation,)555 b(and)514 b(the)h(enforcemen)-31 b(t)515 b(of)g(seemingly)h(arcane)f(rules.)927 b(Although)516 b(suc)-31 b(h)0 50584 y(abstraction)422 b(and)f(formalism)h(is)f(imp)31 b(ortan)-31 b(t)422 b(to)g(professional)f(soft)-31 b(w)g(are)422 b(engineers)f(and)0 51938 y(studen)-31 b(ts)389 b(who)g(plan)h(to)f (con)-31 b(tin)g(ue)391 b(their)e(study)g(of)g(computer)h(science,)k (taking)c(suc)-31 b(h)389 b(an)0 53293 y(approac)-31 b(h)470 b(in)f(an)h(in)-31 b(tro)31 b(ductory)470 b(course)f(mostly)i (succeeds)d(in)h(making)i(computer)f(sci-)0 54648 y(ence)363 b(b)31 b(oring.)491 b(When)363 b(I)f(teac)-31 b(h)364 b(a)g(course,)g(I)e(don't)j(w)-31 b(an)g(t)365 b(to)e(ha)-31 b(v)g(e)364 b(a)g(ro)31 b(om)363 b(of)h(uninspired)0 56003 y(studen)-31 b(ts.)485 b(I)345 b(w)-31 b(ould)347 b(m)-31 b(uc)g(h)346 b(rather)g(see)f(them)h(trying)h(to)f(solv)-31 b(e)347 b(in)-31 b(teresting)347 b(problems)f(b)-31 b(y)0 57358 y(exploring)350 b(di\256eren)-31 b(t)349 b(ideas,)k(taking)e (uncon)-31 b(v)g(en)g(tional)352 b(approac)-31 b(hes,)354 b(breaking)349 b(the)g(rules,)p eop %%Page: 6 6 6 5 bop 0 -2070 a Fv(vi)31973 b(F)-106 b(orew)-35 b(ord)p 0 -1627 38191 45 v 0 865 a Fn(and)473 b(learning)i(from)e(their)h (mistak)-31 b(es.)805 b(In)473 b(doing)h(so,)500 b(I)472 b(don't)j(w)-31 b(an)g(t)474 b(to)g(w)-31 b(aste)474 b(half)g(of)0 2220 y(the)329 b(semester)g(trying)h(to)g(sort)f(out)g (obscure)g(syn)-31 b(tax)330 b(problems,)338 b(unin)-31 b(telligible)333 b(compiler)0 3575 y(error)421 b(messages,)436 b(or)422 b(the)g(sev)-31 b(eral)423 b(h)-31 b(undred)422 b(w)-31 b(a)g(ys)423 b(that)g(a)g(program)g(migh)-31 b(t)424 b(generate)f(a)0 4930 y(general)370 b(protection)h(fault.)0 7095 y(One)427 b(of)h(the)g(reasons)f(wh)-31 b(y)428 b(I)f(lik)-31 b(e)428 b(Python)h(is)e(that)i(it)f(pro)-31 b(vides)428 b(a)g(really)g(nice)g(balance)0 8450 y(b)31 b(et)-31 b(w)g(een)413 b(the)f(practical)h(and)g(the)f(conceptual.)622 b(Since)412 b(Python)h(is)f(in)-31 b(terpreted,)423 b(b)31 b(egin-)0 9805 y(ners)389 b(can)h(pic)-31 b(k)390 b(up)f(the)h (language)i(and)e(start)g(doing)h(neat)g(things)f(almost)i(immediately) 0 11160 y(without)404 b(getting)g(lost)e(in)g(the)g(problems)g(of)h (compilation)i(and)d(linking.)592 b(F)-92 b(urthermore,)0 12515 y(Python)401 b(comes)g(with)g(a)g(large)g(library)f(of)h(mo)31 b(dules)401 b(that)g(can)f(b)31 b(e)400 b(used)g(to)h(do)f(all)h(sorts) 0 13870 y(of)443 b(tasks)g(ranging)g(from)g(w)-31 b(eb-programming)446 b(to)d(graphics.)713 b(Ha)-31 b(ving)444 b(suc)-31 b(h)442 b(a)h(practical)0 15225 y(fo)31 b(cus)406 b(is)g(a)g(great)g(w)-31 b(a)g(y)408 b(to)e(engage)h(studen)-31 b(ts)406 b(and)h(it)f(allo)-31 b(ws)408 b(them)f(to)f(complete)i(signif-)0 16580 y(ican)-31 b(t)427 b(pro)61 b(jects.)663 b(Ho)-31 b(w)g(ev)g(er,)441 b(Python)427 b(can)f(also)g(serv)-31 b(e)425 b(as)h(an)g(excellen)-31 b(t)427 b(foundation)h(for)0 17934 y(in)-31 b(tro)31 b(ducing)372 b(imp)31 b(ortan)-31 b(t)372 b(computer)f(science)f (concepts.)496 b(Since)370 b(Python)h(fully)h(supp)31 b(orts)0 19289 y(pro)g(cedures)386 b(and)i(classes,)393 b(studen)-31 b(ts)388 b(can)g(b)31 b(e)387 b(gradually)j(in)-31 b(tro)31 b(duced)388 b(to)h(topics)g(suc)-31 b(h)387 b(as)0 20644 y(pro)31 b(cedural)377 b(abstraction,)k(data)d (structures,)g(and)f(ob)61 b(ject-orien)-31 b(ted)379 b(programming|all)0 21999 y(of)293 b(whic)-31 b(h)294 b(are)e(applicable)j(to)e(later)h(courses)d(on)i(Ja)-31 b(v)-61 b(a)293 b(or)g(C++.)467 b(Python)294 b(ev)-31 b(en)293 b(b)31 b(orro)-31 b(ws)293 b(a)0 23354 y(n)-31 b(um)g(b)31 b(er)355 b(of)g(features)g(from)h(functional)h(programming) g(languages)g(and)e(can)g(b)31 b(e)355 b(used)f(to)0 24709 y(in)-31 b(tro)31 b(duce)393 b(concepts)g(that)g(w)-31 b(ould)394 b(b)31 b(e)391 b(co)-31 b(v)g(ered)393 b(in)g(more)f(detail) i(in)f(courses)e(on)i(Sc)-31 b(heme)0 26064 y(and)369 b(Lisp.)0 28229 y(In)381 b(reading)h(Je\256rey's)e(preface,)385 b(I)c(am)h(struc)-31 b(k)381 b(b)-31 b(y)381 b(his)g(commen)-31 b(ts)383 b(that)g(Python)f(allo)-31 b(w)g(ed)0 29584 y(him)304 b(to)g(see)e(a)h(\\higher)h(lev)-31 b(el)305 b(of)e(success)f(and)h(a)h(lo)-31 b(w)g(er)304 b(lev)-31 b(el)304 b(of)g(frustration")h(and)e(that)h(he)0 30939 y(w)-31 b(as)292 b(able)g(to)g(\\mo)-31 b(v)g(e)293 b(faster)f(with)g (b)31 b(etter)292 b(results.")466 b(Although)294 b(these)d(commen)-31 b(ts)293 b(refer)d(to)0 32294 y(his)312 b(in)-31 b(tro)31 b(ductory)314 b(course,)324 b(I)312 b(sometimes)h(use)f(Python)i(for)e (these)h(exact)g(same)g(reasons)f(in)0 33649 y(adv)-61 b(anced)344 b(graduate)i(lev)-31 b(el)345 b(computer)f(science)g (courses)f(at)i(the)f(Univ)-31 b(ersit)g(y)346 b(of)e(Chicago.)0 35004 y(In)475 b(these)g(courses,)502 b(I)475 b(am)h(constan)-31 b(tly)478 b(faced)e(with)g(the)g(daun)-31 b(ting)478 b(task)e(of)g(co)-31 b(v)g(ering)477 b(a)0 36359 y(lot)463 b(of)f(di\261cult)h(course)e(material)j(in)e(a)g(blistering)h(nine)f(w) -31 b(eek)462 b(quarter.)771 b(Although)463 b(it)0 37714 y(is)532 b(certainly)j(p)31 b(ossible)532 b(for)h(me)g(to)g(in\260ict)h (a)f(lot)h(of)f(pain)g(and)g(su\256ering)f(b)-31 b(y)533 b(using)g(a)0 39069 y(language)324 b(lik)-31 b(e)324 b(C++,)332 b(I)322 b(ha)-31 b(v)g(e)323 b(often)g(found)g(this)f (approac)-31 b(h)324 b(to)f(b)31 b(e)321 b(coun)-31 b(terpro)31 b(ductiv)-31 b(e|)0 40423 y(esp)31 b(ecially)354 b(when)e(the)h(course) f(is)g(ab)31 b(out)353 b(a)g(topic)g(unrelated)g(to)h(just)e (\\programming.")490 b(I)0 41778 y(\257nd)434 b(that)i(using)f(Python)h (allo)-31 b(ws)437 b(me)e(to)g(b)31 b(etter)435 b(fo)31 b(cus)434 b(on)h(the)g(actual)h(topic)g(at)g(hand)0 43133 y(while)370 b(allo)-31 b(wing)373 b(studen)-31 b(ts)369 b(to)h(complete)h(substan)-31 b(tial)372 b(class)d(pro)61 b(jects.)0 45298 y(Although)375 b(Python)g(is)e(still)i(a)e(y)-31 b(oung)375 b(and)e(ev)-31 b(olving)376 b(language,)h(I)c(b)31 b(eliev)-31 b(e)374 b(that)g(it)g(has)g(a)0 46653 y(brigh)-31 b(t)370 b(future)f(in)h(education.)494 b(This)370 b(b)31 b(o)g(ok)369 b(is)h(an)f(imp)31 b(ortan)-31 b(t)371 b(step)e(in)h(that) g(direction.)0 50413 y(Da)-31 b(vid)370 b(Beazley)0 51768 y(Univ)-31 b(ersit)g(y)371 b(of)e(Chicago)0 53123 y(Author)h(of)f(the)h Fm(Python)396 b(Essential)g(R)-57 b(efer)g(enc)g(e)p eop %%Page: 7 7 7 6 bop 0 10695 a Fo(Preface)0 17386 y Fn(By)369 b(Je\256)g(Elkner)0 19649 y(This)345 b(b)31 b(o)g(ok)346 b(o)-31 b(w)g(es)346 b(its)g(existence)f(to)h(the)f(collab)31 b(oration)349 b(made)d(p)31 b(ossible)345 b(b)-31 b(y)345 b(the)h(In)-31 b(ternet)0 21004 y(and)389 b(the)g(free)f(soft)-31 b(w)g(are)390 b(mo)-31 b(v)g(emen)g(t.)554 b(Its)388 b(three)h(authors|a)g(college)i (professor,)i(a)c(high)0 22359 y(sc)-31 b(ho)31 b(ol)403 b(teac)-31 b(her,)410 b(and)402 b(a)g(professional)h(programmer|ha)-31 b(v)g(e)404 b(y)-31 b(et)402 b(to)h(meet)f(face)g(to)h(face,)0 23714 y(but)412 b(w)-31 b(e)413 b(ha)-31 b(v)g(e)413 b(b)31 b(een)412 b(able)h(to)g(w)-31 b(ork)413 b(closely)g(together)h (and)e(ha)-31 b(v)g(e)414 b(b)31 b(een)411 b(aided)i(b)-31 b(y)413 b(man)-31 b(y)0 25069 y(w)g(onderful)420 b(folks)f(who)h(ha)-31 b(v)g(e)419 b(donated)h(their)f(time)h(and)f(energy)f(to)i(helping)g (mak)-31 b(e)420 b(this)0 26424 y(b)31 b(o)g(ok)370 b(b)31 b(etter.)0 28687 y(W)-92 b(e)332 b(think)h(this)g(b)31 b(o)g(ok)333 b(is)g(a)f(testamen)-31 b(t)335 b(to)e(the)g(b)31 b(ene\257ts)332 b(and)h(future)f(p)31 b(ossibilities)335 b(of)e(this)0 30041 y(kind)304 b(of)h(collab)31 b(oration,)320 b(the)305 b(framew)-31 b(ork)305 b(for)f(whic)-31 b(h)305 b(has)e(b)31 b(een)304 b(put)g(in)g(place)g(b)-31 b(y)305 b(Ric)-31 b(hard)0 31396 y(Stallman)372 b(and)d(the)h(F)-92 b(ree)368 b(Soft)-31 b(w)g(are)371 b(F)-92 b(oundation.)0 36200 y Fl(Ho)-50 b(w)598 b(and)g(wh)-50 b(y)599 b(I)e(came)h(to)g(use) h(Python)0 38836 y Fn(In)278 b(1999,)299 b(the)279 b(College)h(Board's) f(Adv)-61 b(anced)279 b(Placemen)-31 b(t)281 b(\(AP\))f(Computer)f (Science)g(exam)0 40191 y(w)-31 b(as)412 b(giv)-31 b(en)412 b(in)f(C++)g(for)g(the)g(\257rst)f(time.)619 b(As)411 b(in)g(man)-31 b(y)412 b(high)g(sc)-31 b(ho)31 b(ols)411 b(throughout)i(the)0 41546 y(coun)-31 b(try)-92 b(,)360 b(the)e(decision)f(to)h(c)-31 b(hange)358 b(languages)h(had)e(a)g (direct)g(impact)i(on)e(the)g(computer)0 42901 y(science)513 b(curriculum)h(at)g(Y)-92 b(orkto)-31 b(wn)515 b(High)f(Sc)-31 b(ho)31 b(ol)514 b(in)g(Arlington,)552 b(Virginia,)f(where)513 b(I)0 44256 y(teac)-31 b(h.)860 b(Up)491 b(to)h(this)f(p)31 b(oin)-31 b(t,)524 b(P)-31 b(ascal)492 b(w)-31 b(as)492 b(the)f(language)j(of)d(instruction)i(in)e(b)31 b(oth)492 b(our)0 45611 y(\257rst-y)-31 b(ear)366 b(and)h(AP)f(courses.)491 b(In)366 b(k)-31 b(eeping)367 b(with)g(past)g(practice)g(of)g(giving)h (studen)-31 b(ts)366 b(t)-31 b(w)g(o)0 46966 y(y)g(ears)311 b(of)g(exp)31 b(osure)310 b(to)i(the)f(same)g(language,)325 b(w)-31 b(e)311 b(made)h(the)f(decision)h(to)f(switc)-31 b(h)312 b(to)g(C++)0 48321 y(in)379 b(the)f(\257rst-y)-31 b(ear)379 b(course)f(for)g(the)h(1997-98)i(sc)-31 b(ho)31 b(ol)379 b(y)-31 b(ear)379 b(so)f(that)i(w)-31 b(e)379 b(w)-31 b(ould)379 b(b)31 b(e)378 b(in)h(step)0 49676 y(with)370 b(the)g(College)h(Board's)f(c)-31 b(hange)370 b(for)f(the)h(AP)f(course)g(the)g(follo)-31 b(wing)373 b(y)-31 b(ear.)0 51938 y(Tw)g(o)469 b(y)-31 b(ears)468 b(later,)493 b(I)467 b(w)-31 b(as)468 b(con)-31 b(vinced)469 b(that)g(C++)f(w)-31 b(as)468 b(a)g(p)31 b(o)g(or)467 b(c)-31 b(hoice)469 b(to)f(use)f(for)h(in-)0 53293 y(tro)31 b(ducing)436 b(studen)-31 b(ts)435 b(to)g(computer)g(science.)690 b(While)435 b(it)g(is)g(certainly)h(a)f(v)-31 b(ery)435 b(p)31 b(o)-31 b(w)g(erful)0 54648 y(programming)440 b(language,)458 b(it)439 b(is)f(also)h(an)f(extremely)i(di\261cult)f (language)i(to)d(learn)h(and)0 56003 y(teac)-31 b(h.)509 b(I)374 b(found)h(m)-31 b(yself)375 b(constan)-31 b(tly)377 b(\257gh)-31 b(ting)376 b(with)g(C++'s)f(di\261cult)h(syn)-31 b(tax)375 b(and)g(m)-31 b(ul-)0 57358 y(tiple)431 b(w)-31 b(a)g(ys)431 b(of)f(doing)h(things,)446 b(and)430 b(I)g(w)-31 b(as)430 b(losing)h(man)-31 b(y)431 b(studen)-31 b(ts)430 b(unnecessarily)g(as)g(a)p eop %%Page: 8 8 8 7 bop 0 -2070 a Fv(viii)32321 b(Preface)p 0 -1627 38191 45 v 0 865 a Fn(result.)775 b(Con)-31 b(vinced)465 b(there)e(had)h(to)g (b)31 b(e)463 b(a)h(b)31 b(etter)463 b(language)j(c)-31 b(hoice)464 b(for)g(our)f(\257rst-y)-31 b(ear)0 2220 y(class,)370 b(I)e(w)-31 b(en)g(t)371 b(lo)31 b(oking)371 b(for)e(an)h(alternativ)-31 b(e)372 b(to)e(C++.)0 4406 y(I)335 b(needed)h(a)g(language)i(that)g(w)-31 b(ould)337 b(run)e(on)h(the)h(mac)-31 b(hines)337 b(in)f(our)g(Lin)-31 b(ux)336 b(lab)h(as)f(w)-31 b(ell)337 b(as)0 5761 y(on)268 b(the)g(Windo)-31 b(ws)269 b(and)g(Macin)-31 b(tosh)269 b(platforms)g(most)g(studen)-31 b(ts)268 b(ha)-31 b(v)g(e)269 b(at)g(home.)460 b(I)267 b(w)-31 b(an)g(ted)0 7116 y(it)396 b(to)g(b)31 b(e)394 b(free)h(and)g(a)-31 b(v)-61 b(ailable)398 b(electronically)-92 b(,)405 b(so)395 b(that)h(studen)-31 b(ts)395 b(could)h(use)f(it)g(at)h(home)0 8471 y(regardless)414 b(of)g(their)g(income.)629 b(I)413 b(w)-31 b(an)g(ted)416 b(a)e(language)i(that)f(w)-31 b(as)415 b(used)e(b)-31 b(y)415 b(professional)0 9826 y(programmers,)452 b(and)435 b(one)g(that)i(had)e(an)g(activ)-31 b(e)436 b(dev)-31 b(elop)31 b(er)436 b(comm)-31 b(unit)g(y)437 b(around)e(it.)691 b(It)0 11181 y(had)428 b(to)h(supp)31 b(ort)427 b(b)31 b(oth)429 b(pro)31 b(cedural)428 b(and)g(ob)61 b(ject-orien)-31 b(ted)430 b(programming.)671 b(And)428 b(most)0 12536 y(imp)31 b(ortan)-31 b(tly)-92 b(,)537 b(it)502 b(had)f(to)h(b)31 b(e)501 b(easy)g(to)h(learn)f(and)g(teac)-31 b(h.)890 b(When)500 b(I)h(in)-31 b(v)g(estigated)504 b(the)0 13891 y(c)-31 b(hoices)444 b(with)i(these)d(goals)j(in)e(mind,)464 b(Python)445 b(sto)31 b(o)g(d)444 b(out)h(as)f(the)g(b)31 b(est)443 b(candidate)j(for)0 15245 y(the)369 b(job.)0 17431 y(I)475 b(ask)-31 b(ed)476 b(one)g(of)g(Y)-92 b(orkto)-31 b(wn's)478 b(talen)-31 b(ted)478 b(studen)-31 b(ts,)503 b(Matt)476 b(Ahrens,)502 b(to)477 b(giv)-31 b(e)477 b(Python)g(a)0 18786 y(try)-92 b(.)569 b(In)395 b(t)-31 b(w)g(o)396 b(mon)-31 b(ths)396 b(he)f(not)g(only)h(learned)f(the)g(language)i(but) e(wrote)h(an)f(application)0 20141 y(called)486 b(p)-31 b(yTic)g(k)g(et)486 b(that)g(enabled)f(our)f(sta\256)h(to)g(rep)31 b(ort)484 b(tec)-31 b(hnology)487 b(problems)d(via)i(the)0 21496 y(W)-92 b(eb.)828 b(I)480 b(knew)i(that)g(Matt)g(could)g(not)g (ha)-31 b(v)g(e)482 b(\257nished)f(an)g(application)k(of)c(that)i (scale)0 22851 y(in)f(so)g(short)g(a)h(time)g(in)f(C++,)511 b(and)483 b(this)f(accomplishmen)-31 b(t,)514 b(com)-31 b(bined)484 b(with)f(Matt's)0 24206 y(p)31 b(ositiv)-31 b(e)455 b(assessmen)-31 b(t)454 b(of)h(Python,)477 b(suggested)454 b(that)h(Python)g(w)-31 b(as)455 b(the)f(solution)i(I)d(w)-31 b(as)0 25561 y(lo)31 b(oking)371 b(for.)0 30134 y Fl(Finding)599 b(a)e(textb)50 b(o)g(ok)0 32662 y Fn(Ha)-31 b(ving)510 b(decided)f(to)g(use)f(Python)i(in)e(b)31 b(oth)509 b(of)g(m)-31 b(y)509 b(in)-31 b(tro)31 b(ductory)510 b(computer)f(science)0 34017 y(classes)283 b(the)h(follo)-31 b(wing)287 b(y)-31 b(ear,)301 b(the)284 b(most)g(pressing)f(problem)h(w)-31 b(as)284 b(the)g(lac)-31 b(k)285 b(of)f(an)f(a)-31 b(v)-61 b(ailable)0 35372 y(textb)31 b(o)g(ok.)0 37558 y(F)-92 b(ree)495 b(con)-31 b(ten)g(t)497 b(came)g(to)f(the)g(rescue.)872 b(Earlier)496 b(in)h(the)f(y)-31 b(ear,)528 b(Ric)-31 b(hard)496 b(Stallman)j(had)0 38913 y(in)-31 b(tro)31 b(duced)375 b(me)g(to)h(Allen)f(Do)-31 b(wney)-92 b(.)510 b(Both)376 b(of)f(us)f(had)h(written)h(to)f(Ric)-31 b(hard)375 b(expressing)0 40268 y(an)i(in)-31 b(terest)378 b(in)g(dev)-31 b(eloping)379 b(free)e(educational)j(con)-31 b(ten)g(t.)518 b(Allen)378 b(had)g(already)g(written)h(a)0 41623 y(\257rst-y)-31 b(ear)350 b(computer)g(science)g(textb)31 b(o)g(ok,)355 b Fm(How)378 b(to)f(Think)i(Like)h(a)e(Computer)f(Scientist)p Fn(.)0 42978 y(When)531 b(I)g(read)g(this)h(b)31 b(o)g(ok,)573 b(I)531 b(knew)h(immediately)j(that)e(I)e(w)-31 b(an)g(ted)533 b(to)f(use)f(it)h(in)g(m)-31 b(y)0 44333 y(class.)490 b(It)360 b(w)-31 b(as)361 b(the)g(clearest)g(and)g(most)g(helpful)g (computer)g(science)g(text)g(I)f(had)h(seen.)489 b(It)0 45688 y(emphasized)397 b(the)f(pro)31 b(cesses)394 b(of)j(though)-31 b(t)398 b(in)-31 b(v)g(olv)g(ed)398 b(in)e(programming)i(rather)e(than) h(the)0 47043 y(features)476 b(of)f(a)h(particular)h(language.)813 b(Reading)477 b(it)f(immediately)j(made)d(me)f(a)h(b)31 b(etter)0 48398 y(teac)-31 b(her.)0 50584 y Fm(How)385 b(to)h(Think)h(Like)h(a)e(Computer)g(Scientist)359 b Fn(w)-31 b(as)360 b(not)f(just)g(an)f(excellen)-31 b(t)361 b(b)31 b(o)g(ok,)361 b(but)e(it)0 51938 y(had)437 b(b)31 b(een)435 b(released)i(under)e(a)i(GNU)f(public)h(license,)454 b(whic)-31 b(h)438 b(mean)-31 b(t)437 b(it)h(could)f(b)31 b(e)436 b(used)0 53293 y(freely)315 b(and)f(mo)31 b(di\257ed)316 b(to)f(meet)g(the)g(needs)f(of)h(its)g(user.)473 b(Once)314 b(I)g(decided)h(to)g(use)f(Python,)0 54648 y(it)e(o)31 b(ccurred)309 b(to)j(me)f(that)h(I)e(could)i(translate)g(Allen's)g (original)h(Ja)-31 b(v)-61 b(a)311 b(v)-31 b(ersion)311 b(of)g(the)g(b)31 b(o)g(ok)0 56003 y(in)-31 b(to)409 b(the)f(new)f(language.)610 b(While)408 b(I)f(w)-31 b(ould)408 b(not)h(ha)-31 b(v)g(e)408 b(b)31 b(een)407 b(able)h(to)g(write)h(a)e (textb)31 b(o)g(ok)0 57358 y(on)348 b(m)-31 b(y)348 b(o)-31 b(wn,)354 b(ha)-31 b(ving)349 b(Allen's)f(b)31 b(o)g(ok)349 b(to)f(w)-31 b(ork)348 b(from)g(made)h(it)f(p)31 b(ossible)348 b(for)f(me)h(to)h(do)f(so,)p eop %%Page: 9 9 9 8 bop 37165 -2070 a Fv(ix)p 0 -1627 38191 45 v 0 865 a Fn(at)392 b(the)g(same)f(time)i(demonstrating)g(that)g(the)f(co)31 b(op)g(erativ)-31 b(e)393 b(dev)-31 b(elopmen)g(t)393 b(mo)31 b(del)393 b(used)0 2220 y(so)369 b(w)-31 b(ell)371 b(in)e(soft)-31 b(w)g(are)371 b(could)f(also)g(w)-31 b(ork)370 b(for)f(educational)j(con)-31 b(ten)g(t.)0 4310 y(W)-92 b(orking)452 b(on)g(this)g(b)31 b(o)g(ok)453 b(for)f(the)g(last)g(t)-31 b(w)g(o)454 b(y)-31 b(ears)451 b(has)h(b)31 b(een)451 b(rew)-31 b(arding)453 b(for)f(b)31 b(oth)452 b(m)-31 b(y)0 5665 y(studen)g(ts)475 b(and)f(me,)502 b(and)474 b(m)-31 b(y)475 b(studen)-31 b(ts)475 b(pla)-31 b(y)g(ed)476 b(a)f(big)g(part)f(in)h(the)g(pro)31 b(cess.)807 b(Since)474 b(I)0 7019 y(could)316 b(mak)-31 b(e)316 b(instan)-31 b(t)317 b(c)-31 b(hanges)316 b(whenev)-31 b(er)315 b(someone)h(found)g(a)g(sp)31 b(elling)316 b(error)e(or)h (di\261cult)0 8374 y(passage,)405 b(I)397 b(encouraged)h(them)g(to)g (lo)31 b(ok)398 b(for)g(mistak)-31 b(es)398 b(in)g(the)f(b)31 b(o)g(ok)398 b(b)-31 b(y)398 b(giving)h(them)f(a)0 9729 y(b)31 b(on)-31 b(us)374 b(p)31 b(oin)-31 b(t)375 b(eac)-31 b(h)374 b(time)h(they)f(made)h(a)f(suggestion)h(that)g(resulted)f(in)g (a)g(c)-31 b(hange)375 b(in)f(the)0 11084 y(text.)687 b(This)434 b(had)g(the)g(double)h(b)31 b(ene\257t)434 b(of)g(encouraging)h(them)g(to)f(read)g(the)g(text)h(more)0 12439 y(carefully)505 b(and)f(of)h(getting)h(the)e(text)h(thoroughly)h (review)-31 b(ed)504 b(b)-31 b(y)505 b(its)f(most)h(imp)31 b(ortan)-31 b(t)0 13794 y(critics,)370 b(studen)-31 b(ts)369 b(using)h(it)g(to)g(learn)f(computer)h(science.)0 15884 y(F)-92 b(or)423 b(the)i(second)f(half)h(of)g(the)f(b)31 b(o)g(ok)425 b(on)f(ob)61 b(ject-orien)-31 b(ted)427 b(programming,)440 b(I)424 b(knew)h(that)0 17239 y(someone)416 b(with)g(more)f(real)g(programming)i(exp)31 b(erience)414 b(than)i(I)e(had)h(w)-31 b(ould)416 b(b)31 b(e)414 b(needed)0 18593 y(to)366 b(do)f(it)h(righ)-31 b(t.)493 b(The)365 b(b)31 b(o)g(ok)366 b(sat)g(in)f(an)h(un\257nished)f(state)h(for)f(the) h(b)31 b(etter)365 b(part)g(of)h(a)g(y)-31 b(ear)0 19948 y(un)g(til)335 b(the)e(free)g(soft)-31 b(w)g(are)335 b(comm)-31 b(unit)g(y)336 b(once)e(again)h(pro)-31 b(vided)334 b(the)f(needed)g(means)h(for)g(its)0 21303 y(completion.)0 23393 y(I)295 b(receiv)-31 b(ed)295 b(an)g(email)i(from)f(Chris)f(Mey) -31 b(ers)294 b(expressing)h(in)-31 b(terest)296 b(in)g(the)f(b)31 b(o)g(ok.)468 b(Chris)296 b(is)f(a)0 24748 y(professional)384 b(programmer)g(who)g(started)g(teac)-31 b(hing)385 b(a)f(programming)h (course)e(last)h(y)-31 b(ear)0 26103 y(using)467 b(Python)h(at)g(Lane)f (Comm)-31 b(unit)g(y)470 b(College)f(in)e(Eugene,)492 b(Oregon.)786 b(The)467 b(prosp)31 b(ect)0 27458 y(of)452 b(teac)-31 b(hing)453 b(the)f(course)f(had)g(led)h(Chris)f(to)h(the)g (b)31 b(o)g(ok,)473 b(and)452 b(he)f(started)h(helping)g(out)0 28813 y(with)343 b(it)f(immediately)-92 b(.)487 b(By)342 b(the)g(end)f(of)i(the)f(sc)-31 b(ho)31 b(ol)342 b(y)-31 b(ear)342 b(he)g(had)g(created)g(a)g(companion)0 30167 y(pro)61 b(ject)292 b(on)g(our)f(W)-92 b(ebsite)291 b(at)h Fk(http://www.ibiblio.org/obp)j Fn(called)e Fm(Python)325 b(for)f(F)-85 b(un)0 31522 y Fn(and)344 b(w)-31 b(as)345 b(w)-31 b(orking)345 b(with)g(some)g(of)f(m)-31 b(y)345 b(most)f(adv)-61 b(anced)345 b(studen)-31 b(ts)344 b(as)f(a)i(master)f (teac)-31 b(her,)0 32877 y(guiding)371 b(them)f(b)31 b(ey)-31 b(ond)369 b(where)g(I)g(could)h(tak)-31 b(e)370 b(them.)0 37282 y Fl(In)-50 b(tro)50 b(ducing)599 b(programming)g(with) f(Python)0 39705 y Fn(The)401 b(pro)31 b(cess)399 b(of)j(translating)h (and)e(using)g Fm(How)424 b(to)g(Think)i(Like)g(a)f(Computer)g (Scientist)0 41060 y Fn(for)322 b(the)g(past)h(t)-31 b(w)g(o)323 b(y)-31 b(ears)322 b(has)g(con\257rmed)g(Python's)h (suitabilit)-31 b(y)326 b(for)c(teac)-31 b(hing)324 b(b)31 b(eginning)0 42415 y(studen)-31 b(ts.)667 b(Python)429 b(greatly)g(simpli\257es)f(programming)h(examples)g(and)e(mak)-31 b(es)428 b(imp)31 b(or-)0 43770 y(tan)-31 b(t)371 b(programming)g (ideas)f(easier)f(to)h(teac)-31 b(h.)0 45860 y(The)291 b(\257rst)f(example)j(from)e(the)g(text)h(illustrates)h(this)e(p)31 b(oin)-31 b(t.)468 b(It)291 b(is)f(the)i(traditional)i(\\hello,)0 47215 y(w)-31 b(orld")371 b(program,)f(whic)-31 b(h)370 b(in)g(the)f(C++)h(v)-31 b(ersion)369 b(of)h(the)f(b)31 b(o)g(ok)370 b(lo)31 b(oks)370 b(lik)-31 b(e)371 b(this:)1743 48899 y Fk(#include)583 b()1743 51609 y(void)f(main\(\)) 1743 52964 y({)2906 54319 y(cout)f(<<)h("Hello,)g(world.")g(<<)g(endl;) 1743 55674 y(})0 57358 y Fn(in)369 b(the)h(Python)g(v)-31 b(ersion)370 b(it)g(b)31 b(ecomes:)p eop %%Page: 10 10 10 9 bop 0 -2070 a Fv(x)33383 b(Preface)p 0 -1627 38191 45 v 1743 865 a Fk(print)582 b("Hello,)h(World!")0 2829 y Fn(Ev)-31 b(en)521 b(though)g(this)f(is)g(a)h(trivial)h(example,)559 b(the)521 b(adv)-61 b(an)-31 b(tages)521 b(of)g(Python)g(stand)g(out.)0 4184 y(Y)-92 b(orkto)-31 b(wn's)522 b(Computer)g(Science)e(I)g(course)g (has)g(no)h(prerequisites,)558 b(so)520 b(man)-31 b(y)522 b(of)f(the)0 5539 y(studen)-31 b(ts)403 b(seeing)h(this)g(example)g (are)f(lo)31 b(oking)406 b(at)e(their)f(\257rst)g(program.)596 b(Some)403 b(of)h(them)0 6894 y(are)411 b(undoubtedly)i(a)e(little)i (nerv)-31 b(ous,)422 b(ha)-31 b(ving)413 b(heard)e(that)i(computer)f (programming)h(is)0 8249 y(di\261cult)463 b(to)f(learn.)769 b(The)461 b(C++)h(v)-31 b(ersion)461 b(has)g(alw)-31 b(a)g(ys)464 b(forced)d(me)g(to)h(c)-31 b(ho)31 b(ose)462 b(b)31 b(et)-31 b(w)g(een)0 9604 y(t)g(w)g(o)368 b(unsatisfying)h (options:)492 b(either)367 b(to)g(explain)h(the)f Fk(#include)p Fn(,)h Fk(void)582 b(main\(\))p Fn(,)368 b Fj(f)p Fn(,)g(and)0 10959 y Fj(g)439 b Fn(statemen)-31 b(ts)441 b(and)f(risk)e(confusing)j (or)e(in)-31 b(timidating)443 b(some)d(of)f(the)h(studen)-31 b(ts)439 b(righ)-31 b(t)440 b(at)0 12313 y(the)352 b(start,)357 b(or)352 b(to)g(tell)i(them,)i(\\Just)d(don't)g(w)-31 b(orry)352 b(ab)31 b(out)353 b(all)h(of)e(that)i(stu\256)d(no)-31 b(w;)360 b(w)-31 b(e)352 b(will)0 13668 y(talk)485 b(ab)31 b(out)485 b(it)g(later,")515 b(and)484 b(risk)g(the)g(same)g(thing.)838 b(The)485 b(educational)h(ob)61 b(jectiv)-31 b(es)486 b(at)0 15023 y(this)354 b(p)31 b(oin)-31 b(t)354 b(in)f(the)h(course)e (are)h(to)h(in)-31 b(tro)31 b(duce)354 b(studen)-31 b(ts)353 b(to)h(the)g(idea)g(of)f(a)h(programming)0 16378 y(statemen)-31 b(t)502 b(and)e(to)h(get)g(them)g(to)g(write)g(their)f(\257rst)g (program,)534 b(thereb)-31 b(y)500 b(in)-31 b(tro)31 b(ducing)0 17733 y(them)333 b(to)g(the)g(programming)h(en)-31 b(vironmen)g(t.)482 b(The)333 b(Python)g(program)h(has)e(exactly)i (what)0 19088 y(is)369 b(needed)g(to)h(do)f(these)g(things,)i(and)e (nothing)i(more.)0 21457 y(Comparing)495 b(the)e(explanatory)i(text)f (of)g(the)f(program)h(in)f(eac)-31 b(h)493 b(v)-31 b(ersion)494 b(of)f(the)g(b)31 b(o)g(ok)0 22812 y(further)313 b(illustrates)j(what)f (this)f(means)g(to)h(the)f(b)31 b(eginning)315 b(studen)-31 b(t.)475 b(There)314 b(are)f(thirteen)0 24167 y(paragraphs)303 b(of)h(explanation)h(of)f(\\Hello,)318 b(w)-31 b(orld!")472 b(in)303 b(the)h(C++)f(v)-31 b(ersion;)325 b(in)304 b(the)f(Python)0 25522 y(v)-31 b(ersion,)445 b(there)430 b(are)f(only)h(t)-31 b(w)g(o.)676 b(More)429 b(imp)31 b(ortan)-31 b(tly)-92 b(,)447 b(the)430 b(missing)g(elev)-31 b(en)431 b(paragraphs)0 26877 y(do)361 b(not)h(deal)f(with)i(the)e(\\big)h(ideas")g(in)f (computer)g(programming)j(but)d(with)h(the)f(min)-31 b(u-)0 28232 y(tia)439 b(of)g(C++)f(syn)-31 b(tax.)700 b(I)437 b(found)i(this)f(same)g(thing)h(happ)31 b(ening)439 b(throughout)h(the)e(b)31 b(o)g(ok.)0 29587 y(Whole)280 b(paragraphs)g(simply)h(disapp)31 b(ear)280 b(from)g(the)g(Python)h(v) -31 b(ersion)280 b(of)h(the)f(text)g(b)31 b(ecause)0 30941 y(Python's)371 b(m)-31 b(uc)g(h)370 b(clearer)f(syn)-31 b(tax)370 b(renders)d(them)j(unnecessary)-92 b(.)0 33310 y(Using)259 b(a)f(v)-31 b(ery)259 b(high-lev)-31 b(el)260 b(language)g(lik)-31 b(e)260 b(Python)f(allo)-31 b(ws)261 b(a)d(teac)-31 b(her)259 b(to)g(p)31 b(ostp)g(one)258 b(talking)0 34665 y(ab)31 b(out)371 b(lo)-31 b(w-lev)g(el)373 b(details)e(of)g(the)f(mac)-31 b(hine)372 b(un)-31 b(til)371 b(studen)-31 b(ts)370 b(ha)-31 b(v)g(e)371 b(the)f(bac)-31 b(kground)372 b(that)0 36020 y(they)365 b(need)f(to)h(b)31 b(etter)365 b(mak)-31 b(e)366 b(sense)d(of)i(the)g(details.)492 b(It)365 b(th)-31 b(us)364 b(creates)h(the)f(abilit)-31 b(y)367 b(to)f(put)0 37375 y(\\\257rst)347 b(things)h(\257rst")f(p)31 b(edagogically)-92 b(.)488 b(One)347 b(of)h(the)f(b)31 b(est)347 b(examples)h(of)f(this)h(is)f(the)g(w)-31 b(a)g(y)349 b(in)0 38730 y(whic)-31 b(h)387 b(Python)g(handles)f(v)-61 b(ariables.)543 b(In)385 b(C++)h(a)g(v)-61 b(ariable)386 b(is)g(a)g(name)g(for)g(a)g(place)h(that)0 40085 y(holds)343 b(a)h(thing.)485 b(V)-92 b(ariables)344 b(ha)-31 b(v)g(e)344 b(to)g(b)31 b(e)343 b(declared)g(with)h(t)-31 b(yp)31 b(es)344 b(at)g(least)g(in)f(part)g(b)31 b(ecause)0 41440 y(the)390 b(size)g(of)h(the)f(place)h(to)f(whic)-31 b(h)391 b(they)g(refer)e(needs)g(to)i(b)31 b(e)390 b(predetermined.)555 b(Th)-31 b(us,)396 b(the)0 42795 y(idea)355 b(of)f(a)g(v)-61 b(ariable)355 b(is)f(b)31 b(ound)354 b(up)g(with)h(the)f(hardw)-31 b(are)355 b(of)f(the)g(mac)-31 b(hine.)489 b(The)355 b(p)31 b(o)-31 b(w)g(erful)0 44150 y(and)365 b(fundamen)-31 b(tal)368 b(concept)d(of)h(a)f(v)-61 b(ariable)366 b(is)f(already)h (di\261cult)h(enough)e(for)h(b)31 b(eginning)0 45505 y(studen)-31 b(ts)421 b(\(in)g(b)31 b(oth)422 b(computer)f(science)g (and)g(algebra\).)649 b(Bytes)421 b(and)g(addresses)e(do)i(not)0 46860 y(help)438 b(the)g(matter.)701 b(In)437 b(Python)i(a)g(v)-61 b(ariable)439 b(is)f(a)g(name)g(that)i(refers)c(to)j(a)f(thing.)701 b(This)0 48215 y(is)359 b(a)h(far)g(more)g(in)-31 b(tuitiv)g(e)362 b(concept)e(for)g(b)31 b(eginning)361 b(studen)-31 b(ts)360 b(and)f(is)h(m)-31 b(uc)g(h)360 b(closer)f(to)i(the)0 49570 y(meaning)d(of)f(\\v)-61 b(ariable")358 b(that)f(they)g(learned)f (in)h(their)f(math)i(courses.)487 b(I)356 b(had)g(m)-31 b(uc)g(h)357 b(less)0 50924 y(di\261cult)-31 b(y)463 b(teac)-31 b(hing)463 b(v)-61 b(ariables)462 b(this)g(y)-31 b(ear)461 b(than)h(I)e(did)i(in)f(the)h(past,)484 b(and)462 b(I)e(sp)31 b(en)-31 b(t)461 b(less)0 52279 y(time)370 b(helping)h(studen)-31 b(ts)369 b(with)i(problems)e(using)h(them.)0 54648 y(Another)375 b(example)g(of)g(ho)-31 b(w)375 b(Python)g(aids)f (in)h(the)f(teac)-31 b(hing)376 b(and)e(learning)i(of)e(program-)0 56003 y(ming)413 b(is)g(in)f(its)h(syn)-31 b(tax)413 b(for)f(functions.)623 b(My)412 b(studen)-31 b(ts)413 b(ha)-31 b(v)g(e)413 b(alw)-31 b(a)g(ys)414 b(had)f(a)f(great)h(deal)0 57358 y(of)504 b(di\261cult)-31 b(y)505 b(understanding)g(functions.) 896 b(The)503 b(main)i(problem)f(cen)-31 b(ters)503 b(around)h(the)p eop %%Page: 11 11 11 10 bop 37165 -2070 a Fv(xi)p 0 -1627 38191 45 v 0 865 a Fn(di\256erence)331 b(b)31 b(et)-31 b(w)g(een)333 b(a)f(function)h(de\257nition)g(and)f(a)g(function)h(call,)341 b(and)332 b(the)g(related)g(dis-)0 2220 y(tinction)456 b(b)31 b(et)-31 b(w)g(een)454 b(a)g(parameter)h(and)f(an)f(argumen)-31 b(t.)748 b(Python)455 b(comes)f(to)g(the)g(rescue)0 3575 y(with)388 b(syn)-31 b(tax)389 b(that)f(is)f(nothing)i(short)e(of)h(b) 31 b(eautiful.)548 b(F)-92 b(unction)388 b(de\257nitions)g(b)31 b(egin)388 b(with)0 4930 y(the)450 b(k)-31 b(eyw)g(ord)451 b Fk(def)p Fn(,)471 b(so)450 b(I)f(simply)i(tell)g(m)-31 b(y)450 b(studen)-31 b(ts,)471 b(\\When)450 b(y)-31 b(ou)450 b(de\257ne)g(a)g(function,)0 6285 y(b)31 b(egin)493 b(with)h Fk(def)p Fn(,)524 b(follo)-31 b(w)g(ed)496 b(b)-31 b(y)493 b(the)g(name)g(of)g(the)g(function)h(that)g(y)-31 b(ou)493 b(are)g(de\257ning;)0 7640 y(when)531 b(y)-31 b(ou)531 b(call)g(a)g(function,)573 b(simply)531 b(call)h(\(t)-31 b(yp)31 b(e\))531 b(out)h(its)e(name.")978 b(P)-31 b(arameters)531 b(go)0 8995 y(with)328 b(de\257nitions;)343 b(argumen)-31 b(ts)328 b(go)f(with)h(calls.)480 b(There)326 b(are)h(no)g(return)f(t) -31 b(yp)31 b(es,)336 b(parameter)0 10350 y(t)-31 b(yp)31 b(es,)459 b(or)440 b(reference)g(and)g(v)-61 b(alue)441 b(parameters)g(to)g(get)g(in)g(the)g(w)-31 b(a)g(y)-92 b(,)459 b(so)441 b(I)f(am)h(no)-31 b(w)441 b(able)0 11705 y(to)j(teac)-31 b(h)443 b(functions)h(in)f(less)f(than)i(half)g(the)f (time)h(that)g(it)f(previously)h(to)31 b(ok)444 b(me,)462 b(with)0 13059 y(b)31 b(etter)369 b(comprehension.)0 15225 y(Using)397 b(Python)i(has)d(impro)-31 b(v)g(ed)399 b(the)e(e\256ectiv)-31 b(eness)397 b(of)g(our)g(computer)g(science)g (program)0 16580 y(for)517 b(all)g(studen)-31 b(ts.)935 b(I)516 b(see)f(a)i(higher)g(general)g(lev)-31 b(el)518 b(of)f(success)e(and)h(a)h(lo)-31 b(w)g(er)518 b(lev)-31 b(el)517 b(of)0 17934 y(frustration)290 b(than)g(I)e(exp)31 b(erienced)289 b(during)g(the)g(t)-31 b(w)g(o)291 b(y)-31 b(ears)289 b(I)f(taugh)-31 b(t)291 b(C++.)466 b(I)288 b(mo)-31 b(v)g(e)291 b(faster)0 19289 y(with)442 b(b)31 b(etter)440 b(results.)707 b(More)440 b(studen)-31 b(ts)441 b(lea)-31 b(v)g(e)442 b(the)e(course)g(with)i(the)f(abilit)-31 b(y)443 b(to)f(create)0 20644 y(meaningful)452 b(programs)e(and)g(with) h(the)f(p)31 b(ositiv)-31 b(e)452 b(attitude)f(to)-31 b(w)g(ard)452 b(the)e(exp)31 b(erience)449 b(of)0 21999 y(programming)371 b(that)g(this)e(engenders.)0 26510 y Fl(Building)598 b(a)g(comm)-50 b(unit)g(y)0 29009 y Fn(I)472 b(ha)-31 b(v)g(e)474 b(receiv)-31 b(ed)473 b(email)i(from)e (all)h(o)-31 b(v)g(er)474 b(the)f(glob)31 b(e)474 b(from)f(p)31 b(eople)473 b(using)h(this)f(b)31 b(o)g(ok)473 b(to)0 30364 y(learn)423 b(or)g(to)h(teac)-31 b(h)424 b(programming.)657 b(A)423 b(user)f(comm)-31 b(unit)g(y)426 b(has)d(b)31 b(egun)423 b(to)h(emerge,)438 b(and)0 31719 y(man)-31 b(y)389 b(p)31 b(eople)388 b(ha)-31 b(v)g(e)389 b(b)31 b(een)387 b(con)-31 b(tributing)390 b(to)e(the)g(pro)61 b(ject)389 b(b)-31 b(y)387 b(sending)h(in)g(materials)i(for)0 33074 y(the)369 b(companion)j(W)-92 b(ebsite)369 b(at)h Fk(http://www.thinkpython.com)p Fn(.)0 35239 y(With)350 b(the)f(publication)j(of)e(the)f(b)31 b(o)g(ok)350 b(in)g(prin)-31 b(t)349 b(form,)355 b(I)348 b(exp)31 b(ect)350 b(the)f(gro)-31 b(wth)351 b(in)e(the)h(user)0 36594 y(comm)-31 b(unit)g(y)388 b(to)e(con)-31 b(tin)g(ue)387 b(and)f(accelerate.)542 b(The)386 b(emergence)f(of)h(this)g(user)e(comm)-31 b(unit)g(y)0 37949 y(and)438 b(the)f(p)31 b(ossibilit)-31 b(y)440 b(it)e(suggests)g(for)f(similar)i(collab)31 b(oration)441 b(among)e(educators)f(ha)-31 b(v)g(e)0 39303 y(b)31 b(een)474 b(the)h(most)g(exciting)i(parts)d(of)h(w)-31 b(orking)477 b(on)d(this)h(pro)61 b(ject)476 b(for)e(me.)809 b(By)475 b(w)-31 b(orking)0 40658 y(together,)351 b(w)-31 b(e)345 b(can)g(increase)f(the)h(qualit)-31 b(y)347 b(of)e(materials)h(a)-31 b(v)-61 b(ailable)347 b(for)e(our)f(use)g(and)g(sa)-31 b(v)g(e)0 42013 y(v)-61 b(aluable)382 b(time.)528 b(I)381 b(in)-31 b(vite)382 b(y)-31 b(ou)381 b(to)h(join)f(our)g(comm)-31 b(unit)g(y)383 b(and)e(lo)31 b(ok)382 b(forw)-31 b(ard)382 b(to)f(hearing)0 43368 y(from)370 b(y)-31 b(ou.)493 b(Please)370 b(write)g(to)g(the)f(authors)h(at)g Fk(feedback@thinkpython.com)p Fn(.)0 47128 y(Je\256rey)e(Elkner)0 48483 y(Y)-92 b(orkto)-31 b(wn)371 b(High)f(Sc)-31 b(ho)31 b(ol)0 49838 y(Arlington,)372 b(Virginia)p eop %%Page: 12 12 12 11 bop 0 -2070 a Fv(xii)32675 b(Preface)p 0 -1627 38191 45 v eop %%Page: 13 13 13 12 bop 0 10514 a Fo(Con)-86 b(tributor)1034 b(List)0 17023 y Fn(T)-92 b(o)506 b(paraphrase)f(the)h(philosoph)-31 b(y)507 b(of)e(the)h(F)-92 b(ree)504 b(Soft)-31 b(w)g(are)507 b(F)-92 b(oundation,)542 b(this)505 b(b)31 b(o)g(ok)506 b(is)0 18378 y(free)514 b(lik)-31 b(e)515 b(free)f(sp)31 b(eec)-31 b(h,)550 b(but)514 b(not)h(necessarily)g(free)e(lik)-31 b(e)516 b(free)e(pizza.)928 b(It)514 b(came)h(ab)31 b(out)0 19733 y(b)g(ecause)348 b(of)i(a)f(collab)31 b(oration)352 b(that)e(w)-31 b(ould)350 b(not)g(ha)-31 b(v)g(e)350 b(b)31 b(een)348 b(p)31 b(ossible)349 b(without)i(the)e(GNU)0 21088 y(F)-92 b(ree)539 b(Do)31 b(cumen)-31 b(tation)544 b(License.)1006 b(So)541 b(w)-31 b(e)542 b(w)-31 b(ould)542 b(lik)-31 b(e)542 b(to)f(thank)h(the)f(F)-92 b(ree)539 b(Soft)-31 b(w)g(are)0 22443 y(F)-92 b(oundation)353 b(for)f(dev)-31 b(eloping)355 b(this)d(license)g(and,)k(of)d(course,)i (making)f(it)f(a)-31 b(v)-61 b(ailable)354 b(to)f(us.)0 24524 y(W)-92 b(e)248 b(w)-31 b(ould)250 b(also)f(lik)-31 b(e)250 b(to)f(thank)h(the)f(more)f(than)i(100)g(sharp-ey)-31 b(ed)248 b(and)h(though)-31 b(tful)251 b(readers)0 25879 y(who)446 b(ha)-31 b(v)g(e)446 b(sen)-31 b(t)445 b(us)f(suggestions)i (and)g(corrections)f(o)-31 b(v)g(er)446 b(the)f(past)g(few)h(y)-31 b(ears.)720 b(In)445 b(the)0 27234 y(spirit)511 b(of)g(free)f(soft)-31 b(w)g(are,)548 b(w)-31 b(e)511 b(decided)g(to)g(express)e(our)i (gratitude)h(in)f(the)g(form)g(of)g(a)0 28589 y(con)-31 b(tributor)406 b(list.)600 b(Unfortunately)-92 b(,)416 b(this)405 b(list)g(is)g(not)g(complete,)416 b(but)405 b(w)-31 b(e)405 b(are)f(doing)i(our)0 29944 y(b)31 b(est)369 b(to)h(k)-31 b(eep)369 b(it)h(up)f(to)h(date.)0 32025 y(If)288 b(y)-31 b(ou)289 b(ha)-31 b(v)g(e)290 b(a)e(c)-31 b(hance)289 b(to)g(lo)31 b(ok)290 b(through)f(the)f(list,)306 b(y)-31 b(ou)289 b(should)g(realize)g(that)h(eac)-31 b(h)289 b(p)31 b(erson)0 33380 y(here)303 b(has)h(spared)f(y)-31 b(ou)304 b(and)g(all)h(subsequen)-31 b(t)303 b(readers)g(from)h(the)g (confusion)h(of)f(a)g(tec)-31 b(hnical)0 34735 y(error)368 b(or)h(a)h(less-than-transparen)-31 b(t)370 b(explanation,)j(just)c(b) -31 b(y)369 b(sending)h(us)f(a)g(note.)0 36817 y(Imp)31 b(ossible)411 b(as)f(it)h(ma)-31 b(y)411 b(seem)g(after)f(so)g(man)-31 b(y)412 b(corrections,)421 b(there)410 b(ma)-31 b(y)412 b(still)g(b)31 b(e)409 b(errors)0 38171 y(in)365 b(this)g(b)31 b(o)g(ok.)492 b(If)364 b(y)-31 b(ou)365 b(should)g(stum)-31 b(ble)366 b(across)e(one,)i(w)-31 b(e)365 b(hop)31 b(e)365 b(y)-31 b(ou)365 b(will)i(tak)-31 b(e)366 b(a)e(min)-31 b(ute)0 39526 y(to)426 b(con)-31 b(tact)427 b(us.)660 b(The)426 b(email)h(address)d(is)h Fk(feedback@thinkpython.com)p Fn(.)664 b(If)425 b(w)-31 b(e)426 b(mak)-31 b(e)0 40881 y(a)501 b(c)-31 b(hange)502 b(due)f(to)h(y)-31 b(our)501 b(suggestion,)536 b(y)-31 b(ou)502 b(will)h(app)31 b(ear)501 b(in)g(the)g(next)h(v)-31 b(ersion)501 b(of)h(the)0 42236 y(con)-31 b(tributor)371 b(list)f(\(unless)f(y)-31 b(ou)370 b(ask)f(to)h(b)31 b(e)369 b(omitted\).)495 b(Thank)370 b(y)-31 b(ou!)1660 44643 y Fj(\262)554 b Fn(Llo)-31 b(yd)371 b(Hugh)e(Allen)h(sen)-31 b(t)370 b(in)f(a)h(correction)g(to)g(Section)g (8.4.)1660 46805 y Fj(\262)554 b Fn(Yv)-31 b(on)371 b(Boulianne)g(sen) -31 b(t)369 b(in)g(a)h(correction)g(of)f(a)h(seman)-31 b(tic)371 b(error)d(in)h(Chapter)h(5.)1660 48968 y Fj(\262)554 b Fn(F)-92 b(red)368 b(Bremmer)h(submitted)i(a)e(correction)h(in)g (Section)g(2.1.)1660 51131 y Fj(\262)554 b Fn(Jonah)386 b(Cohen)f(wrote)h(the)f(P)-31 b(erl)385 b(scripts)g(to)g(con)-31 b(v)g(ert)386 b(the)f(LaT)-92 b(eX)385 b(source)g(for)g(this)2767 52486 y(b)31 b(o)g(ok)370 b(in)-31 b(to)371 b(b)31 b(eautiful)371 b(HTML.)1660 54648 y Fj(\262)554 b Fn(Mic)-31 b(hael)256 b(Conlon)g(sen)-31 b(t)255 b(in)f(a)h(grammar)h(correction)f(in)f (Chapter)h(2)g(and)g(an)f(impro)-31 b(v)g(e-)2767 56003 y(men)g(t)449 b(in)e(st)-31 b(yle)448 b(in)g(Chapter)g(1,)467 b(and)448 b(he)f(initiated)j(discussion)d(on)h(the)f(tec)-31 b(hnical)2767 57358 y(asp)31 b(ects)369 b(of)h(in)-31 b(terpreters.)p eop %%Page: 14 14 14 13 bop 0 -2070 a Fv(xiv)27280 b(Con)-35 b(tributor)427 b(List)p 0 -1627 38191 45 v 1660 865 a Fj(\262)554 b Fn(Benoit)371 b(Girard)e(sen)-31 b(t)369 b(in)g(a)h(correction)g(to)g (a)f(h)-31 b(umorous)370 b(mistak)-31 b(e)371 b(in)f(Section)g(5.6.) 1660 3210 y Fj(\262)554 b Fn(Courtney)453 b(Gleason)f(and)g(Katherine)h (Smith)g(wrote)f Fk(horsebet.py)p Fn(,)475 b(whic)-31 b(h)452 b(w)-31 b(as)2767 4565 y(used)354 b(as)g(a)g(case)g(study)g(in) g(an)g(earlier)h(v)-31 b(ersion)354 b(of)g(the)h(b)31 b(o)g(ok.)488 b(Their)354 b(program)h(can)2767 5920 y(no)-31 b(w)371 b(b)31 b(e)368 b(found)i(on)f(the)h(w)-31 b(ebsite.)1660 8265 y Fj(\262)554 b Fn(Lee)354 b(Harr)g(submitted)h(more)f (corrections)h(than)g(w)-31 b(e)354 b(ha)-31 b(v)g(e)355 b(ro)31 b(om)355 b(to)g(list)g(here,)i(and)2767 9620 y(indeed)370 b(he)f(should)g(b)31 b(e)369 b(listed)h(as)f(one)h(of)f (the)h(principal)g(editors)g(of)f(the)h(text.)1660 11966 y Fj(\262)554 b Fn(James)479 b(Ka)-31 b(ylin)479 b(is)f(a)g(studen)-31 b(t)479 b(using)f(the)h(text.)820 b(He)478 b(has)g(submitted)h(n)-31 b(umerous)2767 13321 y(corrections.)1660 15666 y Fj(\262)554 b Fn(Da)-31 b(vid)370 b(Kersha)-31 b(w)370 b(\257xed)f(the)g(brok)-31 b(en)370 b Fk(catTwice)g Fn(function)h(in)e(Section)h(3.10.)1660 18011 y Fj(\262)554 b Fn(Eddie)379 b(Lam)g(has)f(sen)-31 b(t)379 b(in)f(n)-31 b(umerous)379 b(corrections)g(to)g(Chapters)f(1,)k (2,)f(and)e(3.)520 b(He)2767 19366 y(also)407 b(\257xed)e(the)h(Mak)-31 b(e\257le)406 b(so)g(that)g(it)h(creates)e(an)h(index)g(the)f(\257rst)g (time)i(it)f(is)g(run)2767 20721 y(and)370 b(help)31 b(ed)369 b(us)g(set)g(up)g(a)g(v)-31 b(ersioning)371 b(sc)-31 b(heme.)1660 23066 y Fj(\262)554 b Fn(Man-Y)-92 b(ong)370 b(Lee)f(sen)-31 b(t)370 b(in)f(a)h(correction)f(to)h(the)g (example)g(co)31 b(de)370 b(in)f(Section)h(2.4.)1660 25411 y Fj(\262)554 b Fn(Da)-31 b(vid)561 b(Ma)-31 b(y)g(o)560 b(p)31 b(oin)-31 b(ted)561 b(out)f(that)h(the)f(w)-31 b(ord)560 b(\\unconsciously")i(in)d(Chapter)i(1)2767 26766 y(needed)369 b(to)h(b)31 b(e)369 b(c)-31 b(hanged)370 b(to)g(\\sub)31 b(consciously".)1660 29112 y Fj(\262)554 b Fn(Chris)370 b(McAlo)31 b(on)370 b(sen)-31 b(t)369 b(in)g(sev)-31 b(eral)370 b(corrections)g(to)g(Sections)g(3.9)g(and)f (3.10.)1660 31457 y Fj(\262)554 b Fn(Matthew)348 b(J.)e(Mo)31 b(elter)346 b(has)g(b)31 b(een)345 b(a)i(long-time)h(con)-31 b(tributor)348 b(who)f(sen)-31 b(t)346 b(in)g(n)-31 b(umer-)2767 32812 y(ous)369 b(corrections)h(and)g(suggestions)g(to)g(the)f(b)31 b(o)g(ok.)1660 35157 y Fj(\262)554 b Fn(Simon)366 b(Dicon)e(Mon)-31 b(tford)365 b(rep)31 b(orted)364 b(a)g(missing)h(function)h (de\257nition)f(and)g(sev)-31 b(eral)2767 36512 y(t)g(yp)31 b(os)460 b(in)f(Chapter)h(3.)763 b(He)459 b(also)g(found)h(errors)e(in) h(the)g Fk(increment)h Fn(function)h(in)2767 37867 y(Chapter)370 b(13.)1660 40212 y Fj(\262)554 b Fn(John)370 b(Ouzts)f(corrected)g(the) g(de\257nition)i(of)f(\\return)f(v)-61 b(alue")370 b(in)f(Chapter)h(3.) 1660 42557 y Fj(\262)554 b Fn(Kevin)e(P)-31 b(arks)551 b(sen)-31 b(t)551 b(in)g(v)-61 b(aluable)552 b(commen)-31 b(ts)553 b(and)e(suggestions)h(as)f(to)g(ho)-31 b(w)552 b(to)2767 43912 y(impro)-31 b(v)g(e)371 b(the)f(distribution)h(of)e (the)h(b)31 b(o)g(ok.)1660 46258 y Fj(\262)554 b Fn(Da)-31 b(vid)453 b(P)-31 b(o)31 b(ol)453 b(sen)-31 b(t)451 b(in)h(a)g(t)-31 b(yp)31 b(o)452 b(in)g(the)g(glossary)g(of)g(Chapter)g(1,)473 b(as)451 b(w)-31 b(ell)453 b(as)e(kind)2767 47613 y(w)-31 b(ords)370 b(of)f(encouragemen)-31 b(t.)1660 49958 y Fj(\262)554 b Fn(Mic)-31 b(hael)286 b(Sc)-31 b(hmitt)287 b(sen)-31 b(t)285 b(in)g(a)h(correction)f(to)h(the)f(c)-31 b(hapter)285 b(on)h(\257les)e(and)h(exceptions.)1660 52303 y Fj(\262)554 b Fn(Robin)477 b(Sha)-31 b(w)476 b(p)31 b(oin)-31 b(ted)477 b(out)g(an)f(error)f(in)h(Section)h(13.1,) 504 b(where)476 b(the)g(prin)-31 b(tTime)2767 53658 y(function)371 b(w)-31 b(as)370 b(used)e(in)i(an)f(example)i(without)g(b)31 b(eing)370 b(de\257ned.)1660 56003 y Fj(\262)554 b Fn(P)-31 b(aul)355 b(Sleigh)g(found)f(an)f(error)f(in)i(Chapter)g(7)g(and)f(a)h (bug)g(in)f(Jonah)h(Cohen's)g(P)-31 b(erl)2767 57358 y(script)370 b(that)g(generates)f(HTML)h(from)f(LaT)-92 b(eX.)p eop %%Page: 15 15 15 14 bop 36846 -2070 a Fv(xv)p 0 -1627 38191 45 v 1660 865 a Fj(\262)554 b Fn(Craig)332 b(T.)f(Sn)-31 b(ydal)331 b(is)f(testing)i(the)e(text)i(in)e(a)h(course)e(at)i(Drew)f(Univ)-31 b(ersit)g(y)-92 b(.)481 b(He)330 b(has)2767 2220 y(con)-31 b(tributed)371 b(sev)-31 b(eral)370 b(v)-61 b(aluable)370 b(suggestions)g(and)g(corrections.)1660 4541 y Fj(\262)554 b Fn(Ian)337 b(Thomas)i(and)e(his)f(studen)-31 b(ts)338 b(are)e(using)i(the)f(text)h(in)f(a)g(programming)i(course.)2767 5896 y(They)370 b(are)e(the)h(\257rst)f(ones)h(to)h(test)f(the)g(c)-31 b(hapters)369 b(in)g(the)g(latter)h(half)g(of)f(the)g(b)31 b(o)g(ok,)2767 7251 y(and)370 b(they)f(ha)-31 b(v)g(e)371 b(made)f(n)-31 b(umerous)369 b(corrections)g(and)h(suggestions.)1660 9572 y Fj(\262)554 b Fn(Keith)370 b(V)-92 b(erheyden)369 b(sen)-31 b(t)369 b(in)h(a)f(correction)h(in)g(Chapter)g(3.)1660 11893 y Fj(\262)554 b Fn(P)-31 b(eter)390 b(Winstanley)h(let)f(us)f (kno)-31 b(w)391 b(ab)31 b(out)390 b(a)g(longstanding)i(error)c(in)i (our)f(Latin)i(in)2767 13248 y(Chapter)370 b(3.)1660 15569 y Fj(\262)554 b Fn(Chris)353 b(W)-92 b(rob)31 b(el)353 b(made)g(corrections)g(to)h(the)f(co)31 b(de)353 b(in)g(the)g(c)-31 b(hapter)354 b(on)f(\257le)g(I/O)g(and)2767 16924 y(exceptions.)1660 19244 y Fj(\262)554 b Fn(Moshe)385 b(Zadk)-61 b(a)385 b(has)g(made)g(in)-31 b(v)-61 b(aluable)386 b(con)-31 b(tributions)387 b(to)e(this)g(pro)61 b(ject.)540 b(In)384 b(addi-)2767 20599 y(tion)392 b(to)f(writing)i(the)d(\257rst)g(draft)i (of)f(the)f(c)-31 b(hapter)391 b(on)g(Dictionaries,)398 b(he)390 b(pro)-31 b(vided)2767 21954 y(con)g(tin)g(ual)372 b(guidance)f(in)e(the)g(early)h(stages)g(of)g(the)f(b)31 b(o)g(ok.)1660 24275 y Fj(\262)554 b Fn(Christoph)423 b(Zw)-31 b(ersc)g(hk)g(e)422 b(sen)-31 b(t)422 b(sev)-31 b(eral)421 b(corrections)h(and)g(p)31 b(edagogic)423 b(suggestions,)2767 25630 y(and)370 b(explained)g(the)g(di\256erence)e (b)31 b(et)-31 b(w)g(een)371 b Fm(gleich)e Fn(and)h Fm(selb)-57 b(e)p Fn(.)1660 27951 y Fj(\262)554 b Fn(James)459 b(Ma)-31 b(y)g(er)458 b(sen)-31 b(t)458 b(us)g(a)g(whole)h(slew)g(of)f(sp)31 b(elling)460 b(and)e(t)-31 b(yp)31 b(ographical)461 b(errors,)2767 29306 y(including)371 b(t)-31 b(w)g(o)371 b(in)f(the)f(con)-31 b(tributor)371 b(list.)1660 31627 y Fj(\262)554 b Fn(Ha)-31 b(yden)326 b(McAfee)e(caugh)-31 b(t)326 b(a)f(p)31 b(oten)-31 b(tially)328 b(confusing)e(inconsistency)g(b)31 b(et)-31 b(w)g(een)325 b(t)-31 b(w)g(o)2767 32982 y(examples.)1660 35303 y Fj(\262)554 b Fn(Angel)324 b(Arnal)f(is)f(part)h(of)g(an)g(in) -31 b(ternational)326 b(team)e(of)f(translators)h(w)-31 b(orking)324 b(on)f(the)2767 36658 y(Spanish)294 b(v)-31 b(ersion)294 b(of)g(the)f(text.)469 b(He)293 b(has)h(also)g(found)g (sev)-31 b(eral)293 b(errors)f(in)i(the)g(English)2767 38013 y(v)-31 b(ersion.)1660 40334 y Fj(\262)554 b Fn(T)-92 b(auhidul)378 b(Ho)31 b(que)376 b(and)g(Lex)g(Berezhn)-31 b(y)376 b(created)g(the)g(illustrations)j(in)d(Chapter)h(1)2767 41689 y(and)370 b(impro)-31 b(v)g(ed)370 b(man)-31 b(y)371 b(of)f(the)f(other)h(illustrations.)1660 44010 y Fj(\262)554 b Fn(Dr.)453 b(Mic)-31 b(hele)254 b(Alzetta)i(caugh)-31 b(t)254 b(an)g(error)e(in)i(Chapter)g(8)g(and)f(sen)-31 b(t)254 b(some)f(in)-31 b(teresting)2767 45364 y(p)31 b(edagogic)371 b(commen)-31 b(ts)371 b(and)f(suggestions)g(ab)31 b(out)370 b(Fib)31 b(onacci)370 b(and)g(Old)f(Maid.)1660 47685 y Fj(\262)554 b Fn(Andy)310 b(Mitc)-31 b(hell)311 b(caugh)-31 b(t)311 b(a)f(t)-31 b(yp)31 b(o)311 b(in)f(Chapter)g(1)g (and)g(a)g(brok)-31 b(en)309 b(example)i(in)f(Chap-)2767 49040 y(ter)369 b(2.)1660 51361 y Fj(\262)554 b Fn(Kalin)250 b(Harv)-31 b(ey)250 b(suggested)f(a)g(clari\257cation)i(in)e(Chapter)h (7)f(and)g(caugh)-31 b(t)250 b(some)f(t)-31 b(yp)31 b(os.)1660 53682 y Fj(\262)554 b Fn(Christopher)457 b(P)-92 b(.)456 b(Smith)h(caugh)-31 b(t)457 b(sev)-31 b(eral)456 b(t)-31 b(yp)31 b(os)457 b(and)f(is)g(helping)h(us)e(prepare)g(to)2767 55037 y(up)31 b(date)370 b(the)f(b)31 b(o)g(ok)370 b(for)f(Python)i (2.2.)1660 57358 y Fj(\262)554 b Fn(Da)-31 b(vid)370 b(Hutc)-31 b(hins)370 b(caugh)-31 b(t)371 b(a)f(t)-31 b(yp)31 b(o)370 b(in)f(the)h(F)-92 b(orew)-31 b(ord.)p eop %%Page: 16 16 16 15 bop 0 -2070 a Fv(xvi)27280 b(Con)-35 b(tributor)427 b(List)p 0 -1627 38191 45 v 1660 865 a Fj(\262)554 b Fn(Gregor)388 b(Lingl)i(is)e(teac)-31 b(hing)390 b(Python)g(at)f(a)f (high)h(sc)-31 b(ho)31 b(ol)389 b(in)g(Vienna,)394 b(Austria.)551 b(He)2767 2220 y(is)397 b(w)-31 b(orking)399 b(on)f(a)f(German)g (translation)j(of)d(the)h(b)31 b(o)g(ok,)405 b(and)397 b(he)g(caugh)-31 b(t)399 b(a)e(couple)2767 3575 y(of)370 b(bad)g(errors)d(in)j(Chapter)g(5.)1660 5815 y Fj(\262)554 b Fn(Julie)370 b(P)-31 b(eters)369 b(caugh)-31 b(t)371 b(a)f(t)-31 b(yp)31 b(o)370 b(in)f(the)h(Preface.)1660 8056 y Fj(\262)554 b Fn(Florin)657 b(Oprina)f(sen)-31 b(t)656 b(in)g(an)h(impro)-31 b(v)g(emen)g(t)658 b(in)e Fk(makeTime)p Fn(,)730 b(a)656 b(correction)h(in)2767 9411 y Fk(printTime)p Fn(,)371 b(and)f(a)f(nice)h(t)-31 b(yp)31 b(o.)1660 11651 y Fj(\262)554 b Fn(D.)369 b(J.)h(W)-92 b(ebre)368 b(suggested)h(a)h(clari\257cation)i(in)d(Chapter)h(3.)1660 13892 y Fj(\262)554 b Fn(Ken)369 b(found)h(a)f(\257stful)h(of)g(errors) e(in)h(Chapters)h(8,)g(9)f(and)h(11.)1660 16132 y Fj(\262)554 b Fn(Iv)-31 b(o)499 b(W)-92 b(ev)-31 b(er)497 b(caugh)-31 b(t)500 b(a)e(t)-31 b(yp)31 b(o)499 b(in)g(Chapter)f(5)h(and)f (suggested)h(a)f(clari\257cation)j(in)2767 17487 y(Chapter)370 b(3.)1660 19728 y Fj(\262)554 b Fn(Curtis)370 b(Y)-92 b(ank)-31 b(o)370 b(suggested)g(a)f(clari\257cation)j(in)e(Chapter)g (2.)1660 21968 y Fj(\262)554 b Fn(Ben)408 b(Logan)g(sen)-31 b(t)408 b(in)f(a)h(n)-31 b(um)g(b)31 b(er)407 b(of)h(t)-31 b(yp)31 b(os)408 b(and)g(problems)f(with)i(translating)h(the)2767 23323 y(b)31 b(o)g(ok)370 b(in)-31 b(to)371 b(HTML.)1660 25564 y Fj(\262)554 b Fn(Jason)370 b(Armstrong)g(sa)-31 b(w)370 b(the)f(missing)h(w)-31 b(ord)370 b(in)f(Chapter)h(2.)1660 27804 y Fj(\262)554 b Fn(Louis)390 b(Cordier)f(noticed)h(a)f(sp)31 b(ot)389 b(in)g(Chapter)h(16)g(where)e(the)h(co)31 b(de)389 b(didn't)h(matc)-31 b(h)2767 29159 y(the)370 b(text.)1660 31400 y Fj(\262)554 b Fn(Brian)370 b(Cain)g(suggested)g(sev)-31 b(eral)370 b(clari\257cations)h(in)f(Chapters)f(2)h(and)f(3.)p eop %%Page: 17 17 17 16 bop 0 10597 a Fo(Con)-86 b(ten)g(ts)0 18296 y Fv(F)-106 b(orew)-35 b(ord)32329 b(v)0 21568 y(Preface)32677 b(vii)0 24840 y(Con)-35 b(tributor)426 b(List)27245 b(xiii)0 28111 y(1)1024 b(The)425 b(w)-35 b(a)g(y)424 b(of)g(the)i(program)22362 b(1)1660 30276 y Fn(1.1)1908 b(The)370 b(Python)g(programming)i (language)411 b(.)554 b(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)1754 b(1)1660 32440 y(1.2)1908 b(What)370 b(is)f(a)h(program?)1064 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1754 b(3)1660 34605 y(1.3)1908 b(What)370 b(is)f(debugging?)1133 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1754 b(4)1660 36770 y(1.4)1908 b(F)-92 b(ormal)370 b(and)g(natural)g(languages)620 b(.)554 b(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)1754 b(6)1660 38934 y(1.5)1908 b(The)370 b(\257rst)e(program)447 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1754 b(8)1660 41099 y(1.6)1908 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)1754 b(8)0 44370 y Fv(2)1024 b(V)-106 b(ariables,)425 b(expressions)h(and)f(statemen)-35 b(ts)14197 b(11)1660 46535 y Fn(2.1)1908 b(V)-92 b(alues)370 b(and)f(t)-31 b(yp)31 b(es)849 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(11)1660 48700 y(2.2)1908 b(V)-92 b(ariables)330 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f (.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(12)1660 50864 y(2.3)1908 b(V)-92 b(ariable)371 b(names)e(and)h(k)-31 b(eyw)g(ords)751 b(.)554 b(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(13)1660 53029 y(2.4)1908 b(Statemen)-31 b(ts)1103 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)1200 b(14)1660 55194 y(2.5)1908 b(Ev)-61 b(aluating)372 b(expressions)670 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(15)1660 57358 y(2.6)1908 b(Op)31 b(erators)369 b(and)h(op)31 b(erands)808 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(16)p eop %%Page: 18 18 18 17 bop 0 -2070 a Fv(xviii)30809 b(Con)-35 b(ten)g(ts)p 0 -1627 38191 45 v 1660 865 a Fn(2.7)1908 b(Order)368 b(of)i(op)31 b(erations)447 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(16)1660 3036 y(2.8)1908 b(Op)31 b(erations)370 b(on)g(strings)344 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(17)1660 5207 y(2.9)1908 b(Comp)31 b(osition)366 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)1200 b(18)1660 7378 y(2.10)1355 b(Commen)-31 b(ts)488 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(18)1660 9549 y(2.11)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(19)0 12829 y Fv(3)1024 b(F)-106 b(unctions)29888 b(21)1660 15000 y Fn(3.1)1908 b(F)-92 b(unction)370 b(calls)625 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)1200 b(21)1660 17171 y(3.2)1908 b(T)-31 b(yp)31 b(e)370 b(con)-31 b(v)g(ersion)330 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)1200 b(22)1660 19342 y(3.3)1908 b(T)-31 b(yp)31 b(e)370 b(co)31 b(ercion)520 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)1200 b(22)1660 21513 y(3.4)1908 b(Math)370 b(functions)825 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(23)1660 23684 y(3.5)1908 b(Comp)31 b(osition)366 b(.)554 b(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)1200 b(24)1660 25855 y(3.6)1908 b(Adding)370 b(new)g(functions)1071 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.) h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(25)1660 28026 y(3.7)1908 b(De\257nitions)370 b(and)g(use)648 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(27)1660 30197 y(3.8)1908 b(Flo)-31 b(w)371 b(of)e(execution)509 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(28)1660 32368 y(3.9)1908 b(P)-31 b(arameters)371 b(and)e(argumen)-31 b(ts)364 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)1200 b(28)1660 34539 y(3.10)1355 b(V)-92 b(ariables)370 b(and)g(parameters)f(are)g(lo)31 b(cal)900 b(.)554 b(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) 1200 b(30)1660 36710 y(3.11)1355 b(Stac)-31 b(k)371 b(diagrams)822 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(30)1660 38881 y(3.12)1355 b(F)-92 b(unctions)370 b(with)g(results)916 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(32)1660 41052 y(3.13)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)1200 b(32)0 44332 y Fv(4)1024 b(Conditionals)426 b(and)e(recursion) 20281 b(35)1660 46503 y Fn(4.1)1908 b(The)370 b(mo)31 b(dulus)369 b(op)31 b(erator)819 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(35)1660 48674 y(4.2)1908 b(Bo)31 b(olean)371 b(expressions)1131 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(35)1660 50845 y(4.3)1908 b(Logical)372 b(op)31 b(erators)710 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)1200 b(36)1660 53016 y(4.4)1908 b(Conditional)373 b(execution)1047 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(37)1660 55187 y(4.5)1908 b(Alternativ)-31 b(e)372 b(execution)398 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(37)1660 57358 y(4.6)1908 b(Chained)371 b(conditionals)642 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(38)p eop %%Page: 19 19 19 18 bop 0 -2070 a Fv(Con)-35 b(ten)g(ts)31519 b(xix)p 0 -1627 38191 45 v 1660 865 a Fn(4.7)1908 b(Nested)370 b(conditionals)482 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(39)1660 2875 y(4.8)1908 b(The)370 b Fk(return)g Fn(statemen)-31 b(t)752 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(40)1660 4886 y(4.9)1908 b(Recursion)867 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)1200 b(40)1660 6896 y(4.10)1355 b(Stac)-31 b(k)371 b(diagrams)f(for)g(recursiv)-31 b(e)368 b(functions)924 b(.)553 b(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(42)1660 8906 y(4.11)1355 b(In\257nite)370 b(recursion)848 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(43)1660 10917 y(4.12)1355 b(Keyb)31 b(oard)370 b(input)520 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(43)1660 12927 y(4.13)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)1200 b(44)0 16044 y Fv(5)1024 b(F)-106 b(ruitful)425 b(functions)25544 b(47)1660 18055 y Fn(5.1)1908 b(Return)369 b(v)-61 b(alues)652 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)1200 b(47)1660 20065 y(5.2)1908 b(Program)371 b(dev)-31 b(elopmen)g(t)1026 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(48)1660 22075 y(5.3)1908 b(Comp)31 b(osition)366 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(51)1660 24086 y(5.4)1908 b(Bo)31 b(olean)371 b(functions)410 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(52)1660 26096 y(5.5)1908 b(More)369 b(recursion)968 b(.)554 b(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)1200 b(53)1660 28106 y(5.6)1908 b(Leap)370 b(of)f(faith)1124 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(55)1660 30117 y(5.7)1908 b(One)369 b(more)h(example)859 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(56)1660 32127 y(5.8)1908 b(Chec)-31 b(king)371 b(t)-31 b(yp)31 b(es)855 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(57)1660 34137 y(5.9)1908 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)1200 b(58)0 37255 y Fv(6)1024 b(Iteration)30361 b(59)1660 39265 y Fn(6.1)1908 b(Multiple)371 b(assignmen)-31 b(t)1004 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(59)1660 41275 y(6.2)1908 b(The)370 b Fk(while)f Fn(statemen)-31 b(t)473 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(60)1660 43286 y(6.3)1908 b(T)-92 b(ables)794 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(62)1660 45296 y(6.4)1908 b(Tw)-31 b(o-dimensional)373 b(tables)1096 b(.)554 b(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(64)1660 47306 y(6.5)1908 b(Encapsulation)372 b(and)e(generalization) 747 b(.)554 b(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)1200 b(65)1660 49317 y(6.6)1908 b(More)369 b(encapsulation)485 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(66)1660 51327 y(6.7)1908 b(Lo)31 b(cal)370 b(v)-61 b(ariables)991 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(67)1660 53337 y(6.8)1908 b(More)369 b(generalization)d(.)554 b(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)1200 b(68)1660 55348 y(6.9)1908 b(F)-92 b(unctions)932 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(69)1660 57358 y(6.10)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(70)p eop %%Page: 20 20 20 19 bop 0 -2070 a Fv(xx)31871 b(Con)-35 b(ten)g(ts)p 0 -1627 38191 45 v 0 865 a(7)1024 b(Strings)31332 b(71)1660 2995 y Fn(7.1)1908 b(A)370 b(comp)31 b(ound)370 b(data)g(t)-31 b(yp)31 b(e)431 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(71)1660 5126 y(7.2)1908 b(Length)508 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)1200 b(72)1660 7256 y(7.3)1908 b(T)-92 b(ra)-31 b(v)g(ersal)370 b(and)g(the)f Fk(for)h Fn(lo)31 b(op)336 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(72)1660 9386 y(7.4)1908 b(String)370 b(slices)692 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)1200 b(74)1660 11516 y(7.5)1908 b(String)370 b(comparison)1127 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(74)1660 13647 y(7.6)1908 b(Strings)370 b(are)f(imm)-31 b(utable)913 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(75)1660 15777 y(7.7)1908 b(A)370 b Fk(find)f Fn(function)352 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)1200 b(76)1660 17907 y(7.8)1908 b(Lo)31 b(oping)371 b(and)e(coun)-31 b(ting)1063 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(76)1660 20037 y(7.9)1908 b(The)370 b Fk(string)g Fn(mo)31 b(dule)1126 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(77)1660 22167 y(7.10)1355 b(Character)370 b(classi\257cation)384 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(78)1660 24298 y(7.11)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)1200 b(79)0 27535 y Fv(8)1024 b(Lists)32638 b(81)1660 29665 y Fn(8.1)1908 b(List)370 b(v)-61 b(alues)464 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(81)1660 31795 y(8.2)1908 b(Accessing)370 b(elemen)-31 b(ts)751 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(82)1660 33926 y(8.3)1908 b(List)370 b(length)379 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)1200 b(83)1660 36056 y(8.4)1908 b(List)370 b(mem)-31 b(b)31 b(ership)984 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(84)1660 38186 y(8.5)1908 b(Lists)369 b(and)h Fk(for)f Fn(lo)31 b(ops)499 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(84)1660 40316 y(8.6)1908 b(List)370 b(op)31 b(erations)954 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(85)1660 42447 y(8.7)1908 b(List)370 b(slices)919 b(.)554 b(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)1200 b(86)1660 44577 y(8.8)1908 b(Lists)369 b(are)g(m)-31 b(utable)648 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)1200 b(86)1660 46707 y(8.9)1908 b(List)370 b(deletion)441 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f (.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(87)1660 48837 y(8.10)1355 b(Ob)61 b(jects)370 b(and)g(v)-61 b(alues)756 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(88)1660 50967 y(8.11)1355 b(Aliasing)857 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)1200 b(89)1660 53098 y(8.12)1355 b(Cloning)372 b(lists)449 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)1200 b(89)1660 55228 y(8.13)1355 b(List)370 b(parameters)612 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(90)1660 57358 y(8.14)1355 b(Nested)370 b(lists)904 b(.)554 b(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)1200 b(91)p eop %%Page: 21 21 21 20 bop 0 -2070 a Fv(Con)-35 b(ten)g(ts)31519 b(xxi)p 0 -1627 38191 45 v 1660 865 a Fn(8.15)1355 b(Matrixes)514 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(91)1660 2992 y(8.16)1355 b(Strings)370 b(and)f(lists)379 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(92)1660 5119 y(8.17)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)1200 b(93)0 8353 y Fv(9)1024 b(T)-106 b(uples)31624 b(95)1660 10480 y Fn(9.1)1908 b(Mutabilit)-31 b(y)372 b(and)e(tuples)1101 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(95)1660 12607 y(9.2)1908 b(T)-92 b(uple)370 b(assignmen)-31 b(t)635 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(96)1660 14733 y(9.3)1908 b(T)-92 b(uples)370 b(as)f(return)f(v)-61 b(alues)437 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(97)1660 16860 y(9.4)1908 b(Random)371 b(n)-31 b(um)g(b)31 b(ers)528 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(97)1660 18987 y(9.5)1908 b(List)370 b(of)f(random)h(n)-31 b(um)g(b)31 b(ers)858 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)1200 b(98)1660 21114 y(9.6)1908 b(Coun)-31 b(ting)310 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)1200 b(99)1660 23241 y(9.7)1908 b(Man)-31 b(y)370 b(buc)-31 b(k)g(ets)640 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) 647 b(100)1660 25368 y(9.8)1908 b(A)370 b(single-pass)f(solution)285 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(102)1660 27495 y(9.9)1908 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)647 b(103)0 30729 y Fv(10)388 b(Dictionaries)27951 b(105)1660 32855 y Fn(10.1)1355 b(Dictionary)371 b(op)31 b(erations)281 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(106)1660 34982 y(10.2)1355 b(Dictionary)371 b(metho)31 b(ds)345 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(107)1660 37109 y(10.3)1355 b(Aliasing)372 b(and)d(cop)-31 b(ying)672 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(108)1660 39236 y(10.4)1355 b(Sparse)369 b(matrices)1489 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(108)1660 41363 y(10.5)1355 b(Hin)-31 b(ts)456 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(109)1660 43490 y(10.6)1355 b(Long)370 b(in)-31 b(tegers)837 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(111)1660 45617 y(10.7)1355 b(Coun)-31 b(ting)372 b(letters)360 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(112)1660 47744 y(10.8)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)647 b(112)0 50977 y Fv(11)388 b(Files)425 b(and)f(exceptions)23340 b(115)1660 53104 y Fn(11.1)1355 b(T)-92 b(ext)370 b(\257les)332 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)647 b(117)1660 55231 y(11.2)1355 b(W)-92 b(riting)370 b(v)-61 b(ariables)788 b(.)554 b(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)647 b(118)1660 57358 y(11.3)1355 b(Directories)403 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(121)p eop %%Page: 22 22 22 21 bop 0 -2070 a Fv(xxii)31163 b(Con)-35 b(ten)g(ts)p 0 -1627 38191 45 v 1660 865 a Fn(11.4)1355 b(Pic)-31 b(kling)879 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) 647 b(121)1660 2992 y(11.5)1355 b(Exceptions)349 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(122)1660 5119 y(11.6)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)647 b(124)0 8353 y Fv(12)388 b(Classes)425 b(and)g(ob)71 b(jects)23808 b(127)1660 10480 y Fn(12.1)1355 b(User-de\257ned)369 b(comp)31 b(ound)370 b(t)-31 b(yp)31 b(es)784 b(.)554 b(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)647 b(127)1660 12607 y(12.2)1355 b(A)-31 b(ttributes)638 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) 647 b(128)1660 14733 y(12.3)1355 b(Instances)369 b(as)g(parameters)954 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)647 b(129)1660 16860 y(12.4)1355 b(Sameness)1064 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) 647 b(129)1660 18987 y(12.5)1355 b(Rectangles)441 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(131)1660 21114 y(12.6)1355 b(Instances)369 b(as)g(return)g(v)-61 b(alues)861 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(132)1660 23241 y(12.7)1355 b(Ob)61 b(jects)370 b(are)f(m)-31 b(utable)946 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)647 b(132)1660 25368 y(12.8)1355 b(Cop)-31 b(ying)771 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)647 b(133)1660 27495 y(12.9)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(135)0 30729 y Fv(13)388 b(Classes)425 b(and)g(functions)22694 b(137)1660 32855 y Fn(13.1)1355 b(Time)524 b(.)554 b(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(137)1660 34982 y(13.2)1355 b(Pure)369 b(functions)284 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(138)1660 37109 y(13.3)1355 b(Mo)31 b(di\257ers)1128 b(.)554 b(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(139)1660 39236 y(13.4)1355 b(Whic)-31 b(h)370 b(is)f(b)31 b(etter?)1005 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(140)1660 41363 y(13.5)1355 b(Protot)-31 b(yp)31 b(e)371 b(dev)-31 b(elopmen)g(t)372 b(v)-31 b(ersus)368 b(planning)1105 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)647 b(141)1660 43490 y(13.6)1355 b(Generalization)330 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(142)1660 45617 y(13.7)1355 b(Algorithms)1100 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(142)1660 47744 y(13.8)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)647 b(143)0 50977 y Fv(14)388 b(Classes)425 b(and)g(metho)35 b(ds)23031 b(145)1660 53104 y Fn(14.1)1355 b(Ob)61 b(ject-orien)-31 b(ted)372 b(features)787 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)647 b(145)1660 55231 y(14.2)1355 b Fk(printTime)398 b Fn(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(146)1660 57358 y(14.3)1355 b(Another)370 b(example)767 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(147)p eop %%Page: 23 23 23 22 bop 0 -2070 a Fv(Con)-35 b(ten)g(ts)30812 b(xxiii)p 0 -1627 38191 45 v 1660 865 a Fn(14.4)1355 b(A)370 b(more)f (complicated)j(example)1013 b(.)554 b(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(148)1660 3036 y(14.5)1355 b(Optional)372 b(argumen)-31 b(ts)299 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(149)1660 5207 y(14.6)1355 b(The)370 b(initialization)k(metho)31 b(d)985 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)647 b(150)1660 7378 y(14.7)1355 b(P)-31 b(oin)g(ts)371 b(revisited)708 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)647 b(151)1660 9549 y(14.8)1355 b(Op)31 b(erator)370 b(o)-31 b(v)g(erloading)516 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(152)1660 11720 y(14.9)1355 b(P)-31 b(olymorphism)378 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(153)1660 13891 y(14.10)802 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)647 b(155)0 17171 y Fv(15)388 b(Sets)426 b(of)e(ob)71 b(jects)26510 b(157)1660 19342 y Fn(15.1)1355 b(Comp)31 b(osition)366 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)647 b(157)1660 21513 y(15.2)1355 b Fk(Card)370 b Fn(ob)61 b(jects)376 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) 647 b(157)1660 23684 y(15.3)1355 b(Class)370 b(attributes)h(and)e(the)p 17126 23684 349 45 v 17545 23684 V 1206 w Fk(str)p 19706 23684 V 20125 23684 V 1207 w Fn(metho)31 b(d)743 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(159)1660 25855 y(15.4)1355 b(Comparing)372 b(cards)817 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(160)1660 28026 y(15.5)1355 b(Dec)-31 b(ks)1085 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)647 b(161)1660 30197 y(15.6)1355 b(Prin)-31 b(ting)371 b(the)f(dec)-31 b(k)658 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)647 b(161)1660 32368 y(15.7)1355 b(Sh)-31 b(u\262ing)371 b(the)e(dec)-31 b(k)431 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(163)1660 34539 y(15.8)1355 b(Remo)-31 b(ving)372 b(and)d(dealing)i (cards)559 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)647 b(164)1660 36710 y(15.9)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)647 b(165)0 39990 y Fv(16)388 b(Inheritance)28293 b(167)1660 42161 y Fn(16.1)1355 b(Inheritance)1043 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(167)1660 44332 y(16.2)1355 b(A)370 b(hand)f(of)h(cards)451 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(168)1660 46503 y(16.3)1355 b(Dealing)371 b(cards)774 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)647 b(169)1660 48674 y(16.4)1355 b(Prin)-31 b(ting)371 b(a)f(Hand)320 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(169)1660 50845 y(16.5)1355 b(The)370 b Fk(CardGame)g Fn(class)412 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(171)1660 53016 y(16.6)1355 b Fk(OldMaidHand)371 b Fn(class)944 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(171)1660 55187 y(16.7)1355 b Fk(OldMaidGame)371 b Fn(class)944 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(173)1660 57358 y(16.8)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)647 b(177)p eop %%Page: 24 24 24 23 bop 0 -2070 a Fv(xxiv)30845 b(Con)-35 b(ten)g(ts)p 0 -1627 38191 45 v 0 865 a(17)388 b(Link)-35 b(ed)424 b(lists)28236 b(179)1660 3036 y Fn(17.1)1355 b(Em)-31 b(b)31 b(edded)370 b(references)586 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(179)1660 5207 y(17.2)1355 b(The)370 b Fk(Node)f Fn(class)1015 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(179)1660 7378 y(17.3)1355 b(Lists)369 b(as)h(collections)915 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(181)1660 9549 y(17.4)1355 b(Lists)369 b(and)h(recursion)728 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(182)1660 11720 y(17.5)1355 b(In\257nite)370 b(lists)726 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f (.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(183)1660 13891 y(17.6)1355 b(The)370 b(fundamen)-31 b(tal)372 b(am)-31 b(biguit)g(y)372 b(theorem)736 b(.)554 b(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(184)1660 16062 y(17.7)1355 b(Mo)31 b(difying)371 b(lists)1003 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(184)1660 18233 y(17.8)1355 b(W)-92 b(rapp)31 b(ers)368 b(and)h(help)31 b(ers)1054 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(185)1660 20404 y(17.9)1355 b(The)370 b Fk(LinkedList)g Fn(class)972 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(186)1660 22575 y(17.10)802 b(In)-31 b(v)-61 b(arian)-31 b(ts)822 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)647 b(187)1660 24746 y(17.11)802 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)647 b(188)0 28026 y Fv(18)388 b(Stac)-35 b(ks)31095 b(189)1660 30197 y Fn(18.1)1355 b(Abstract)370 b(data)h(t)-31 b(yp)31 b(es)1122 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(189)1660 32368 y(18.2)1355 b(The)370 b(Stac)-31 b(k)370 b(ADT)446 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(190)1660 34539 y(18.3)1355 b(Implemen)-31 b(ting)372 b(stac)-31 b(ks)370 b(with)g(Python)h(lists)760 b(.)553 b(.)h(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(190)1660 36710 y(18.4)1355 b(Pushing)370 b(and)g(p)31 b(opping)471 b(.)554 b(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) 647 b(191)1660 38881 y(18.5)1355 b(Using)370 b(a)g(stac)-31 b(k)370 b(to)g(ev)-61 b(aluate)370 b(p)31 b(ost\257x)997 b(.)554 b(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)647 b(192)1660 41052 y(18.6)1355 b(P)-31 b(arsing)284 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(192)1660 43223 y(18.7)1355 b(Ev)-61 b(aluating)372 b(p)31 b(ost\257x)1086 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(193)1660 45394 y(18.8)1355 b(Clien)-31 b(ts)371 b(and)f(pro)-31 b(viders)473 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(194)1660 47565 y(18.9)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)647 b(195)0 50845 y Fv(19)388 b(Queues)30583 b(197)1660 53016 y Fn(19.1)1355 b(The)370 b(Queue)f(ADT)876 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(197)1660 55187 y(19.2)1355 b(Link)-31 b(ed)370 b(Queue)630 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(198)1660 57358 y(19.3)1355 b(P)-31 b(erformance)371 b(c)-31 b(haracteristics)945 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)647 b(199)p eop %%Page: 25 25 25 24 bop 0 -2070 a Fv(Con)-35 b(ten)g(ts)31201 b(xxv)p 0 -1627 38191 45 v 1660 865 a Fn(19.4)1355 b(Impro)-31 b(v)g(ed)370 b(Link)-31 b(ed)370 b(Queue)873 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)647 b(199)1660 3171 y(19.5)1355 b(Priorit)-31 b(y)371 b(queue)409 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(201)1660 5476 y(19.6)1355 b(The)370 b Fk(Golfer)g Fn(class)713 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(203)1660 7782 y(19.7)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)647 b(204)0 11242 y Fv(20)388 b(T)-106 b(rees)31649 b(205)1660 13548 y Fn(20.1)1355 b(Building)371 b(trees)590 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(206)1660 15853 y(20.2)1355 b(T)-92 b(ra)-31 b(v)g(ersing)370 b(trees)501 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(207)1660 18159 y(20.3)1355 b(Expression)370 b(trees)328 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(207)1660 20465 y(20.4)1355 b(T)-92 b(ree)369 b(tra)-31 b(v)g(ersal)693 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(208)1660 22770 y(20.5)1355 b(Building)371 b(an)f(expression)f(tree)1042 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)647 b(210)1660 25076 y(20.6)1355 b(Handling)371 b(errors)660 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(214)1660 27381 y(20.7)1355 b(The)370 b(animal)h(tree)458 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(214)1660 29687 y(20.8)1355 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)647 b(217)0 33147 y Fv(A)698 b(Debugging)28679 b(219)1660 35453 y Fn(A.1)1631 b(Syn)-31 b(tax)371 b(errors)844 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(219)1660 37759 y(A.2)1631 b(Run)-31 b(time)371 b(errors)890 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(221)1660 40064 y(A.3)1631 b(Seman)-31 b(tic)371 b(errors)660 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(225)0 43525 y Fv(B)754 b(Creating)426 b(a)e(new)i(data)e(t)-35 b(yp)35 b(e)20359 b(229)1660 45830 y Fn(B.1)1677 b(F)-92 b(raction)370 b(m)-31 b(ultiplication)540 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(230)1660 48136 y(B.2)1677 b(F)-92 b(raction)370 b(addition)691 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(232)1660 50441 y(B.3)1677 b(Euclid's)371 b(algorithm)1054 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(232)1660 52747 y(B.4)1677 b(Comparing)372 b(fractions)911 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(233)1660 55053 y(B.5)1677 b(T)-92 b(aking)371 b(it)f(further)916 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(234)1660 57358 y(B.6)1677 b(Glossary)592 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)g(.)g(.)647 b(235)p eop %%Page: 26 26 26 25 bop 0 -2070 a Fv(xxvi)30845 b(Con)-35 b(ten)g(ts)p 0 -1627 38191 45 v 0 865 a(C)741 b(Recommendations)426 b(for)f(further)h(reading)13564 b(237)1660 3030 y Fn(C.1)1662 b(Python-related)372 b(w)-31 b(eb)369 b(sites)h(and)f(b)31 b(o)g(oks)394 b(.)554 b(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)647 b(238)1660 5195 y(C.2)1662 b(Recommended)370 b(general)g(computer)g(science)f(b)31 b(o)g(oks)1073 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(239)0 8468 y Fv(D)684 b(GNU)425 b(F)-106 b(ree)426 b(Do)35 b(cumen)-35 b(tation)426 b(License)15380 b(241)1660 10633 y Fn(D.1)1615 b(Applicabilit)-31 b(y)373 b(and)d(De\257nitions)1117 b(.)554 b(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)647 b(242)1660 12798 y(D.2)1615 b(V)-92 b(erbatim)371 b(Cop)-31 b(ying)1075 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(243)1660 14963 y(D.3)1615 b(Cop)-31 b(ying)372 b(in)d(Quan)-31 b(tit)g(y)802 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(243)1660 17128 y(D.4)1615 b(Mo)31 b(di\257cations)826 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(244)1660 19293 y(D.5)1615 b(Com)-31 b(bining)372 b(Do)31 b(cumen)-31 b(ts)625 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(246)1660 21458 y(D.6)1615 b(Collections)372 b(of)e(Do)31 b(cumen)-31 b(ts)1049 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(247)1660 23624 y(D.7)1615 b(Aggregation)372 b(with)f(Indep)31 b(enden)-31 b(t)369 b(W)-92 b(orks)356 b(.)554 b(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) g(.)g(.)g(.)647 b(247)1660 25789 y(D.8)1615 b(T)-92 b(ranslation)977 b(.)554 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f (.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(247)1660 27954 y(D.9)1615 b(T)-92 b(ermination)553 b(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)f(.)h (.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)647 b(248)1660 30119 y(D.10)1062 b(F)-92 b(uture)369 b(Revisions)g(of)h(This)g (License)1002 b(.)554 b(.)g(.)g(.)f(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g (.)g(.)g(.)g(.)647 b(248)1660 32284 y(D.11)1062 b(Addendum:)493 b(Ho)-31 b(w)371 b(to)f(Use)f(This)g(License)g(for)g(Y)-92 b(our)369 b(Do)31 b(cumen)-31 b(ts)523 b(.)554 b(.)g(.)647 b(248)p eop %%Page: 1 27 1 26 bop 0 10080 a Fi(Chapter)861 b(1)0 16539 y Fo(The)1033 b(w)-86 b(a)g(y)1032 b(of)h(the)g(program)0 23179 y Fn(The)423 b(goal)i(of)f(this)g(b)31 b(o)g(ok)424 b(is)f(to)h(teac)-31 b(h)424 b(y)-31 b(ou)424 b(to)g(think)g(lik)-31 b(e)425 b(a)e(computer)h(scien)-31 b(tist.)657 b(This)0 24534 y(w)-31 b(a)g(y)293 b(of)f(thinking)i(com)-31 b(bines)293 b(some)f(of)g(the)g(b)31 b(est)292 b(features)g(of)g(mathematics,)310 b(engineering,)0 25889 y(and)408 b(natural)g(science.)608 b(Lik)-31 b(e)408 b(mathematicians,)421 b(computer)408 b(scien)-31 b(tists)408 b(use)f(formal)i(lan-)0 27244 y(guages)379 b(to)f(denote)h(ideas)f(\(sp)31 b(eci\257cally)380 b(computations\).)522 b(Lik)-31 b(e)379 b(engineers,)h(they)f(design)0 28599 y(things,)346 b(assem)-31 b(bling)341 b(comp)31 b(onen)-31 b(ts)340 b(in)-31 b(to)340 b(systems)f(and)g(ev)-61 b(aluating)341 b(tradeo\256s)e(among)h(al-)0 29954 y(ternativ)-31 b(es.)512 b(Lik)-31 b(e)376 b(scien)-31 b(tists,)379 b(they)c(observ)-31 b(e)376 b(the)f(b)31 b(eha)-31 b(vior)377 b(of)e(complex)i(systems,)g(form)0 31309 y(h)-31 b(yp)31 b(otheses,)370 b(and)f(test)h(predictions.)0 33521 y(The)412 b(single)g(most)h(imp)31 b(ortan)-31 b(t)414 b(skill)f(for)e(a)h (computer)h(scien)-31 b(tist)412 b(is)g Fv(problem)474 b(solving)p Fn(.)0 34876 y(Problem)284 b(solving)g(means)g(the)f (abilit)-31 b(y)285 b(to)f(form)-31 b(ulate)285 b(problems,)301 b(think)284 b(creativ)-31 b(ely)285 b(ab)31 b(out)0 36231 y(solutions,)486 b(and)461 b(express)e(a)i(solution)i(clearly)f(and)f (accurately)-92 b(.)768 b(As)461 b(it)h(turns)e(out,)485 b(the)0 37586 y(pro)31 b(cess)356 b(of)i(learning)g(to)g(program)g(is)f (an)g(excellen)-31 b(t)359 b(opp)31 b(ortunit)-31 b(y)359 b(to)f(practice)g(problem-)0 38941 y(solving)371 b(skills.)493 b(That's)371 b(wh)-31 b(y)370 b(this)f(c)-31 b(hapter)370 b(is)f(called,)i(\\The)f(w)-31 b(a)g(y)370 b(of)g(the)g(program.")0 41153 y(On)287 b(one)h(lev)-31 b(el,)306 b(y)-31 b(ou)288 b(will)h(b)31 b(e)287 b(learning)i(to)f(program,)305 b(a)288 b(useful)g(skill)h(b)-31 b(y)287 b(itself.)467 b(On)287 b(another)0 42508 y(lev)-31 b(el,)330 b(y)-31 b(ou)318 b(will)i(use)d(programming)j(as)d(a)h(means)g(to)h(an)f(end.) 475 b(As)317 b(w)-31 b(e)319 b(go)f(along,)330 b(that)319 b(end)0 43863 y(will)371 b(b)31 b(ecome)370 b(clearer.)0 48516 y Fl(1.1)1793 b(The)598 b(Python)h(programming)g(language)0 51081 y Fn(The)332 b(programming)i(language)h(y)-31 b(ou)332 b(will)i(b)31 b(e)332 b(learning)h(is)f(Python.)481 b(Python)334 b(is)e(an)g(exam-)0 52436 y(ple)321 b(of)h(a)f Fv(high-lev)-35 b(el)369 b(language)p Fn(;)339 b(other)321 b(high-lev)-31 b(el)323 b(languages)g(y)-31 b(ou)321 b(migh)-31 b(t)323 b(ha)-31 b(v)g(e)322 b(heard)0 53791 y(of)370 b(are)f(C,)h(C++,)g(P)-31 b(erl,)370 b(and)f(Ja)-31 b(v)-61 b(a.)0 56003 y(As)455 b(y)-31 b(ou)457 b(migh)-31 b(t)457 b(infer)f(from)g(the)g(name)h (\\high-lev)-31 b(el)458 b(language,")480 b(there)456 b(are)f(also)i Fv(lo)-35 b(w-)0 57358 y(lev)g(el)463 b(languages)p Fn(,)414 b(sometimes)405 b(referred)d(to)i(as)g(\\mac)-31 b(hine)405 b(languages")h(or)d(\\assem)-31 b(bly)p eop %%Page: 2 28 2 27 bop 0 -2070 a Fv(2)24022 b(The)424 b(w)-35 b(a)g(y)424 b(of)h(the)g(program)p 0 -1627 38191 45 v 0 865 a Fn(languages.")488 b(Lo)31 b(osely)347 b(sp)31 b(eaking,)353 b(computers)347 b(can)g(only)h(execute)f(programs)h(written)g(in)0 2220 y(lo)-31 b(w-lev)g(el)321 b(languages.)477 b(Th)-31 b(us,)329 b(programs)318 b(written)h(in)g(a)f(high-lev)-31 b(el)320 b(language)g(ha)-31 b(v)g(e)319 b(to)f(b)31 b(e)0 3575 y(pro)g(cessed)354 b(b)31 b(efore)355 b(they)g(can)h(run.)487 b(This)355 b(extra)h(pro)31 b(cessing)355 b(tak)-31 b(es)356 b(some)f(time,)360 b(whic)-31 b(h)356 b(is)0 4930 y(a)369 b(small)i(disadv)-61 b(an)-31 b(tage)371 b(of)f(high-lev)-31 b(el)371 b(languages.)0 7587 y(But)518 b(the)f(adv)-61 b(an)-31 b(tages)519 b(are)e(enormous.)937 b(First,)554 b(it)518 b(is)f(m)-31 b(uc)g(h)518 b(easier)f(to)h(program)g(in)g(a)0 8942 y(high-lev)-31 b(el)445 b(language.)714 b(Programs)444 b(written)f(in)g(a)g(high-lev)-31 b(el)444 b(language)h(tak)-31 b(e)444 b(less)e(time)0 10297 y(to)471 b(write,)496 b(they)471 b(are)e(shorter)h(and)g(easier)g(to)h(read,)495 b(and)470 b(they)h(are)e(more)i(lik)-31 b(ely)472 b(to)e(b)31 b(e)0 11652 y(correct.)965 b(Second,)567 b(high-lev)-31 b(el)528 b(languages)h(are)d Fv(p)35 b(ortable)p Fn(,)568 b(meaning)529 b(that)f(they)f(can)0 13007 y(run)486 b(on)g(di\256eren)-31 b(t)487 b(kinds)f(of)h(computers)f(with)i(few)f(or)f(no)g(mo)31 b(di\257cations.)847 b(Lo)-31 b(w-lev)g(el)0 14362 y(programs)317 b(can)f(run)f(on)i(only)g(one)f(kind)h(of)f(computer)h(and)f(ha)-31 b(v)g(e)317 b(to)g(b)31 b(e)316 b(rewritten)h(to)g(run)0 15716 y(on)369 b(another.)0 18374 y(Due)252 b(to)i(these)e(adv)-61 b(an)-31 b(tages,)278 b(almost)255 b(all)f(programs)f(are)g(written)h (in)f(high-lev)-31 b(el)255 b(languages.)0 19728 y(Lo)-31 b(w-lev)g(el)371 b(languages)g(are)e(used)g(only)h(for)f(a)h(few)g(sp) 31 b(ecialized)370 b(applications.)0 22385 y(Tw)-31 b(o)482 b(kinds)e(of)h(programs)f(pro)31 b(cess)479 b(high-lev)-31 b(el)483 b(languages)f(in)-31 b(to)482 b(lo)-31 b(w-lev)g(el)483 b(languages:)0 23740 y Fv(in)-35 b(terpreters)433 b Fn(and)f Fv(compilers)p Fn(.)680 b(An)431 b(in)-31 b(terpreter)432 b(reads)f(a)h(high-lev)-31 b(el)433 b(program)g(and)0 25095 y(executes)382 b(it,)k(meaning)d(that)g(it)g(do)31 b(es)381 b(what)i(the)f(program)g(sa)-31 b(ys.)530 b(It)382 b(pro)31 b(cesses)380 b(the)i(pro-)0 26450 y(gram)370 b(a)f(little)j(at)e(a)f(time,)i(alternately)h(reading)e(lines)f(and)h (p)31 b(erforming)370 b(computations.)6005 27829 y 15499581 3646961 0 0 17366384 4078469 startTexFig 6005 27829 a %%BeginDocument: illustrations/interpret.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: interpret.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Fri Dec 7 16:26:37 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 264 62 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 62 moveto 0 0 lineto 264 0 lineto 264 62 lineto closepath clip newpath -138.0 87.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 15.000 slw n 5919 1296 m 6376 1296 l 6376 1356 l 5919 1356 l cp gs col0 s gr % Polyline n 5823 1357 m 6484 1357 l 6484 1412 l 5823 1412 l cp gs col0 s gr % Polyline n 5638 463 m 6662 463 l 6662 1296 l 5638 1296 l cp gs col7 1.00 shd ef gr gs col0 s gr % Polyline 7.500 slw n 5692 519 m 6606 519 l 6606 1237 l 5692 1237 l cp gs col7 1.00 shd ef gr gs col0 s gr /Helvetica ff 165.00 scf sf 5813 953 m gs 1 -1 sc (OUTPUT) col0 sh gr % Polyline gs clippath 3615 795 m 3615 705 l 3403 705 l 3583 750 l 3403 795 l cp eoclip n 3225 750 m 3600 750 l gs col0 s gr gr % arrowhead n 3403 795 m 3583 750 l 3403 705 l col0 s % Polyline 15.000 slw n 2325 1350 m 2325 450 l 3000 450 l 3150 600 l 3150 1350 l 2325 1350 l cp gs col0 s gr % Polyline 7.500 slw n 3000 450 m 3000 600 l 3150 600 l gs col0 s gr % Polyline 15.000 slw n 3748 640 m 3652 533 l 3652 900 l 3748 798 l gs col0 s gr % Polyline 7.500 slw gs clippath 5587 1162 m 5587 1072 l 5375 1072 l 5555 1117 l 5375 1162 l cp eoclip n 5197 1117 m 5572 1117 l gs col0 s gr gr % arrowhead n 5375 1162 m 5555 1117 l 5375 1072 l col0 s % Polyline 15.000 slw n 5039 1173 m 5137 1275 l 5137 909 l 5039 1014 l gs col0 s gr % Polyline n 3750 525 m 5047 525 l 5047 1290 l 3750 1290 l cp gs col0 s gr /Helvetica ff 165.00 scf sf 2400 900 m gs 1 -1 sc (SOURCE) col0 sh gr /Helvetica ff 165.00 scf sf 2400 1125 m gs 1 -1 sc (CODE) col0 sh gr /Helvetica ff 165.00 scf sf 3825 975 m gs 1 -1 sc (INTERPRETER) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 36484 a Fn(A)376 b(compiler)i(reads)e(the)h(program)g(and)g (translates)g(it)g(completely)i(b)31 b(efore)376 b(the)h(program)0 37839 y(starts)f(running.)513 b(In)375 b(this)h(case,)i(the)e(high-lev) -31 b(el)378 b(program)f(is)f(called)h(the)f Fv(source)433 b(co)35 b(de)p Fn(,)0 39194 y(and)295 b(the)g(translated)h(program)f (is)g(called)g(the)g Fv(ob)71 b(ject)340 b(co)35 b(de)295 b Fn(or)g(the)g Fv(executable)p Fn(.)468 b(Once)0 40549 y(a)253 b(program)g(is)f(compiled,)278 b(y)-31 b(ou)253 b(can)g(execute)g(it)g(rep)31 b(eatedly)253 b(without)i(further)d (translation.)-63 41929 y 22684096 3646961 0 0 25391759 4078469 startTexFig -63 41929 a %%BeginDocument: illustrations/compile.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: compile.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Fri Dec 7 16:23:32 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 386 62 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 62 moveto 0 0 lineto 386 0 lineto 386 62 lineto closepath clip newpath -2.0 87.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 15.000 slw n 3936 655 m 3840 548 l 3840 915 l 3936 813 l gs col0 s gr % Polyline n 1304 647 m 1207 540 l 1207 907 l 1304 805 l gs col0 s gr % Polyline n 5694 1296 m 6151 1296 l 6151 1356 l 5694 1356 l cp gs col0 s gr % Polyline n 5598 1357 m 6259 1357 l 6259 1412 l 5598 1412 l cp gs col0 s gr % Polyline n 5413 463 m 6437 463 l 6437 1296 l 5413 1296 l cp gs col7 1.00 shd ef gr gs col0 s gr % Polyline 7.500 slw n 5467 519 m 6381 519 l 6381 1237 l 5467 1237 l cp gs col7 1.00 shd ef gr gs col0 s gr /Helvetica ff 165.00 scf sf 5588 953 m gs 1 -1 sc (OUTPUT) col0 sh gr % Polyline gs clippath 3869 795 m 3869 705 l 3657 705 l 3837 750 l 3657 795 l cp eoclip n 3525 750 m 3854 750 l gs col0 s gr gr % arrowhead n 3657 795 m 3837 750 l 3657 705 l col0 s % Polyline 15.000 slw n 5002 1248 m 5100 1350 l 5100 984 l 5002 1089 l gs col0 s gr % Polyline 7.500 slw gs clippath 5444 1170 m 5444 1080 l 5232 1080 l 5412 1125 l 5232 1170 l cp eoclip n 5100 1125 m 5429 1125 l gs col0 s gr gr % arrowhead n 5232 1170 m 5412 1125 l 5232 1080 l col0 s % Polyline 15.000 slw n 3936 548 m 5010 548 l 5010 1342 l 3936 1342 l cp gs col0 s gr % Polyline n 2700 525 m 3525 525 l 3525 1350 l 2700 1350 l cp gs col0 s gr % Polyline 7.500 slw gs clippath 1236 787 m 1236 697 l 1024 697 l 1204 742 l 1024 787 l cp eoclip n 892 742 m 1221 742 l gs col0 s gr gr % arrowhead n 1024 787 m 1204 742 l 1024 697 l col0 s % Polyline 15.000 slw n 67 442 m 742 442 l 892 592 l 892 1342 l 67 1342 l 67 442 l cp gs col0 s gr % Polyline 7.500 slw n 742 442 m 742 592 l 892 592 l gs col0 s gr % Polyline 15.000 slw n 1304 540 m 2274 540 l 2274 1327 l 1304 1327 l cp gs col0 s gr % Polyline n 2274 1225 m 2371 1327 l 2371 961 l 2274 1066 l gs col0 s gr % Polyline 7.500 slw gs clippath 2721 1162 m 2721 1072 l 2509 1072 l 2689 1117 l 2509 1162 l cp eoclip n 2377 1117 m 2706 1117 l gs col0 s gr gr % arrowhead n 2509 1162 m 2689 1117 l 2509 1072 l col0 s /Helvetica ff 165.00 scf sf 2775 1125 m gs 1 -1 sc (CODE) col0 sh gr /Helvetica ff 165.00 scf sf 2775 900 m gs 1 -1 sc (OBJECT) col0 sh gr /Helvetica ff 165.00 scf sf 4005 975 m gs 1 -1 sc (EXECUTOR) col0 sh gr /Helvetica ff 165.00 scf sf 142 1117 m gs 1 -1 sc (CODE) col0 sh gr /Helvetica ff 165.00 scf sf 142 892 m gs 1 -1 sc (SOURCE) col0 sh gr /Helvetica ff 165.00 scf sf 1342 967 m gs 1 -1 sc (COMPILER) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 50584 a Fn(Python)342 b(is)e(considered)g(an)g(in)-31 b(terpreted)341 b(language)i(b)31 b(ecause)340 b(Python)h(programs)g (are)f(ex-)0 51938 y(ecuted)g(b)-31 b(y)341 b(an)f(in)-31 b(terpreter.)484 b(There)340 b(are)g(t)-31 b(w)g(o)342 b(w)-31 b(a)g(ys)341 b(to)g(use)f(the)g(in)-31 b(terpreter:)478 b(command-)0 53293 y(line)336 b(mo)31 b(de)336 b(and)f(script)g(mo)31 b(de.)482 b(In)335 b(command-line)i(mo)31 b(de,)343 b(y)-31 b(ou)336 b(t)-31 b(yp)31 b(e)336 b(Python)g(programs)0 54648 y(and)369 b(the)h(in)-31 b(terpreter)369 b(prin)-31 b(ts)370 b(the)f(result:)p eop %%Page: 3 29 3 28 bop 0 -2070 a Fv(1.2)425 b(What)f(is)g(a)h(program?)24310 b(3)p 0 -1627 38191 45 v 0 865 a Fk($)581 b(python)0 2220 y(Python)h(1.5.2)g(\(#1,)g(Feb)f(1)h(2000,)f(16:32:16\))0 3575 y(Copyright)h(1991-1995)h(Stichting)f(Mathematish)h(Centrum,)g (Amsterdam)0 4930 y(>>>)f(print)f(1)h(+)f(1)0 6285 y(2)0 8616 y Fn(The)289 b(\257rst)f(line)i(of)f(this)g(example)h(is)f(the)g (command)h(that)g(starts)f(the)g(Python)h(in)-31 b(terpreter.)0 9971 y(The)322 b(next)h(t)-31 b(w)g(o)324 b(lines)e(are)g(messages)g (from)h(the)f(in)-31 b(terpreter.)477 b(The)322 b(third)h(line)g (starts)f(with)0 11326 y Fk(>>>)p Fn(,)431 b(whic)-31 b(h)420 b(is)e(the)h(prompt)g(the)f(in)-31 b(terpreter)419 b(uses)e(to)i(indicate)i(that)e(it)g(is)g(ready)-92 b(.)640 b(W)-92 b(e)0 12681 y(t)-31 b(yp)31 b(ed)370 b Fk(print)582 b(1)f(+)g(1)p Fn(,)370 b(and)f(the)h(in)-31 b(terpreter)369 b(replied)g Fk(2)p Fn(.)0 14931 y(Alternativ)-31 b(ely)-92 b(,)287 b(y)-31 b(ou)263 b(can)g(write)g(a)g(program)g(in)g(a)g(\257le) f(and)h(use)f(the)h(in)-31 b(terpreter)262 b(to)h(execute)0 16286 y(the)403 b(con)-31 b(ten)g(ts)405 b(of)f(the)f(\257le.)595 b(Suc)-31 b(h)403 b(a)h(\257le)f(is)h(called)g(a)g Fv(script)p Fn(.)594 b(F)-92 b(or)403 b(example,)413 b(w)-31 b(e)404 b(used)f(a)0 17641 y(text)370 b(editor)g(to)g(create)g(a)f(\257le)g (named)h Fk(latoya.py)h Fn(with)f(the)g(follo)-31 b(wing)372 b(con)-31 b(ten)g(ts:)0 19972 y Fk(print)582 b(1)f(+)g(1)0 22303 y Fn(By)433 b(con)-31 b(v)g(en)g(tion,)451 b(\257les)433 b(that)h(con)-31 b(tain)434 b(Python)g(programs)f(ha)-31 b(v)g(e)434 b(names)f(that)g(end)g(with)0 23658 y Fk(.py)p Fn(.)0 25908 y(T)-92 b(o)370 b(execute)f(the)h(program,)g(w)-31 b(e)370 b(ha)-31 b(v)g(e)370 b(to)g(tell)g(the)g(in)-31 b(terpreter)369 b(the)h(name)g(of)f(the)h(script:)0 28239 y Fk($)581 b(python)h(latoya.py)0 29594 y(2)0 31925 y Fn(In)353 b(other)h(dev)-31 b(elopmen)g(t)356 b(en)-31 b(vironmen)g(ts,)358 b(the)c(details)h(of)f(executing)h(programs)f(ma) -31 b(y)354 b(dif-)0 33280 y(fer.)492 b(Also,)371 b(most)f(programs)f (are)g(more)h(in)-31 b(teresting)371 b(than)e(this)h(one.)0 35530 y(Most)347 b(of)h(the)g(examples)g(in)f(this)h(b)31 b(o)g(ok)348 b(are)f(executed)g(on)h(the)f(command)i(line.)486 b(W)-92 b(orking)0 36885 y(on)447 b(the)g(command)h(line)f(is)f(con)-31 b(v)g(enien)g(t)449 b(for)e(program)g(dev)-31 b(elopmen)g(t)449 b(and)e(testing,)467 b(b)31 b(e-)0 38240 y(cause)379 b(y)-31 b(ou)379 b(can)g(t)-31 b(yp)31 b(e)380 b(programs)f(and)g (execute)g(them)h(immediately)-92 b(.)525 b(Once)378 b(y)-31 b(ou)380 b(ha)-31 b(v)g(e)380 b(a)0 39595 y(w)-31 b(orking)398 b(program,)405 b(y)-31 b(ou)397 b(should)f(store)h(it)g (in)g(a)f(script)g(so)h(y)-31 b(ou)397 b(can)f(execute)h(or)f(mo)31 b(dify)0 40950 y(it)370 b(in)f(the)h(future.)0 45716 y Fl(1.2)1793 b(What)598 b(is)g(a)g(program?)0 48333 y Fn(A)384 b Fv(program)i Fn(is)e(a)g(sequence)g(of)h(instructions)g (that)h(sp)31 b(eci\257es)383 b(ho)-31 b(w)386 b(to)f(p)31 b(erform)384 b(a)g(com-)0 49688 y(putation.)521 b(The)378 b(computation)j(migh)-31 b(t)380 b(b)31 b(e)378 b(something)h (mathematical,)385 b(suc)-31 b(h)377 b(as)h(solving)0 51043 y(a)367 b(system)g(of)h(equations)g(or)f(\257nding)g(the)g(ro)31 b(ots)367 b(of)h(a)f(p)31 b(olynomial,)371 b(but)c(it)g(can)h(also)f(b) 31 b(e)367 b(a)0 52398 y(sym)-31 b(b)31 b(olic)428 b(computation,)444 b(suc)-31 b(h)426 b(as)g(searc)-31 b(hing)427 b(and)g(replacing)g(text) g(in)g(a)g(do)31 b(cumen)-31 b(t)427 b(or)0 53753 y(\(strangely)371 b(enough\))f(compiling)i(a)d(program.)0 56003 y(The)478 b(details)h(lo)31 b(ok)479 b(di\256eren)-31 b(t)478 b(in)g(di\256eren) -31 b(t)478 b(languages,)507 b(but)478 b(a)g(few)g(basic)g (instructions)0 57358 y(app)31 b(ear)369 b(in)h(just)f(ab)31 b(out)370 b(ev)-31 b(ery)369 b(language:)p eop %%Page: 4 30 4 29 bop 0 -2070 a Fv(4)24022 b(The)424 b(w)-35 b(a)g(y)424 b(of)h(the)g(program)p 0 -1627 38191 45 v 0 865 a(input:)553 b Fn(Get)370 b(data)g(from)g(the)f(k)-31 b(eyb)31 b(oard,)371 b(a)e(\257le,)h(or)f(some)g(other)h(device.)0 2891 y Fv(output:)554 b Fn(Displa)-31 b(y)370 b(data)h(on)e(the)h(screen)e(or) h(send)f(data)j(to)f(a)f(\257le)h(or)f(other)g(device.)0 4917 y Fv(math:)553 b Fn(P)-31 b(erform)289 b(basic)g(mathematical)j (op)31 b(erations)289 b(lik)-31 b(e)290 b(addition)g(and)f(m)-31 b(ultiplication.)0 6943 y Fv(conditional)424 b(execution:)555 b Fn(Chec)-31 b(k)406 b(for)f(certain)h(conditions)g(and)g(execute)f (the)h(appro-)2767 8298 y(priate)370 b(sequence)f(of)h(statemen)-31 b(ts.)0 10323 y Fv(rep)35 b(etition:)555 b Fn(P)-31 b(erform)370 b(some)f(action)i(rep)31 b(eatedly)-92 b(,)370 b(usually)h(with)f(some) g(v)-61 b(ariation.)0 12309 y(Believ)-31 b(e)288 b(it)f(or)f(not,)304 b(that's)288 b(prett)-31 b(y)287 b(m)-31 b(uc)g(h)287 b(all)g(there)f(is)g(to)i(it.)465 b(Ev)-31 b(ery)287 b(program)g(y)-31 b(ou'v)g(e)288 b(ev)-31 b(er)0 13664 y(used,)363 b(no)e(matter)i(ho)-31 b(w)362 b(complicated,)k(is)c(made)g (up)f(of)h(instructions)g(that)h(lo)31 b(ok)362 b(more)g(or)0 15019 y(less)399 b(lik)-31 b(e)400 b(these.)583 b(Th)-31 b(us,)407 b(w)-31 b(e)400 b(can)f(describ)31 b(e)398 b(programming)k(as)d(the)g(pro)31 b(cess)398 b(of)i(breaking)0 16373 y(a)414 b(large,)426 b(complex)416 b(task)e(in)-31 b(to)416 b(smaller)e(and)g(smaller)h(subtasks)f(un)-31 b(til)415 b(the)f(subtasks)g(are)0 17728 y(simple)370 b(enough)g(to)g(b)31 b(e)369 b(p)31 b(erformed)369 b(with)h(one)f(of)h (these)f(basic)h(instructions.)0 19663 y(That)393 b(ma)-31 b(y)392 b(b)31 b(e)391 b(a)h(little)h(v)-61 b(ague,)398 b(but)391 b(w)-31 b(e)392 b(will)h(come)f(bac)-31 b(k)392 b(to)h(this)e(topic)i(later)f(when)f(w)-31 b(e)0 21017 y(talk)371 b(ab)31 b(out)370 b Fv(algorithms)p Fn(.)0 25205 y Fl(1.3)1793 b(What)598 b(is)g(debugging?)0 27472 y Fn(Programming)455 b(is)d(a)g(complex)h(pro)31 b(cess,)472 b(and)453 b(b)31 b(ecause)451 b(it)i(is)f(done)g(b)-31 b(y)452 b(h)-31 b(uman)453 b(b)31 b(eings,)0 28827 y(it)421 b(often)h(leads)f(to)h(errors.)645 b(F)-92 b(or)420 b(whimsical)j (reasons,)434 b(programming)423 b(errors)c(are)i(called)0 30182 y Fv(bugs)537 b Fn(and)e(the)h(pro)31 b(cess)535 b(of)h(trac)-31 b(king)537 b(them)g(do)-31 b(wn)536 b(and)g(correcting) h(them)f(is)g(called)0 31537 y Fv(debugging)p Fn(.)0 33471 y(Three)468 b(kinds)g(of)h(errors)d(can)i(o)31 b(ccur)468 b(in)g(a)h(program:)691 b(syn)-31 b(tax)469 b(errors,)492 b(run)-31 b(time)469 b(errors,)0 34826 y(and)390 b(seman)-31 b(tic)392 b(errors.)554 b(It)390 b(is)g(useful)g(to)h(distinguish)h(b)31 b(et)-31 b(w)g(een)391 b(them)f(in)h(order)e(to)i(trac)-31 b(k)0 36181 y(them)370 b(do)-31 b(wn)370 b(more)g(quic)-31 b(kly)-92 b(.)0 39798 y Fh(1.3.1)1495 b(Syn)-42 b(tax)499 b(errors)0 41875 y Fn(Python)548 b(can)f(only)h(execute)f(a)g(program)g(if)g(the)g (program)h(is)e(syn)-31 b(tactically)551 b(correct;)0 43230 y(otherwise,)361 b(the)d(pro)31 b(cess)356 b(fails)i(and)g (returns)e(an)i(error)e(message.)490 b Fv(Syn)-35 b(tax)356 b Fn(refers)h(to)h(the)0 44585 y(structure)496 b(of)h(a)g(program)h (and)f(the)g(rules)f(ab)31 b(out)498 b(that)g(structure.)874 b(F)-92 b(or)496 b(example,)531 b(in)0 45940 y(English,)340 b(a)331 b(sen)-31 b(tence)330 b(m)-31 b(ust)332 b(b)31 b(egin)331 b(with)g(a)g(capital)i(letter)e(and)g(end)f(with)i(a)f(p)31 b(erio)g(d.)480 b(this)0 47294 y(sen)-31 b(tence)369 b(con)-31 b(tains)371 b(a)e Fv(syn)-35 b(tax)424 b(error)p Fn(.)495 b(So)369 b(do)31 b(es)369 b(this)g(one)0 49229 y(F)-92 b(or)458 b(most)i(readers,)481 b(a)460 b(few)g(syn)-31 b(tax)460 b(errors)e(are)h(not)g(a)h(signi\257can)-31 b(t)461 b(problem,)483 b(whic)-31 b(h)460 b(is)0 50584 y(wh)-31 b(y)329 b(w)-31 b(e)329 b(can)f(read)h(the)f(p)31 b(o)g(etry)329 b(of)f(e.)479 b(e.)g(cummings)330 b(without)g(sp)31 b(ewing)329 b(error)e(messages.)0 51938 y(Python)439 b(is)f(not)h(so)f(forgiving.)701 b(If)438 b(there)g(is)g(a)g(single)h (syn)-31 b(tax)439 b(error)e(an)-31 b(ywhere)438 b(in)h(y)-31 b(our)0 53293 y(program,)350 b(Python)344 b(will)h(prin)-31 b(t)344 b(an)f(error)f(message)i(and)f(quit,)350 b(and)344 b(y)-31 b(ou)344 b(will)h(not)e(b)31 b(e)343 b(able)0 54648 y(to)407 b(run)f(y)-31 b(our)407 b(program.)605 b(During)407 b(the)g(\257rst)f(few)h(w)-31 b(eeks)406 b(of)i(y)-31 b(our)406 b(programming)j(career,)0 56003 y(y)-31 b(ou)348 b(will)i(probably)f(sp)31 b(end)347 b(a)h(lot)h(of)f(time)h(trac)-31 b(king)349 b(do)-31 b(wn)349 b(syn)-31 b(tax)349 b(errors.)484 b(As)347 b(y)-31 b(ou)349 b(gain)0 57358 y(exp)31 b(erience,)369 b(though,)i(y)-31 b(ou)370 b(will)h(mak)-31 b(e)370 b(few)-31 b(er)370 b(errors)e(and)h(\257nd)g(them)h(faster.)p eop %%Page: 5 31 5 30 bop 0 -2070 a Fv(1.3)425 b(What)f(is)g(debugging?)24388 b(5)p 0 -1627 38191 45 v 0 865 a Fh(1.3.2)1495 b(Run)-42 b(time)499 b(errors)0 3145 y Fn(The)462 b(second)g(t)-31 b(yp)31 b(e)462 b(of)h(error)e(is)h(a)g(run)-31 b(time)463 b(error,)485 b(so)461 b(called)j(b)31 b(ecause)461 b(the)h(error)f(do) 31 b(es)0 4500 y(not)510 b(app)31 b(ear)509 b(un)-31 b(til)510 b(y)-31 b(ou)509 b(run)g(the)g(program.)912 b(These)509 b(errors)e(are)i(also)h(called)g Fv(excep-)0 5855 y(tions)399 b Fn(b)31 b(ecause)398 b(they)h(usually)h(indicate)g (that)g(something)g(exceptional)h(\(and)f(bad\))f(has)0 7210 y(happ)31 b(ened.)0 9348 y(Run)-31 b(time)497 b(errors)d(are)i (rare)f(in)h(the)g(simple)g(programs)g(y)-31 b(ou)497 b(will)g(see)e(in)h(the)g(\257rst)f(few)0 10703 y(c)-31 b(hapters,)370 b(so)f(it)h(migh)-31 b(t)371 b(b)31 b(e)369 b(a)g(while)i(b)31 b(efore)369 b(y)-31 b(ou)369 b(encoun)-31 b(ter)370 b(one.)0 14604 y Fh(1.3.3)1495 b(Seman)-42 b(tic)500 b(errors)0 16884 y Fn(The)486 b(third)g(t)-31 b(yp)31 b(e)486 b(of)g(error)f(is)h(the)g Fv(seman)-35 b(tic)557 b(error)p Fn(.)844 b(If)486 b(there)f(is)h(a)g(seman)-31 b(tic)487 b(error)0 18239 y(in)464 b(y)-31 b(our)464 b(program,)489 b(it)464 b(will)i(run)d(successfully)-92 b(,)487 b(in)464 b(the)g(sense)f(that)i(the)f(computer)g(will)0 19594 y(not)421 b(generate)h(an)-31 b(y)421 b(error)f(messages,)434 b(but)421 b(it)h(will)g(not)f(do)g(the)g(righ)-31 b(t)422 b(thing.)649 b(It)420 b(will)j(do)0 20949 y(something)371 b(else.)493 b(Sp)31 b(eci\257cally)-92 b(,)371 b(it)f(will)g(do)g(what) g(y)-31 b(ou)370 b(told)h(it)f(to)g(do.)0 23086 y(The)495 b(problem)g(is)g(that)g(the)g(program)g(y)-31 b(ou)496 b(wrote)f(is)g(not)g(the)g(program)g(y)-31 b(ou)495 b(w)-31 b(an)g(ted)0 24441 y(to)486 b(write.)843 b(The)486 b(meaning)h(of)f (the)g(program)h(\(its)f(seman)-31 b(tics\))488 b(is)d(wrong.)843 b(Iden)-31 b(tifying)0 25796 y(seman)g(tic)546 b(errors)d(can)i(b)31 b(e)544 b(tric)-31 b(ky)545 b(b)31 b(ecause)544 b(it)h(requires)f(y)-31 b(ou)545 b(to)h(w)-31 b(ork)545 b(bac)-31 b(kw)g(ard)546 b(b)-31 b(y)0 27151 y(lo)31 b(oking)371 b(at)f(the)g(output)g(of)g(the) f(program)h(and)g(trying)g(to)g(\257gure)f(out)h(what)g(it)g(is)f (doing.)0 31052 y Fh(1.3.4)1495 b(Exp)42 b(erimen)-42 b(tal)500 b(debugging)0 33332 y Fn(One)327 b(of)g(the)g(most)h(imp)31 b(ortan)-31 b(t)329 b(skills)e(y)-31 b(ou)328 b(will)g(acquire)g(is)e (debugging.)480 b(Although)329 b(it)f(can)0 34687 y(b)31 b(e)334 b(frustrating,)342 b(debugging)336 b(is)e(one)g(of)h(the)f (most)h(in)-31 b(tellectually)338 b(ric)-31 b(h,)341 b(c)-31 b(hallenging,)345 b(and)0 36042 y(in)-31 b(teresting)371 b(parts)e(of)h(programming.)0 38179 y(In)h(some)g(w)-31 b(a)g(ys,)373 b(debugging)g(is)e(lik)-31 b(e)373 b(detectiv)-31 b(e)372 b(w)-31 b(ork.)500 b(Y)-92 b(ou)371 b(are)g(confron)-31 b(ted)372 b(with)h(clues,)0 39534 y(and)c(y)-31 b(ou)370 b(ha)-31 b(v)g(e)371 b(to)e(infer)h(the)f(pro)31 b(cesses)368 b(and)h(ev)-31 b(en)g(ts)370 b(that)g(led)g(to)g(the)f(results)g(y)-31 b(ou)370 b(see.)0 41672 y(Debugging)462 b(is)f(also)h(lik)-31 b(e)462 b(an)g(exp)31 b(erimen)-31 b(tal)462 b(science.)768 b(Once)461 b(y)-31 b(ou)462 b(ha)-31 b(v)g(e)462 b(an)f(idea)h(what)0 43026 y(is)485 b(going)i(wrong,)516 b(y)-31 b(ou)486 b(mo)31 b(dify)486 b(y)-31 b(our)486 b(program)g(and)g(try)f(again.)843 b(If)485 b(y)-31 b(our)485 b(h)-31 b(yp)31 b(othesis)0 44381 y(w)-31 b(as)411 b(correct,)422 b(then)410 b(y)-31 b(ou)412 b(can)f(predict)g(the)f(result)h(of)g(the)g(mo)31 b(di\257cation,)424 b(and)411 b(y)-31 b(ou)412 b(tak)-31 b(e)0 45736 y(a)372 b(step)g(closer)g(to)g(a)g(w)-31 b(orking)374 b(program.)501 b(If)372 b(y)-31 b(our)372 b(h)-31 b(yp)31 b(othesis)373 b(w)-31 b(as)372 b(wrong,)i(y)-31 b(ou)372 b(ha)-31 b(v)g(e)373 b(to)0 47091 y(come)452 b(up)e(with)i(a)f(new)g(one.)738 b(As)451 b(Sherlo)31 b(c)-31 b(k)451 b(Holmes)h(p)31 b(oin)-31 b(ted)452 b(out,)473 b(\\When)450 b(y)-31 b(ou)452 b(ha)-31 b(v)g(e)0 48446 y(eliminated)356 b(the)e(imp)31 b(ossible,)359 b(whatev)-31 b(er)355 b(remains,)j(ho)-31 b(w)g(ev)g(er)355 b(improbable,)k(m)-31 b(ust)354 b(b)31 b(e)354 b(the)0 49801 y(truth.")493 b(\(A.)371 b(Conan)f(Do)-31 b(yle,)371 b Fm(The)396 b(Sign)h(of)f(F)-85 b(our)p Fn(\))0 51938 y(F)-92 b(or)497 b(some)i(p)31 b(eople,)531 b(programming)500 b(and)e(debugging)i(are)d(the)i(same)f (thing.)880 b(That)499 b(is,)0 53293 y(programming)538 b(is)e(the)g(pro)31 b(cess)534 b(of)j(gradually)g(debugging)h(a)e (program)g(un)-31 b(til)538 b(it)e(do)31 b(es)0 54648 y(what)459 b(y)-31 b(ou)458 b(w)-31 b(an)g(t.)759 b(The)457 b(idea)i(is)e(that)h(y)-31 b(ou)459 b(should)e(start)h(with)h(a)e (program)i(that)f(do)31 b(es)0 56003 y Fm(something)473 b Fn(and)h(mak)-31 b(e)474 b(small)h(mo)31 b(di\257cations,)502 b(debugging)474 b(them)g(as)f(y)-31 b(ou)474 b(go,)501 b(so)473 b(that)0 57358 y(y)-31 b(ou)370 b(alw)-31 b(a)g(ys)371 b(ha)-31 b(v)g(e)370 b(a)g(w)-31 b(orking)371 b(program.)p eop %%Page: 6 32 6 31 bop 0 -2070 a Fv(6)24022 b(The)424 b(w)-35 b(a)g(y)424 b(of)h(the)g(program)p 0 -1627 38191 45 v 0 865 a Fn(F)-92 b(or)407 b(example,)419 b(Lin)-31 b(ux)409 b(is)f(an)g(op)31 b(erating)409 b(system)f(that)h(con)-31 b(tains)410 b(thousands)e(of)g (lines)g(of)0 2220 y(co)31 b(de,)505 b(but)478 b(it)h(started)f(out)h (as)e(a)i(simple)f(program)h(Lin)-31 b(us)478 b(T)-92 b(orv)-61 b(alds)478 b(used)f(to)h(explore)0 3575 y(the)487 b(In)-31 b(tel)488 b(80386)h(c)-31 b(hip.)847 b(According)487 b(to)h(Larry)f(Green\257eld,)516 b(\\One)487 b(of)h(Lin)-31 b(us's)487 b(earlier)0 4930 y(pro)61 b(jects)339 b(w)-31 b(as)339 b(a)g(program)g(that)h(w)-31 b(ould)340 b(switc)-31 b(h)339 b(b)31 b(et)-31 b(w)g(een)340 b(prin)-31 b(ting)339 b(AAAA)h(and)e(BBBB.)0 6285 y(This)370 b(later)g(ev)-31 b(olv)g(ed)370 b(to)g(Lin)-31 b(ux.")494 b(\()p Fm(The)397 b(Linux)f(Users')g(Guide)370 b Fn(Beta)g(V)-92 b(ersion)369 b(1\))0 8571 y(Later)302 b(c)-31 b(hapters)302 b(will)i(mak)-31 b(e)303 b(more)f(suggestions)h(ab)31 b(out)302 b(debugging)i(and)e (other)g(program-)0 9926 y(ming)370 b(practices.)0 14801 y Fl(1.4)1793 b(F)-149 b(ormal)598 b(and)g(natural)g(languages)0 17470 y Fv(Natural)635 b(languages)553 b Fn(are)f(the)g(languages)i (that)f(p)31 b(eople)553 b(sp)31 b(eak,)598 b(suc)-31 b(h)551 b(as)h(English,)0 18825 y(Spanish,)436 b(and)422 b(F)-92 b(renc)-31 b(h.)651 b(They)422 b(w)-31 b(ere)422 b(not)h(designed)g(b)-31 b(y)422 b(p)31 b(eople)423 b(\(although)h(p)31 b(eople)423 b(try)0 20180 y(to)370 b(imp)31 b(ose)370 b(some)f(order)g(on)g(them\);)i(they)f(ev)-31 b(olv)g(ed)371 b(naturally)-92 b(.)0 22467 y Fv(F)-106 b(ormal)340 b(languages)297 b Fn(are)e(languages)j(that)f(are)e(designed)h(b)-31 b(y)296 b(p)31 b(eople)297 b(for)e(sp)31 b(eci\257c)296 b(appli-)0 23822 y(cations.)460 b(F)-92 b(or)267 b(example,)290 b(the)267 b(notation)k(that)d(mathematicians)k(use)266 b(is)i(a)g(formal)h(language)0 25176 y(that)295 b(is)e(particularly)j (go)31 b(o)g(d)294 b(at)g(denoting)i(relationships)f(among)g(n)-31 b(um)g(b)31 b(ers)293 b(and)h(sym)-31 b(b)31 b(ols.)0 26531 y(Chemists)276 b(use)e(a)i(formal)g(language)h(to)f(represen)-31 b(t)274 b(the)h(c)-31 b(hemical)277 b(structure)e(of)g(molecules.)0 27886 y(And)369 b(most)h(imp)31 b(ortan)-31 b(tly:)2767 30766 y Fv(Programming)695 b(languages)g(are)f(formal)g(languages)g (that)g(ha)-35 b(v)g(e)2767 32121 y(b)35 b(een)426 b(designed)h(to)d (express)i(computations.)0 35001 y Fn(F)-92 b(ormal)308 b(languages)i(tend)e(to)h(ha)-31 b(v)g(e)309 b(strict)f(rules)f(ab)31 b(out)309 b(syn)-31 b(tax.)473 b(F)-92 b(or)307 b(example,)322 b(3)123 b(+)g(3)309 b(=)f(6)0 36356 y(is)403 b(a)h(syn)-31 b(tactically)406 b(correct)d(mathematical)408 b(statemen)-31 b(t,)414 b(but)403 b Fk(3=+6$)h Fn(is)f(not.)596 b Fg(H)34715 36522 y Ff(2)35211 36356 y Fg(O)435 b Fn(is)403 b(a)0 37711 y(syn)-31 b(tactically)373 b(correct)c(c)-31 b(hemical)371 b(name,)f(but)19938 37877 y Ff(2)20434 37711 y Fg(Z)79 b(z)418 b Fn(is)369 b(not.)0 39997 y(Syn)-31 b(tax)410 b(rules)e(come)h(in)f(t)-31 b(w)g(o)411 b(\260a)-31 b(v)g(ors,)419 b(p)31 b(ertaining)410 b(to)f Fv(tok)-35 b(ens)409 b Fn(and)g(structure.)609 b(T)-92 b(ok)-31 b(ens)0 41352 y(are)418 b(the)h(basic)g(elemen)-31 b(ts)420 b(of)f(the)g(language,) 434 b(suc)-31 b(h)418 b(as)g(w)-31 b(ords,)432 b(n)-31 b(um)g(b)31 b(ers,)431 b(and)419 b(c)-31 b(hemical)0 42707 y(elemen)g(ts.)883 b(One)498 b(of)i(the)f(problems)g(with)h Fk(3=+6$)g Fn(is)e(that)j Fk($)d Fn(is)h(not)h(a)f(legal)i(tok)-31 b(en)500 b(in)0 44062 y(mathematics)432 b(\(at)f(least)g(as)e(far)h(as) g(w)-31 b(e)430 b(kno)-31 b(w\).)675 b(Similarly)-92 b(,)26294 44228 y Ff(2)26790 44062 y Fg(Z)79 b(z)478 b Fn(is)430 b(not)g(legal)h(b)31 b(ecause)0 45417 y(there)369 b(is)g(no)h(elemen)-31 b(t)370 b(with)h(the)e(abbreviation)j Fg(Z)79 b(z)49 b Fn(.)0 47704 y(The)365 b(second)g(t)-31 b(yp)31 b(e)366 b(of)f(syn)-31 b(tax)367 b(error)d(p)31 b(ertains)365 b(to)h(the)f(structure)g(of)g(a)g(statemen)-31 b(t|that)0 49059 y(is,)350 b(the)344 b(w)-31 b(a)g(y)346 b(the)f(tok)-31 b(ens)345 b(are)f(arranged.)485 b(The)344 b(statemen)-31 b(t)347 b Fk(3=+6$)d Fn(is)h(structurally)g(illegal)0 50414 y(b)31 b(ecause)384 b(y)-31 b(ou)385 b(can't)h(place)f(a)g(plus)g (sign)g(immediately)j(after)d(an)g(equal)g(sign.)539 b(Similarly)-92 b(,)0 51768 y(molecular)362 b(form)-31 b(ulas)361 b(ha)-31 b(v)g(e)360 b(to)h(ha)-31 b(v)g(e)361 b(subscripts)e(after)h(the)g(elemen)-31 b(t)361 b(name,)i(not)e(b)31 b(efore.)2767 54648 y Fm(As)443 b(an)g(exer)-57 b(cise,)456 b(cr)-57 b(e)g(ate)444 b(what)e(app)-57 b(e)g(ars)443 b(to)g(b)-57 b(e)444 b(a)e(wel)57 b(l-structur)-57 b(e)g(d)443 b(English)2767 56003 y(sentenc)-57 b(e)444 b(with)d(unr)-57 b(e)g(c)g(o)g(gnizable)445 b(tokens)d(in)g(it.)648 b(Then)442 b(write)g(another)g(sen-)2767 57358 y(tenc)-57 b(e)398 b(with)d(al)57 b(l)395 b(valid)h(tokens)g(but)g(with)g(invalid)h (structur)-57 b(e.)p eop %%Page: 7 33 7 32 bop 0 -2070 a Fv(1.4)425 b(F)-106 b(ormal)424 b(and)h(natural)f (languages)18920 b(7)p 0 -1627 38191 45 v 0 865 a Fn(When)374 b(y)-31 b(ou)376 b(read)e(a)h(sen)-31 b(tence)375 b(in)g(English)h(or)f (a)g(statemen)-31 b(t)377 b(in)e(a)g(formal)h(language,)j(y)-31 b(ou)0 2220 y(ha)g(v)g(e)397 b(to)f(\257gure)f(out)h(what)h(the)f (structure)f(of)h(the)g(sen)-31 b(tence)395 b(is)h(\(although)i(in)e(a) g(natural)0 3575 y(language)371 b(y)-31 b(ou)370 b(do)g(this)f(sub)31 b(consciously\).)494 b(This)370 b(pro)31 b(cess)368 b(is)h(called)h Fv(parsing)p Fn(.)0 5746 y(F)-92 b(or)289 b(example,)307 b(when)290 b(y)-31 b(ou)290 b(hear)g(the)g(sen)-31 b(tence,)306 b(\\The)290 b(other)g(sho)31 b(e)289 b(fell,")308 b(y)-31 b(ou)290 b(understand)0 7101 y(that)295 b(\\the)f(other)g(sho)31 b(e")293 b(is)h(the)f(sub)61 b(ject)294 b(and)g(\\fell")h(is)f(the)f(v) -31 b(erb.)468 b(Once)293 b(y)-31 b(ou)294 b(ha)-31 b(v)g(e)295 b(parsed)0 8456 y(a)371 b(sen)-31 b(tence,)372 b(y)-31 b(ou)372 b(can)f(\257gure)f(out)i(what)g(it)g(means,)g(or)f(the)g (seman)-31 b(tics)372 b(of)f(the)g(sen)-31 b(tence.)0 9811 y(Assuming)479 b(that)g(y)-31 b(ou)479 b(kno)-31 b(w)479 b(what)g(a)g(sho)31 b(e)477 b(is)h(and)h(what)g(it)g(means)f (to)h(fall,)507 b(y)-31 b(ou)479 b(will)0 11166 y(understand)369 b(the)g(general)h(implication)j(of)d(this)f(sen)-31 b(tence.)0 13337 y(Although)279 b(formal)g(and)e(natural)i(languages)g(ha)-31 b(v)g(e)278 b(man)-31 b(y)279 b(features)e(in)h(common|tok)-31 b(ens,)0 14692 y(structure,)369 b(syn)-31 b(tax,)371 b(and)e(seman)-31 b(tics|there)371 b(are)e(man)-31 b(y)370 b(di\256erences:)0 17348 y Fv(am)-35 b(biguit)g(y:)552 b Fn(Natural)481 b(languages)g(are)e(full)h(of)g(am)-31 b(biguit)g(y)-92 b(,)511 b(whic)-31 b(h)480 b(p)31 b(eople)480 b(deal)g(with)2767 18703 y(b)-31 b(y)469 b(using)g(con)-31 b(textual)471 b(clues)d(and)h(other)g(information.)793 b(F)-92 b(ormal)469 b(languages)h(are)2767 20058 y(designed)376 b(to)h(b)31 b(e)375 b(nearly)i(or)e(completely)j(unam)-31 b(biguous,)380 b(whic)-31 b(h)377 b(means)f(that)h(an)-31 b(y)2767 21413 y(statemen)g(t)372 b(has)d(exactly)i(one)e(meaning,)i (regardless)e(of)h(con)-31 b(text.)0 23665 y Fv(redundancy:)554 b Fn(In)442 b(order)e(to)j(mak)-31 b(e)443 b(up)e(for)h(am)-31 b(biguit)g(y)445 b(and)d(reduce)e(misunderstand-)2767 25019 y(ings,)415 b(natural)406 b(languages)g(emplo)-31 b(y)407 b(lots)e(of)h(redundancy)-92 b(.)599 b(As)404 b(a)h(result,)414 b(they)405 b(are)2767 26374 y(often)371 b(v)-31 b(erb)31 b(ose.)492 b(F)-92 b(ormal)370 b(languages)h(are)e (less)f(redundan)-31 b(t)370 b(and)f(more)h(concise.)0 28626 y Fv(literalness:)553 b Fn(Natural)402 b(languages)g(are)f(full)g (of)g(idiom)h(and)e(metaphor.)588 b(If)400 b(I)f(sa)-31 b(y)-92 b(,)409 b(\\The)2767 29981 y(other)471 b(sho)31 b(e)470 b(fell,")497 b(there)470 b(is)g(probably)h(no)f(sho)31 b(e)470 b(and)h(nothing)g(falling.)798 b(F)-92 b(ormal)2767 31336 y(languages)371 b(mean)f(exactly)h(what)g(they)e(sa)-31 b(y)-92 b(.)0 33992 y(P)-31 b(eople)324 b(who)g(gro)-31 b(w)323 b(up)g(sp)31 b(eaking)323 b(a)g(natural)h(language|ev)-31 b(ery)g(one|often)327 b(ha)-31 b(v)g(e)324 b(a)f(hard)0 35347 y(time)285 b(adjusting)h(to)e(formal)i(languages.)466 b(In)283 b(some)h(w)-31 b(a)g(ys,)303 b(the)284 b(di\256erence)g(b)31 b(et)-31 b(w)g(een)284 b(formal)0 36702 y(and)364 b(natural)i(language) g(is)e(lik)-31 b(e)366 b(the)e(di\256erence)g(b)31 b(et)-31 b(w)g(een)365 b(p)31 b(o)g(etry)365 b(and)f(prose,)h(but)g(more)0 38057 y(so:)0 40714 y Fv(P)-35 b(o)35 b(etry:)554 b Fn(W)-92 b(ords)365 b(are)h(used)g(for)g(their)h(sounds)e(as)h(w)-31 b(ell)368 b(as)e(for)g(their)g(meaning,)j(and)e(the)2767 42069 y(whole)396 b(p)31 b(o)g(em)394 b(together)i(creates)e(an)h (e\256ect)f(or)g(emotional)k(resp)31 b(onse.)567 b(Am)-31 b(biguit)g(y)2767 43424 y(is)370 b(not)f(only)i(common)f(but)g(often)g (delib)31 b(erate.)0 45675 y Fv(Prose:)555 b Fn(The)329 b(literal)i(meaning)g(of)e(w)-31 b(ords)330 b(is)f(more)g(imp)31 b(ortan)-31 b(t,)340 b(and)330 b(the)f(structure)g(con-)2767 47030 y(tributes)416 b(more)g(meaning.)632 b(Prose)415 b(is)h(more)f(amenable)i(to)f(analysis)h(than)f(p)31 b(o)g(etry)2767 48385 y(but)370 b(still)g(often)h(am)-31 b(biguous.)0 50636 y Fv(Programs:)555 b Fn(The)427 b(meaning)i(of)e(a)h (computer)f(program)h(is)f(unam)-31 b(biguous)429 b(and)f(literal,)2767 51991 y(and)370 b(can)f(b)31 b(e)369 b(understo)31 b(o)g(d)369 b(en)-31 b(tirely)370 b(b)-31 b(y)370 b(analysis)g(of)g(the)f(tok)-31 b(ens)370 b(and)g(structure.)0 54648 y(Here)396 b(are)h(some)g (suggestions)h(for)f(reading)h(programs)f(\(and)h(other)f(formal)h (languages\).)0 56003 y(First,)390 b(remem)-31 b(b)31 b(er)386 b(that)i(formal)f(languages)h(are)e(m)-31 b(uc)g(h)387 b(more)f(dense)g(than)h(natural)g(lan-)0 57358 y(guages,)313 b(so)296 b(it)i(tak)-31 b(es)297 b(longer)h(to)f(read)g(them.)469 b(Also,)312 b(the)297 b(structure)g(is)f(v)-31 b(ery)297 b(imp)31 b(ortan)-31 b(t,)314 b(so)p eop %%Page: 8 34 8 33 bop 0 -2070 a Fv(8)24022 b(The)424 b(w)-35 b(a)g(y)424 b(of)h(the)g(program)p 0 -1627 38191 45 v 0 865 a Fn(it)372 b(is)f(usually)h(not)g(a)f(go)31 b(o)g(d)372 b(idea)g(to)f(read)g(from) h(top)g(to)f(b)31 b(ottom,)374 b(left)e(to)g(righ)-31 b(t.)499 b(Instead,)0 2220 y(learn)314 b(to)h(parse)f(the)h(program)g (in)f(y)-31 b(our)315 b(head,)325 b(iden)-31 b(tifying)317 b(the)e(tok)-31 b(ens)315 b(and)f(in)-31 b(terpreting)0 3575 y(the)388 b(structure.)549 b(Finally)-92 b(,)395 b(the)388 b(details)i(matter.)551 b(Little)389 b(things)g(lik)-31 b(e)390 b(sp)31 b(elling)389 b(errors)e(and)0 4930 y(bad)371 b(punctuation,)j(whic)-31 b(h)372 b(y)-31 b(ou)372 b(can)f(get)g(a)-31 b(w)g(a)g(y)373 b(with)g(in)e(natural)h(languages,)i(can)d(mak)-31 b(e)0 6285 y(a)369 b(big)h(di\256erence)f(in)h(a)f(formal)i(language.)0 10942 y Fl(1.5)1793 b(The)598 b(\257rst)h(program)0 13509 y Fn(T)-92 b(raditionally)g(,)609 b(the)558 b(\257rst)g(program)h (written)g(in)f(a)h(new)f(language)i(is)e(called)h(\\Hello,)0 14864 y(W)-92 b(orld!")494 b(b)31 b(ecause)369 b(all)i(it)f(do)31 b(es)369 b(is)h(displa)-31 b(y)371 b(the)e(w)-31 b(ords,)371 b(\\Hello,)h(W)-92 b(orld!")494 b(In)369 b(Python,)i(it)0 16219 y(lo)31 b(oks)370 b(lik)-31 b(e)370 b(this:)0 18514 y Fk(print)582 b("Hello,)g(World!")0 20809 y Fn(This)279 b(is)g(an)h(example)g(of)f(a)h Fv(prin)-35 b(t)320 b(statemen)-35 b(t)p Fn(,)298 b(whic)-31 b(h)280 b(do)31 b(esn't)280 b(actually)h(prin)-31 b(t)280 b(an)-31 b(ything)0 22164 y(on)350 b(pap)31 b(er.)486 b(It)350 b(displa)-31 b(ys)351 b(a)g(v)-61 b(alue)350 b(on)g(the)h(screen.)485 b(In)349 b(this)i(case,)j(the)c(result)g(is)g(the)h(w)-31 b(ords)0 24459 y Fk(Hello,)582 b(World!)0 26754 y Fn(The)363 b(quotation)j (marks)d(in)h(the)f(program)h(mark)f(the)h(b)31 b(eginning)364 b(and)f(end)g(of)h(the)f(v)-61 b(alue;)0 28109 y(they)370 b(don't)g(app)31 b(ear)369 b(in)h(the)f(result.)0 30323 y(Some)382 b(p)31 b(eople)381 b(judge)h(the)f(qualit)-31 b(y)383 b(of)f(a)f(programming)i(language)g(b)-31 b(y)381 b(the)h(simplicit)-31 b(y)383 b(of)0 31678 y(the)393 b(\\Hello,)401 b(W)-92 b(orld!")563 b(program.)h(By)393 b(this)g(standard,)399 b(Python)394 b(do)31 b(es)393 b(ab)31 b(out)393 b(as)g(w)-31 b(ell)394 b(as)0 33033 y(p)31 b(ossible.)0 37690 y Fl(1.6)1793 b(Glossary)0 39904 y Fv(problem)425 b(solving:)554 b Fn(The)464 b(pro)31 b(cess)463 b(of)i(form)-31 b(ulating)468 b(a)c(problem,)489 b(\257nding)465 b(a)g(solution,)2767 41259 y(and)370 b(expressing)f(the)g(solution.)0 43590 y Fv(high-lev)-35 b(el)425 b(language:)554 b Fn(A)430 b(programming)i(language)g(lik)-31 b(e)431 b(Python)h(that)f(is)f(designed)2767 44945 y(to)370 b(b)31 b(e)369 b(easy)g(for)h(h)-31 b(umans)369 b(to)h(read)f(and)h (write.)0 47276 y Fv(lo)-35 b(w-lev)g(el)424 b(language:)555 b Fn(A)360 b(programming)i(language)g(that)f(is)f(designed)g(to)g(b)31 b(e)360 b(easy)g(for)2767 48631 y(a)379 b(computer)h(to)f(execute;)384 b(also)379 b(called)h(\\mac)-31 b(hine)381 b(language")g(or)d(\\assem) -31 b(bly)380 b(lan-)2767 49986 y(guage.")0 52317 y Fv(p)35 b(ortabilit)-35 b(y:)553 b Fn(A)389 b(prop)31 b(ert)-31 b(y)389 b(of)h(a)g(program)g(that)g(can)g(run)e(on)i(more)f(than)h(one) g(kind)f(of)2767 53672 y(computer.)0 56003 y Fv(in)-35 b(terpret:)554 b Fn(T)-92 b(o)340 b(execute)g(a)g(program)h(in)e(a)h (high-lev)-31 b(el)342 b(language)g(b)-31 b(y)339 b(translating)j(it)f (one)2767 57358 y(line)370 b(at)g(a)g(time.)p eop %%Page: 9 35 9 34 bop 0 -2070 a Fv(1.6)425 b(Glossary)30693 b(9)p 0 -1627 38191 45 v 0 865 a(compile:)553 b Fn(T)-92 b(o)421 b(translate)h(a)e(program)i(written)f(in)g(a)g(high-lev)-31 b(el)422 b(language)h(in)-31 b(to)422 b(a)e(lo)-31 b(w-)2767 2220 y(lev)g(el)371 b(language)g(all)g(at)f(once,)f(in)h(preparation)g (for)g(later)g(execution.)0 4455 y Fv(source)426 b(co)35 b(de:)554 b Fn(A)369 b(program)h(in)g(a)f(high-lev)-31 b(el)372 b(language)f(b)31 b(efore)369 b(b)31 b(eing)369 b(compiled.)0 6691 y Fv(ob)71 b(ject)425 b(co)35 b(de:)554 b Fn(The)370 b(output)g(of)g(the)f(compiler)i(after)f(it)f(translates)i (the)e(program.)0 8926 y Fv(executable:)554 b Fn(Another)370 b(name)g(for)f(ob)61 b(ject)370 b(co)31 b(de)370 b(that)g(is)f(ready)g (to)h(b)31 b(e)369 b(executed.)0 11162 y Fv(script:)553 b Fn(A)369 b(program)h(stored)f(in)h(a)f(\257le)h(\(usually)h(one)e (that)h(will)h(b)31 b(e)369 b(in)-31 b(terpreted\).)0 13397 y Fv(program:)554 b Fn(A)370 b(set)f(of)g(instructions)i(that)f (sp)31 b(eci\257es)368 b(a)i(computation.)0 15633 y Fv(algorithm:)553 b Fn(A)370 b(general)g(pro)31 b(cess)368 b(for)h(solving)i(a)e (category)i(of)f(problems.)0 17868 y Fv(bug:)554 b Fn(An)369 b(error)f(in)i(a)f(program.)0 20104 y Fv(debugging:)556 b Fn(The)520 b(pro)31 b(cess)519 b(of)i(\257nding)g(and)f(remo)-31 b(ving)522 b(an)-31 b(y)521 b(of)g(the)f(three)g(kinds)g(of)2767 21459 y(programming)372 b(errors.)0 23694 y Fv(syn)-35 b(tax:)553 b Fn(The)369 b(structure)g(of)g(a)h(program.)0 25929 y Fv(syn)-35 b(tax)424 b(error:)555 b Fn(An)420 b(error)g(in)h(a)f(program)i(that)g(mak)-31 b(es)421 b(it)g(imp)31 b(ossible)422 b(to)f(parse)f(\(and)2767 27284 y(therefore)370 b(imp)31 b(ossible)370 b(to)g(in)-31 b(terpret\).)0 29520 y Fv(run)c(time)425 b(error:)554 b Fn(An)335 b(error)e(that)j(do)31 b(es)334 b(not)i(o)31 b(ccur)334 b(un)-31 b(til)336 b(the)e(program)i(has)e(started)h(to)2767 30875 y(execute)370 b(but)f(that)i(prev)-31 b(en)g(ts)369 b(the)h(program)g(from)f(con)-31 b(tin)g(uing.)0 33110 y Fv(exception:)554 b Fn(Another)370 b(name)g(for)f(a)h(run)-31 b(time)370 b(error.)0 35346 y Fv(seman)-35 b(tic)424 b(error:)555 b Fn(An)302 b(error)f(in)i(a)g(program)g(that)g(mak)-31 b(es)304 b(it)f(do)f(something)j(other)d(than)2767 36701 y(what)371 b(the)e(programmer)h(in)-31 b(tended.)0 38936 y Fv(seman)c(tics:)553 b Fn(The)369 b(meaning)i(of)f(a)f(program.)0 41171 y Fv(natural)424 b(language:)555 b Fn(An)-31 b(y)418 b(one)g(of)h(the)f(languages)i(that)f(p)31 b(eople)418 b(sp)31 b(eak)418 b(that)h(ev)-31 b(olv)g(ed)2767 42526 y(naturally)-92 b(.)0 44762 y Fv(formal)424 b(language:)555 b Fn(An)-31 b(y)542 b(one)g(of)g(the)h(languages)g(that)g(p)31 b(eople)543 b(ha)-31 b(v)g(e)543 b(designed)f(for)2767 46117 y(sp)31 b(eci\257c)481 b(purp)31 b(oses,)509 b(suc)-31 b(h)481 b(as)g(represen)-31 b(ting)482 b(mathematical)j(ideas)d(or)f (computer)2767 47472 y(programs;)371 b(all)f(programming)h(languages)g (are)e(formal)i(languages.)0 49707 y Fv(tok)-35 b(en:)554 b Fn(One)327 b(of)g(the)g(basic)h(elemen)-31 b(ts)328 b(of)f(the)h(syn)-31 b(tactic)329 b(structure)d(of)i(a)f(program,)337 b(anal-)2767 51062 y(ogous)370 b(to)g(a)g(w)-31 b(ord)370 b(in)f(a)h(natural)g(language.)0 53297 y Fv(parse:)554 b Fn(T)-92 b(o)370 b(examine)g(a)g(program)g(and)f(analyze)i(the)e(syn) -31 b(tactic)371 b(structure.)0 55533 y Fv(prin)-35 b(t)424 b(statemen)-35 b(t:)554 b Fn(An)283 b(instruction)g(that)h(causes)e (the)h(Python)h(in)-31 b(terpreter)282 b(to)i(displa)-31 b(y)2767 56888 y(a)370 b(v)-61 b(alue)370 b(on)f(the)g(screen.)p eop %%Page: 10 36 10 35 bop 0 -2070 a Fv(10)23386 b(The)424 b(w)-35 b(a)g(y)424 b(of)h(the)g(program)p 0 -1627 38191 45 v eop %%Page: 11 37 11 36 bop 0 9917 a Fi(Chapter)861 b(2)0 16212 y Fo(V)-258 b(ariables,)1032 b(expressions)i(and)0 19599 y(statemen)-86 b(ts)0 26753 y Fl(2.1)1793 b(V)-149 b(alues)598 b(and)g(t)-50 b(yp)50 b(es)0 29136 y Fn(A)452 b Fv(v)-71 b(alue)453 b Fn(is)f(one)g(of)h(the)g(fundamen)-31 b(tal)455 b(things|lik)-31 b(e)454 b(a)f(letter)g(or)f(a)h(n)-31 b(um)g(b)31 b(er|that)454 b(a)0 30491 y(program)334 b(manipulates.)484 b(The)333 b(v)-61 b(alues)334 b(w)-31 b(e)334 b(ha)-31 b(v)g(e)335 b(seen)e(so)h(far)f(are)h Fk(2)g Fn(\(the)g(result)g(when)f(w)-31 b(e)0 31845 y(added)369 b Fk(1)582 b(+)f(1)p Fn(\),)370 b(and)g Fk("Hello,)582 b(World!")p Fn(.)0 33894 y(These)388 b(v)-61 b(alues)388 b(b)31 b(elong)389 b(to)g(di\256eren)-31 b(t)389 b Fv(t)-35 b(yp)35 b(es)p Fn(:)531 b Fk(2)388 b Fn(is)g(an)g(in)-31 b(teger,)395 b(and)388 b Fk("Hello,)582 b(World!")0 35249 y Fn(is)472 b(a)g Fv(string)p Fn(,)499 b(so-called)473 b(b)31 b(ecause)471 b(it)i(con)-31 b(tains)473 b(a)f(\\string")i(of)e(letters.)801 b(Y)-92 b(ou)472 b(\(and)h(the)0 36604 y(in)-31 b(terpreter\))370 b(can)f(iden)-31 b(tify)371 b(strings)f(b)31 b(ecause)368 b(they)i(are)f(enclosed)g(in)h (quotation)i(marks.)0 38653 y(The)d(prin)-31 b(t)370 b(statemen)-31 b(t)371 b(also)f(w)-31 b(orks)370 b(for)f(in)-31 b(tegers.)0 40783 y Fk(>>>)582 b(print)f(4)0 42138 y(4)0 44268 y Fn(If)369 b(y)-31 b(ou)370 b(are)f(not)h(sure)e(what)i(t)-31 b(yp)31 b(e)370 b(a)g(v)-61 b(alue)369 b(has,)h(the)f(in)-31 b(terpreter)369 b(can)h(tell)g(y)-31 b(ou.)0 46397 y Fk(>>>)582 b(type\("Hello,)h(World!"\))0 47752 y()0 49107 y(>>>)g(type\(17\))0 50462 y()0 52592 y Fn(Not)401 b(surprisingly)-92 b(,)408 b(strings)400 b(b)31 b(elong)400 b(to)h(the)f(t)-31 b(yp)31 b(e)400 b Fk(string)h Fn(and)f(in)-31 b(tegers)400 b(b)31 b(elong)401 b(to)g(the)0 53947 y(t)-31 b(yp)31 b(e)344 b Fk(int)p Fn(.)484 b(Less)343 b(ob)-31 b(viously)-92 b(,)351 b(n)-31 b(um)g(b)31 b(ers)343 b(with)i(a)f(decimal)h(p)31 b(oin)-31 b(t)345 b(b)31 b(elong)344 b(to)h(a)f(t)-31 b(yp)31 b(e)344 b(called)0 55302 y Fk(float)p Fn(,)607 b(b)31 b(ecause)559 b(these)g(n)-31 b(um)g(b)31 b(ers)559 b(are)f(represen)-31 b(ted)559 b(in)g(a)g(format)i(called)f Fv(\260oating-)0 56657 y(p)35 b(oin)-35 b(t)p Fn(.)p eop %%Page: 12 38 12 37 bop 0 -2070 a Fv(12)15858 b(V)-106 b(ariables,)424 b(expressions)j(and)d(statemen)-35 b(ts)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(type\(3.2\))0 2220 y()0 4478 y Fn(What)350 b(ab)31 b(out)351 b(v)-61 b(alues)350 b(lik)-31 b(e)350 b Fk("17")h Fn(and)e Fk("3.2")p Fn(?)486 b(They)351 b(lo)31 b(ok)350 b(lik)-31 b(e)351 b(n)-31 b(um)g(b)31 b(ers,)354 b(but)c(they)g(are)0 5833 y(in)369 b(quotation)k(marks)c(lik)-31 b(e)370 b(strings.)0 8090 y Fk(>>>)582 b(type\("17"\))0 9445 y()0 10800 y(>>>)g(type\("3.2"\))0 12155 y()0 14413 y Fn(They're)370 b(strings.)0 16590 y(When)386 b(y)-31 b(ou)387 b(t)-31 b(yp)31 b(e)387 b(a)f(large)i(in)-31 b(teger,)392 b(y)-31 b(ou)387 b(migh)-31 b(t)388 b(b)31 b(e)386 b(tempted)h(to)h(use)d(commas)j(b)31 b(et)-31 b(w)g(een)0 17945 y(groups)405 b(of)h(three)f(digits,)416 b(as)406 b(in)f Fk(1,000,000)p Fn(.)602 b(This)406 b(is)f(not)i(a)e (legal)i(in)-31 b(teger)407 b(in)e(Python,)0 19299 y(but)369 b(it)h(is)g(a)f(legal)i(expression:)0 21557 y Fk(>>>)582 b(print)f(1,000,000)0 22912 y(1)g(0)h(0)0 25170 y Fn(W)-92 b(ell,)498 b(that's)474 b(not)e(what)h(w)-31 b(e)473 b(exp)31 b(ected)472 b(at)g(all!)802 b(Python)474 b(in)-31 b(terprets)472 b Fk(1,000,000)h Fn(as)f(a)0 26525 y(comma-separated)g (list)f(of)g(three)f(in)-31 b(tegers,)496 b(whic)-31 b(h)471 b(it)g(prin)-31 b(ts)470 b(consecutiv)-31 b(ely)-92 b(.)798 b(This)470 b(is)0 27880 y(the)547 b(\257rst)f(example)h(w)-31 b(e)547 b(ha)-31 b(v)g(e)548 b(seen)e(of)g(a)h(seman)-31 b(tic)548 b(error:)846 b(the)547 b(co)31 b(de)546 b(runs)g(without)0 29235 y(pro)31 b(ducing)370 b(an)f(error)f(message,)i(but)g(it)g(do)31 b(esn't)370 b(do)f(the)g(\\righ)-31 b(t")372 b(thing.)0 33780 y Fl(2.2)1793 b(V)-149 b(ariables)0 36295 y Fn(One)388 b(of)g(the)h(most)g(p)31 b(o)-31 b(w)g(erful)389 b(features)f(of)h(a)f (programming)j(language)f(is)e(the)g(abilit)-31 b(y)391 b(to)0 37650 y(manipulate)372 b Fv(v)-71 b(ariables)p Fn(.)492 b(A)370 b(v)-61 b(ariable)370 b(is)f(a)g(name)h(that)h(refers) d(to)i(a)f(v)-61 b(alue.)0 39827 y(The)369 b Fv(assignmen)-35 b(t)425 b(statemen)-35 b(t)370 b Fn(creates)f(new)h(v)-61 b(ariables)369 b(and)h(giv)-31 b(es)370 b(them)g(v)-61 b(alues:)0 42084 y Fk(>>>)582 b(message)g(=)f("What's)h(up,)g(Doc?")0 43439 y(>>>)g(n)f(=)g(17)0 44794 y(>>>)h(pi)f(=)g(3.14159)0 47052 y Fn(This)471 b(example)g(mak)-31 b(es)471 b(three)f(assignmen) -31 b(ts.)797 b(The)470 b(\257rst)g(assigns)g(the)h(string)f Fk("What's)0 48407 y(up,)582 b(Doc?")381 b Fn(to)g(a)g(new)g(v)-61 b(ariable)381 b(named)h Fk(message)p Fn(.)528 b(The)380 b(second)h(giv)-31 b(es)381 b(the)g(in)-31 b(teger)382 b Fk(17)0 49762 y Fn(to)370 b Fk(n)p Fn(,)g(and)f(the)g(third)h(giv)-31 b(es)370 b(the)f(\260oating-p)31 b(oin)-31 b(t)373 b(n)-31 b(um)g(b)31 b(er)369 b Fk(3.14159)h Fn(to)g Fk(pi)p Fn(.)0 51938 y(A)448 b(common)i(w)-31 b(a)g(y)449 b(to)g(represen)-31 b(t)447 b(v)-61 b(ariables)449 b(on)f(pap)31 b(er)448 b(is)g(to)h(write)f(the)h(name)f(with)i(an)0 53293 y(arro)-31 b(w)506 b(p)31 b(oin)-31 b(ting)507 b(to)f(the)g(v)-61 b(ariable's)506 b(v)-61 b(alue.)901 b(This)506 b(kind)g(of)f(\257gure)g (is)h(called)g(a)g Fv(state)0 54648 y(diagram)374 b Fn(b)31 b(ecause)374 b(it)h(sho)-31 b(ws)375 b(what)g(state)g(eac)-31 b(h)375 b(of)g(the)g(v)-61 b(ariables)375 b(is)f(in)g(\(think)i(of)f (it)g(as)0 56003 y(the)385 b(v)-61 b(ariable's)386 b(state)g(of)f (mind\).)541 b(This)385 b(diagram)h(sho)-31 b(ws)385 b(the)g(result)g(of)g(the)g(assignmen)-31 b(t)0 57358 y(statemen)g(ts:)p eop %%Page: 13 39 13 38 bop 0 -2070 a Fv(2.3)425 b(V)-106 b(ariable)424 b(names)h(and)g(k)-35 b(eyw)g(ords)18326 b(13)p 0 -1627 38191 45 v 9484 -242 a 11380244 4012687 0 0 11380244 4012687 startTexFig 9484 -242 a %%BeginDocument: illustrations/state2.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: state2.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 09:26:35 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 173 61 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 61 moveto 0 0 lineto 173 0 lineto 173 61 lineto closepath clip newpath -71.0 118.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 1200 975 m 4050 975 l 4050 1950 l 1200 1950 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 2490 1477 m 2490 1417 l 2338 1417 l 2458 1447 l 2338 1477 l cp eoclip n 2100 1447 m 2475 1447 l gs col0 s gr gr % arrowhead n 2338 1477 m 2458 1447 l 2338 1417 l col0 s % Polyline gs clippath 2490 1777 m 2490 1717 l 2338 1717 l 2458 1747 l 2338 1777 l cp eoclip n 2100 1747 m 2475 1747 l gs col0 s gr gr % arrowhead n 2338 1777 m 2458 1747 l 2338 1717 l col0 s % Polyline gs clippath 2490 1177 m 2490 1117 l 2338 1117 l 2458 1147 l 2338 1177 l cp eoclip n 2100 1147 m 2475 1147 l gs col0 s gr gr % arrowhead n 2338 1177 m 2458 1147 l 2338 1117 l col0 s /Helvetica ff 165.00 scf sf 2025 1200 m gs 1 -1 sc (message) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1500 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1800 m gs 1 -1 sc (pi) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1200 m gs 1 -1 sc ("What's up, Doc?") col0 sh gr /Helvetica ff 165.00 scf sf 2550 1500 m gs 1 -1 sc (17) col0 sh gr /Helvetica ff 165.00 scf sf 2550 1800 m gs 1 -1 sc (3.14159) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 8696 a Fn(The)369 b(prin)-31 b(t)370 b(statemen)-31 b(t)371 b(also)f(w)-31 b(orks)370 b(with)g(v)-61 b(ariables.)0 11098 y Fk(>>>)582 b(print)f(message)0 12453 y(What's)h(up,)g(Doc?)0 13808 y(>>>)g(print)f(n)0 15163 y(17)0 16518 y(>>>)h(print)f(pi)0 17873 y(3.14159)0 20276 y Fn(In)425 b(eac)-31 b(h)427 b(case)e(the)i(result)e(is)h(the)g(v)-61 b(alue)427 b(of)f(the)g(v)-61 b(ariable.)664 b(V)-92 b(ariables)427 b(also)f(ha)-31 b(v)g(e)427 b(t)-31 b(yp)31 b(es;)0 21631 y(again,)371 b(w)-31 b(e)370 b(can)g(ask)f(the)g(in)-31 b(terpreter)370 b(what)g(they)g(are.)0 24033 y Fk(>>>)582 b(type\(message\))0 25388 y()0 26743 y(>>>)g(type\(n\))0 28098 y()0 29453 y(>>>)g(type\(pi\))0 30808 y()0 33211 y Fn(The)369 b(t)-31 b(yp)31 b(e)370 b(of)g(a)f(v)-61 b(ariable)370 b(is)g(the)f(t)-31 b(yp)31 b(e)370 b(of)f(the)h(v)-61 b(alue)369 b(it)h(refers)e(to.)0 38191 y Fl(2.3)1793 b(V)-149 b(ariable)598 b(names)h(and)f(k)-50 b(eyw)g(ords)0 40909 y Fn(Programmers)383 b(generally)h(c)-31 b(ho)31 b(ose)383 b(names)g(for)g(their)f(v)-61 b(ariables)384 b(that)f(are)g(meaningful|)0 42264 y(they)370 b(do)31 b(cumen)-31 b(t)370 b(what)g(the)g(v)-61 b(ariable)370 b(is)f(used)g(for.)0 44585 y(V)-92 b(ariable)308 b(names)g(can)f(b)31 b(e)307 b(arbitrarily)h(long.)473 b(They)308 b(can)f(con)-31 b(tain)309 b(b)31 b(oth)308 b(letters)f(and)g(n)-31 b(um-)0 45940 y(b)31 b(ers,)342 b(but)337 b(they)f(ha)-31 b(v)g(e)338 b(to)f(b)31 b(egin)337 b(with)g(a)g(letter.)482 b(Although)339 b(it)e(is)f(legal)i(to)f(use)f(upp)31 b(ercase)0 47295 y(letters,)378 b(b)-31 b(y)376 b(con)-31 b(v)g(en)g(tion)379 b(w)-31 b(e)376 b(don't.)513 b(If)376 b(y)-31 b(ou)376 b(do,)i(remem)-31 b(b)31 b(er)376 b(that)h(case)e(matters.)513 b Fk(Bruce)0 48650 y Fn(and)369 b Fk(bruce)h Fn(are)f(di\256eren)-31 b(t)370 b(v)-61 b(ariables.)0 50972 y(The)410 b(underscore)f(c)-31 b(haracter)410 b(\()p 13278 50972 349 45 v 419 w(\))g(can)g(app)31 b(ear)409 b(in)h(a)g(name.)615 b(It)410 b(is)g(often)g(used)g(in)g (names)0 52327 y(with)370 b(m)-31 b(ultiple)372 b(w)-31 b(ords,)370 b(suc)-31 b(h)369 b(as)g Fk(my)p 15429 52327 V 419 w(name)g Fn(or)g Fk(price)p 22802 52327 V 419 w(of)p 24383 52327 V 419 w(tea)p 26545 52327 V 419 w(in)p 28126 52327 V 419 w(china)p Fn(.)0 54648 y(If)g(y)-31 b(ou)370 b(giv)-31 b(e)370 b(a)g(v)-61 b(ariable)370 b(an)f(illegal)j(name,)f(y) -31 b(ou)370 b(get)g(a)f(syn)-31 b(tax)370 b(error:)p eop %%Page: 14 40 14 39 bop 0 -2070 a Fv(14)15858 b(V)-106 b(ariables,)424 b(expressions)j(and)d(statemen)-35 b(ts)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(76trombones)g(=)g("big)f(parade")0 2220 y(SyntaxError:)i(invalid)f(syntax)0 3575 y(>>>)g(more$)f(=)h (1000000)0 4930 y(SyntaxError:)h(invalid)f(syntax)0 6285 y(>>>)g(class)f(=)h("Computer)g(Science)g(101")0 7640 y(SyntaxError:)h(invalid)f(syntax)0 9691 y(76trombones)399 b Fn(is)e(illegal)j(b)31 b(ecause)397 b(it)h(do)31 b(es)397 b(not)h(b)31 b(egin)397 b(with)i(a)e(letter.)578 b Fk(more$)398 b Fn(is)f(illegal)0 11046 y(b)31 b(ecause)353 b(it)h(con)-31 b(tains)355 b(an)f(illegal)i(c)-31 b(haracter,)358 b(the)353 b(dollar)i(sign.)488 b(But)354 b(what's)g(wrong)h(with)0 12401 y Fk(class)p Fn(?)0 14371 y(It)398 b(turns)f(out)h(that)h Fk(class)f Fn(is)f(one)h(of)g(the)g(Python)h Fv(k)-35 b(eyw)g(ords)p Fn(.)578 b(Keyw)-31 b(ords)398 b(de\257ne)g(the)0 15726 y(language's)371 b(rules)e(and)h(structure,)f(and)g(they)h (cannot)g(b)31 b(e)369 b(used)f(as)h(v)-61 b(ariable)371 b(names.)0 17696 y(Python)f(has)g(t)-31 b(w)g(en)g(t)g(y-eigh)g(t)373 b(k)-31 b(eyw)g(ords:)0 19747 y Fk(and)4068 b(continue)1164 b(else)3487 b(for)4069 b(import)2325 b(not)4069 b(raise)0 21102 y(assert)2325 b(def)4069 b(except)2325 b(from)3488 b(in)4649 b(or)h(return)0 22457 y(break)2906 b(del)4069 b(exec)3487 b(global)2326 b(is)4649 b(pass)3488 b(try)0 23812 y(class)2906 b(elif)3488 b(finally)1744 b(if)4650 b(lambda)2325 b(print)2907 b(while)0 25863 y Fn(Y)-92 b(ou)365 b(migh)-31 b(t)366 b(w)-31 b(an)g(t)366 b(to)f(k)-31 b(eep)365 b(this)g(list)g(handy)-92 b(.)492 b(If)364 b(the)g(in)-31 b(terpreter)365 b(complains)h(ab)31 b(out)366 b(one)0 27218 y(of)k(y)-31 b(our)369 b(v)-61 b(ariable)370 b(names)g(and)f(y)-31 b(ou)370 b(don't)h(kno)-31 b(w)370 b(wh)-31 b(y)-92 b(,)370 b(see)f(if)h(it)f(is)h(on)f(this)h(list.)0 31455 y Fl(2.4)1793 b(Statemen)-50 b(ts)0 33759 y Fn(A)311 b(statemen)-31 b(t)313 b(is)d(an)i(instruction)g(that)g(the)f(Python)h (in)-31 b(terpreter)311 b(can)g(execute.)474 b(W)-92 b(e)310 b(ha)-31 b(v)g(e)0 35114 y(seen)369 b(t)-31 b(w)g(o)370 b(kinds)g(of)f(statemen)-31 b(ts:)495 b(prin)-31 b(t)370 b(and)f(assignmen)-31 b(t.)0 37084 y(When)550 b(y)-31 b(ou)551 b(t)-31 b(yp)31 b(e)550 b(a)h(statemen)-31 b(t)552 b(on)e(the)h(command)g(line,)597 b(Python)552 b(executes)e(it)h(and)0 38439 y(displa)-31 b(ys)429 b(the)g(result,)444 b(if)428 b(there)h(is)f(one.)670 b(The)429 b(result)f(of)h(a)g(prin)-31 b(t)429 b(statemen)-31 b(t)430 b(is)e(a)h(v)-61 b(alue.)0 39794 y(Assignmen)-31 b(t)371 b(statemen)-31 b(ts)370 b(don't)h(pro)31 b(duce)369 b(a)g(result.)0 41764 y(A)431 b(script)g(usually)i(con)-31 b(tains)433 b(a)e(sequence)g(of)h (statemen)-31 b(ts.)681 b(If)431 b(there)g(is)g(more)h(than)g(one)0 43119 y(statemen)-31 b(t,)372 b(the)d(results)g(app)31 b(ear)369 b(one)h(at)f(a)h(time)g(as)f(the)h(statemen)-31 b(ts)371 b(execute.)0 45089 y(F)-92 b(or)368 b(example,)j(the)f(script) 0 47140 y Fk(print)582 b(1)0 48495 y(x)f(=)h(2)0 49850 y(print)g(x)0 51901 y Fn(pro)31 b(duces)368 b(the)i(output)0 53952 y Fk(1)0 55307 y(2)0 57358 y Fn(Again,)h(the)f(assignmen)-31 b(t)370 b(statemen)-31 b(t)372 b(pro)31 b(duces)368 b(no)h(output.)p eop %%Page: 15 41 15 40 bop 0 -2070 a Fv(2.5)425 b(Ev)-71 b(aluating)425 b(expressions)22241 b(15)p 0 -1627 38191 45 v 0 865 a Fl(2.5)1793 b(Ev)-100 b(aluating)599 b(expressions)0 4092 y Fn(An)379 b(expression)f(is)g(a)h(com)-31 b(bination)382 b(of)d(v)-61 b(alues,)381 b(v)-61 b(ariables,)382 b(and)d(op)31 b(erators.)521 b(If)378 b(y)-31 b(ou)379 b(t)-31 b(yp)31 b(e)0 5447 y(an)414 b(expression)f(on)g(the)h(command)g(line,)426 b(the)413 b(in)-31 b(terpreter)414 b Fv(ev)-71 b(aluates)413 b Fn(it)h(and)g(displa)-31 b(ys)0 6802 y(the)369 b(result:)0 9568 y Fk(>>>)582 b(1)f(+)g(1)0 10922 y(2)0 13688 y Fn(Although)517 b(expressions)e(con)-31 b(tain)517 b(v)-61 b(alues,)552 b(v)-61 b(ariables,)553 b(and)515 b(op)31 b(erators,)553 b(not)516 b(ev)-31 b(ery)515 b(ex-)0 15043 y(pression)468 b(con)-31 b(tains)469 b(all)g(of)g(these)f(elemen)-31 b(ts.)790 b(A)468 b(v)-61 b(alue)468 b(all)i(b)-31 b(y)468 b(itself)h(is)f(considered)g(an)0 16398 y(expression,)369 b(and)h(so)f(is)g(a)h(v)-61 b(ariable.)0 19164 y Fk(>>>)582 b(17)0 20519 y(17)0 21874 y(>>>)g(x)0 23229 y(2)0 25995 y Fn(Confusingly)-92 b(,)383 b(ev)-61 b(aluating)381 b(an)d(expression)g(is)g(not)h(quite)g(the)g(same)f(thing)i(as)e(prin) -31 b(ting)380 b(a)0 27350 y(v)-61 b(alue.)0 30116 y Fk(>>>)582 b(message)g(=)f("What's)h(up,)g(Doc?")0 31471 y(>>>)g(message)0 32826 y("What's)g(up,)g(Doc?")0 34181 y(>>>)g(print)f(message)0 35536 y(What's)h(up,)g(Doc?)0 38302 y Fn(When)382 b(Python)j(displa)-31 b(ys)383 b(the)g(v)-61 b(alue)384 b(of)f(an)g(expression,)k(it)d(uses)d(the)j(same)f(format)h (y)-31 b(ou)0 39657 y(w)g(ould)413 b(use)d(to)i(en)-31 b(ter)412 b(a)f(v)-61 b(alue.)620 b(In)410 b(the)i(case)f(of)h (strings,)422 b(that)412 b(means)g(that)h(it)f(includes)0 41012 y(the)296 b(quotation)k(marks.)468 b(But)297 b(the)f(prin)-31 b(t)297 b(statemen)-31 b(t)298 b(prin)-31 b(ts)296 b(the)h(v)-61 b(alue)297 b(of)f(the)h(expression,)0 42367 y(whic)-31 b(h)370 b(in)g(this)f(case)g(is)g(the)h(con)-31 b(ten)g(ts)370 b(of)g(the)f(string.)0 45052 y(In)475 b(a)g(script,)502 b(an)475 b(expression)g(all)i(b)-31 b(y)475 b(itself)h(is)f(a)h(legal)h (statemen)-31 b(t,)504 b(but)475 b(it)h(do)31 b(esn't)476 b(do)0 46406 y(an)-31 b(ything.)495 b(The)369 b(script)0 49172 y Fk(17)0 50527 y(3.2)0 51882 y("Hello,)582 b(World!")0 53237 y(1)f(+)h(1)0 56003 y Fn(pro)31 b(duces)496 b(no)h(output)h(at)f (all.)877 b(Ho)-31 b(w)497 b(w)-31 b(ould)499 b(y)-31 b(ou)497 b(c)-31 b(hange)498 b(the)f(script)f(to)i(displa)-31 b(y)498 b(the)0 57358 y(v)-61 b(alues)369 b(of)h(these)f(four)g (expressions?)p eop %%Page: 16 42 16 41 bop 0 -2070 a Fv(16)15858 b(V)-106 b(ariables,)424 b(expressions)j(and)d(statemen)-35 b(ts)p 0 -1627 38191 45 v 0 865 a Fl(2.6)1793 b(Op)50 b(erators)599 b(and)f(op)50 b(erands)0 3189 y Fv(Op)35 b(erators)406 b Fn(are)d(sp)31 b(ecial)405 b(sym)-31 b(b)31 b(ols)404 b(that)h(represen)-31 b(t)403 b(computations)k(lik)-31 b(e)405 b(addition)h(and)0 4544 y(m)-31 b(ultiplication.)497 b(The)370 b(v)-61 b(alues)369 b(the)h(op)31 b(erator)369 b(uses)g(are)g(called)h Fv(op)35 b(erands)p Fn(.)0 6534 y(The)451 b(follo)-31 b(wing)454 b(are)c(all)i(legal)g(Python)f(expressions)f(whose)h(meaning)h(is)e (more)h(or)f(less)0 7889 y(clear:)0 10366 y Fk(20+32)1744 b(hour-1)h(hour*60+minute)g(minute/60)g(5**2)f(\(5+9\)*\(15-7\))0 12842 y Fn(The)521 b(sym)-31 b(b)31 b(ols)522 b Fk(+)p Fn(,)559 b Fk(-)p Fn(,)g(and)521 b Fk(/)p Fn(,)560 b(and)521 b(the)g(use)f(of)h(paren)-31 b(thesis)522 b(for)f(grouping,)560 b(mean)522 b(in)0 14197 y(Python)481 b(what)g(they)g(mean)f(in)g (mathematics.)828 b(The)480 b(asterisk)g(\()p Fk(*)p Fn(\))h(is)f(the)g(sym)-31 b(b)31 b(ol)481 b(for)0 15552 y(m)-31 b(ultiplication,)375 b(and)369 b Fk(**)g Fn(is)g(the)h(sym)-31 b(b)31 b(ol)370 b(for)f(exp)31 b(onen)-31 b(tiation.)0 17543 y(When)417 b(a)g(v)-61 b(ariable)418 b(name)g(app)31 b(ears)417 b(in)g(the)g(place)h(of)g(an)f(op)31 b(erand,)430 b(it)417 b(is)g(replaced)h(with)0 18897 y(its)370 b(v)-61 b(alue)369 b(b)31 b(efore)369 b(the)h(op)31 b(eration)370 b(is)f(p)31 b(erformed.)0 20888 y(Addition,)449 b(subtraction,)g(m)-31 b(ultiplication,)452 b(and)432 b(exp)31 b(onen)-31 b(tiation)434 b(all)f(do)e(what)i(y)-31 b(ou)432 b(ex-)0 22243 y(p)31 b(ect,)440 b(but)425 b(y)-31 b(ou)426 b(migh)-31 b(t)427 b(b)31 b(e)424 b(surprised)g(b)-31 b(y)425 b(division.)662 b(The)425 b(follo)-31 b(wing)429 b(op)31 b(eration)427 b(has)e(an)0 23598 y(unexp)31 b(ected)369 b(result:)0 25669 y Fk(>>>)582 b(minute)g(=)f(59)0 27024 y(>>>)h(minute/60)0 28379 y(0)0 30450 y Fn(The)419 b(v)-61 b(alue)420 b(of)f Fk(minute)h Fn(is)f(59,)433 b(and)419 b(in)g(con)-31 b(v)g(en)g(tional)423 b(arithmetic)e(59)f(divided)g(b)-31 b(y)419 b(60)h(is)0 31805 y(0.98333,)495 b(not)467 b(0.)786 b(The)467 b(reason)f(for)h(the)g(discrepancy)g(is)g(that)g(Python)i(is) d(p)31 b(erforming)0 33160 y Fv(in)-35 b(teger)426 b(division)p Fn(.)0 35151 y(When)329 b(b)31 b(oth)330 b(of)g(the)g(op)31 b(erands)329 b(are)h(in)-31 b(tegers,)338 b(the)330 b(result)g(m)-31 b(ust)330 b(also)h(b)31 b(e)329 b(an)h(in)-31 b(teger,)339 b(and)0 36505 y(b)-31 b(y)291 b(con)-31 b(v)g(en)g(tion,)310 b(in)-31 b(teger)292 b(division)h(alw)-31 b(a)g(ys)293 b(rounds)e Fm(down)p Fn(,)306 b(ev)-31 b(en)291 b(in)h(cases)e(lik)-31 b(e)293 b(this)e(where)0 37860 y(the)369 b(next)h(in)-31 b(teger)370 b(is)f(v)-31 b(ery)370 b(close.)0 39851 y(A)432 b(p)31 b(ossible)432 b(solution)i(to)f(this)g(problem)g(is)f(to)g (calculate)j(a)d(p)31 b(ercen)-31 b(tage)433 b(rather)f(than)h(a)0 41206 y(fraction:)0 43277 y Fk(>>>)582 b(minute*100/60)0 44632 y(98)0 46703 y Fn(Again)326 b(the)g(result)f(is)f(rounded)h(do) -31 b(wn,)335 b(but)326 b(at)f(least)h(no)-31 b(w)326 b(the)f(answ)-31 b(er)326 b(is)f(appro)-31 b(ximately)0 48058 y(correct.)481 b(Another)333 b(alternativ)-31 b(e)336 b(is)d(to)i(use)d(\260oating-p)31 b(oin)-31 b(t)337 b(division,)343 b(whic)-31 b(h)334 b(w)-31 b(e)334 b(get)g(to)g(in)0 49413 y(Chapter)370 b(3.)0 53679 y Fl(2.7)1793 b(Order)599 b(of)e(op)50 b(erations)0 56003 y Fn(When)501 b(more)h(than)g(one)g(op) 31 b(erator)502 b(app)31 b(ears)501 b(in)g(an)h(expression,)535 b(the)502 b(order)e(of)i(ev)-61 b(alu-)0 57358 y(ation)450 b(dep)31 b(ends)448 b(on)g(the)h Fv(rules)516 b(of)g(precedence)p Fn(.)732 b(Python)450 b(follo)-31 b(ws)450 b(the)f(same)g(prece-)0 58713 y(dence)275 b(rules)g(for)g(its)h(mathematical)j(op)31 b(erators)276 b(that)g(mathematics)i(do)31 b(es.)461 b(The)276 b(acron)-31 b(ym)0 60068 y Fv(PEMD)c(AS)371 b Fn(is)e(a)g(useful)g(w)-31 b(a)g(y)371 b(to)f(remem)-31 b(b)31 b(er)369 b(the)g(order)g(of)h(op)31 b(erations:)p eop %%Page: 17 43 17 42 bop 0 -2070 a Fv(2.8)425 b(Op)35 b(erations)426 b(on)f(strings)22834 b(17)p 0 -1627 38191 45 v 1660 865 a Fj(\262)554 b Fv(P)p Fn(aren)-31 b(theses)545 b(ha)-31 b(v)g(e)545 b(the)f(highest)h(precedence)e(and)i(can)f(b)31 b(e)544 b(used)g(to)g(force)h(an)2767 2220 y(expression)373 b(to)g(ev)-61 b(aluate)375 b(in)e(the)g(order)f(y)-31 b(ou)373 b(w)-31 b(an)g(t.)505 b(Since)373 b(expressions)f(in)h(paren-) 2767 3575 y(theses)270 b(are)h(ev)-61 b(aluated)272 b(\257rst,)290 b Fk(2)581 b(*)g(\(3-1\))271 b Fn(is)g(4,)291 b(and)270 b Fk(\(1+1\)**\(5-2\))j Fn(is)d(8.)460 b(Y)-92 b(ou)271 b(can)2767 4930 y(also)395 b(use)e(paren)-31 b(theses)393 b(to)h(mak)-31 b(e)395 b(an)f(expression)f(easier)h(to)g(read,)400 b(as)393 b(in)h Fk(\(minute)2767 6285 y(*)582 b(100\))f(/)h(60)p Fn(,)370 b(ev)-31 b(en)369 b(though)h(it)g(do)31 b(esn't)370 b(c)-31 b(hange)370 b(the)g(result.)1660 8581 y Fj(\262)554 b Fv(E)p Fn(xp)31 b(onen)-31 b(tiation)413 b(has)c(the)g(next)g (highest)h(precedence,)418 b(so)409 b Fk(2**1+1)g Fn(is)g(3)g(and)g (not)2767 9936 y(4,)370 b(and)g Fk(3*1**3)g Fn(is)f(3)g(and)h(not)g (27.)1660 12232 y Fj(\262)554 b Fv(M)p Fn(ultiplication)478 b(and)473 b Fv(D)p Fn(ivision)h(ha)-31 b(v)g(e)474 b(the)f(same)g (precedence,)498 b(whic)-31 b(h)474 b(is)f(higher)2767 13587 y(than)334 b Fv(A)p Fn(ddition)g(and)f Fv(S)p Fn(ubtraction,)342 b(whic)-31 b(h)334 b(also)f(ha)-31 b(v)g(e)333 b(the)g(same)g (precedence.)480 b(So)2767 14942 y Fk(2*3-1)422 b Fn(yields)g(5)f (rather)g(than)h(4,)435 b(and)421 b Fk(2/3-1)h Fn(is)f Fk(-1)p Fn(,)435 b(not)422 b Fk(1)f Fn(\(remem)-31 b(b)31 b(er)421 b(that)i(in)2767 16297 y(in)-31 b(teger)371 b(division,)g Fk(2/3=0)p Fn(\).)1660 18593 y Fj(\262)554 b Fn(Op)31 b(erators)293 b(with)i(the)e(same)h(precedence)e(are)h(ev) -61 b(aluated)295 b(from)f(left)g(to)g(righ)-31 b(t.)468 b(So)294 b(in)2767 19948 y(the)400 b(expression)f Fk(minute*100/60)p Fn(,)408 b(the)400 b(m)-31 b(ultiplication)404 b(happ)31 b(ens)398 b(\257rst,)407 b(yielding)2767 21303 y Fk(5900/60)p Fn(,)459 b(whic)-31 b(h)440 b(in)g(turn)f(yields)h Fk(98)p Fn(.)704 b(If)439 b(the)h(op)31 b(erations)441 b(had)f(b)31 b(een)439 b(ev)-61 b(aluated)2767 22658 y(from)378 b(righ)-31 b(t)378 b(to)f(left,)k(the)c(result)g(w)-31 b(ould)378 b(ha)-31 b(v)g(e)378 b(b)31 b(een)376 b Fk(59*1)p Fn(,)k(whic)-31 b(h)378 b(is)f Fk(59)p Fn(,)i(whic)-31 b(h)378 b(is)2767 24013 y(wrong.)0 28613 y Fl(2.8)1793 b(Op)50 b(erations)598 b(on)g(strings)0 31154 y Fn(In)363 b(general,)i(y)-31 b(ou)364 b(cannot)g(p)31 b(erform)363 b(mathematical)k(op)31 b(erations)365 b(on)e(strings,)i(ev)-31 b(en)363 b(if)h(the)0 32509 y(strings)331 b(lo)31 b(ok)332 b(lik)-31 b(e)333 b(n)-31 b(um)g(b)31 b(ers.)479 b(The)332 b(follo)-31 b(wing)335 b(are)330 b(illegal)k(\(assuming)f(that)f Fk(message)g Fn(has)0 33864 y(t)-31 b(yp)31 b(e)370 b Fk(string)p Fn(\):)581 36140 y Fk(message-1)1745 b("Hello"/123)g (message*"Hello")h("15"+2)0 38416 y Fn(In)-31 b(terestingly)-92 b(,)496 b(the)469 b Fk(+)g Fn(op)31 b(erator)470 b(do)31 b(es)468 b(w)-31 b(ork)470 b(with)h(strings,)494 b(although)471 b(it)f(do)31 b(es)469 b(not)h(do)0 39771 y(exactly)312 b(what)g(y)-31 b(ou)312 b(migh)-31 b(t)312 b(exp)31 b(ect.)473 b(F)-92 b(or)310 b(strings,)323 b(the)311 b Fk(+)g Fn(op)31 b(erator)311 b(represen)-31 b(ts)309 b Fv(concate-)0 41126 y(nation)p Fn(,)327 b(whic)-31 b(h)317 b(means)g(joining)h(the)e (t)-31 b(w)g(o)318 b(op)31 b(erands)315 b(b)-31 b(y)316 b(linking)i(them)f(end-to-end.)476 b(F)-92 b(or)0 42481 y(example:)0 44757 y Fk(fruit)582 b(=)f("banana")0 46112 y(bakedGood)h(=)g(")f(nut)h(bread")0 47467 y(print)g(fruit)g(+)f (bakedGood)0 49743 y Fn(The)399 b(output)h(of)g(this)f(program)h(is)f Fk(banana)582 b(nut)g(bread)p Fn(.)g(The)400 b(space)e(b)31 b(efore)399 b(the)g(w)-31 b(ord)0 51098 y Fk(nut)477 b Fn(is)f(part)h(of)g(the)f(string,)505 b(and)476 b(is)h(necessary)e (to)i(pro)31 b(duce)476 b(the)h(space)f(b)31 b(et)-31 b(w)g(een)478 b(the)0 52453 y(concatenated)371 b(strings.)0 54648 y(The)533 b Fk(*)g Fn(op)31 b(erator)533 b(also)h(w)-31 b(orks)533 b(on)g(strings;)615 b(it)533 b(p)31 b(erforms)532 b(rep)31 b(etition.)985 b(F)-92 b(or)532 b(example,)0 56003 y Fk("Fun"*3)340 b Fn(is)g Fk("FunFunFun")p Fn(.)484 b(One)340 b(of)g(the)g(op)31 b(erands)339 b(has)g(to)i(b)31 b(e)339 b(a)h(string;)350 b(the)340 b(other)g(has)0 57358 y(to)370 b(b)31 b(e)369 b(an)g(in)-31 b(teger.)p eop %%Page: 18 44 18 43 bop 0 -2070 a Fv(18)15858 b(V)-106 b(ariables,)424 b(expressions)j(and)d(statemen)-35 b(ts)p 0 -1627 38191 45 v 0 865 a Fn(On)254 b(one)g(hand,)277 b(this)254 b(in)-31 b(terpretation)256 b(of)f Fk(+)e Fn(and)h Fk(*)g Fn(mak)-31 b(es)255 b(sense)e(b)-31 b(y)254 b(analogy)i(with)f(addition)0 2220 y(and)422 b(m)-31 b(ultiplication.)656 b(Just)421 b(as)h Fk(4*3)g Fn(is)g(equiv)-61 b(alen)-31 b(t)423 b(to)g Fk(4+4+4)p Fn(,)436 b(w)-31 b(e)422 b(exp)31 b(ect)422 b Fk("Fun"*3)h Fn(to)0 3575 y(b)31 b(e)433 b(the)h(same)h(as)e Fk("Fun"+"Fun"+"Fun")p Fn(,)453 b(and)434 b(it)h(is.)687 b(On)433 b(the)h(other)g(hand,)451 b(there)434 b(is)g(a)0 4930 y(signi\257can)-31 b(t)402 b(w)-31 b(a)g(y)402 b(in)e(whic)-31 b(h)402 b(string)e(concatenation)k(and)c(rep)31 b(etition)402 b(are)e(di\256eren)-31 b(t)400 b(from)0 6285 y(in)-31 b(teger)372 b(addition)h(and)e(m)-31 b(ultiplication.)502 b(Can)372 b(y)-31 b(ou)372 b(think)f(of)h(a)f(prop)31 b(ert)-31 b(y)371 b(that)h(addition)0 7640 y(and)d(m)-31 b(ultiplication)374 b(ha)-31 b(v)g(e)371 b(that)f(string)g (concatenation)i(and)d(rep)31 b(etition)371 b(do)e(not?)0 11885 y Fl(2.9)1793 b(Comp)50 b(osition)0 14193 y Fn(So)478 b(far,)505 b(w)-31 b(e)478 b(ha)-31 b(v)g(e)478 b(lo)31 b(ok)-31 b(ed)479 b(at)f(the)g(elemen)-31 b(ts)479 b(of)f(a)f (program|v)-61 b(ariables,)507 b(expressions,)0 15548 y(and)369 b(statemen)-31 b(ts|in)372 b(isolation,)g(without)g(talking)f (ab)31 b(out)370 b(ho)-31 b(w)371 b(to)e(com)-31 b(bine)371 b(them.)0 17523 y(One)478 b(of)h(the)g(most)g(useful)f(features)h(of)g (programming)h(languages)g(is)e(their)h(abilit)-31 b(y)481 b(to)0 18878 y(tak)-31 b(e)390 b(small)h(building)g(blo)31 b(c)-31 b(ks)389 b(and)h Fv(comp)35 b(ose)390 b Fn(them.)554 b(F)-92 b(or)388 b(example,)396 b(w)-31 b(e)390 b(kno)-31 b(w)390 b(ho)-31 b(w)390 b(to)0 20233 y(add)461 b(n)-31 b(um)g(b)31 b(ers)461 b(and)g(w)-31 b(e)462 b(kno)-31 b(w)462 b(ho)-31 b(w)462 b(to)g(prin)-31 b(t;)508 b(it)462 b(turns)e(out)i(w)-31 b(e)462 b(can)f(do)g(b)31 b(oth)462 b(at)g(the)0 21588 y(same)370 b(time:)0 23644 y Fk(>>>)1163 b(print)582 b(17)f(+)g(3)0 24999 y(20)0 27055 y Fn(In)371 b(realit)-31 b(y)-92 b(,)374 b(the)e(addition)h(has)f(to)g(happ)31 b(en)371 b(b)31 b(efore)372 b(the)f(prin)-31 b(ting,)374 b(so)e(the)f(actions)i(aren't)0 28410 y(actually)296 b(happ)31 b(ening)294 b(at)h(the)e(same)h(time.)469 b(The)293 b(p)31 b(oin)-31 b(t)295 b(is)f(that)g(an)-31 b(y)295 b(expression)e(in)-31 b(v)g(olving)0 29765 y(n)g(um)g(b)31 b(ers,)470 b(strings,)f(and)450 b(v)-61 b(ariables)450 b(can)g(b)31 b(e)449 b(used)f(inside)i(a)g(prin)-31 b(t)450 b(statemen)-31 b(t.)735 b(Y)-92 b(ou'v)-31 b(e)0 31120 y(already)370 b(seen)f(an)g(example)i(of)f(this:)0 33176 y Fk(print)582 b("Number)g(of)g(minutes)g(since)g(midnight:)g(",)g (hour*60+minute)0 35233 y Fn(Y)-92 b(ou)362 b(can)g(also)h(put)f (arbitrary)g(expressions)f(on)h(the)g(righ)-31 b(t-hand)363 b(side)f(of)g(an)g(assignmen)-31 b(t)0 36588 y(statemen)g(t:)0 38644 y Fk(percentage)583 b(=)e(\(minute)h(*)f(100\))h(/)f(60)0 40700 y Fn(This)522 b(abilit)-31 b(y)524 b(ma)-31 b(y)522 b(not)g(seem)f(impressiv)-31 b(e)522 b(no)-31 b(w,)561 b(but)522 b(y)-31 b(ou)522 b(will)h(see)d(other)i(examples)0 42055 y(where)456 b(comp)31 b(osition)458 b(mak)-31 b(es)457 b(it)g(p)31 b(ossible)456 b(to)h(express)d(complex)k(computations)g (neatly)0 43410 y(and)369 b(concisely)-92 b(.)0 45385 y(W)g(arning:)473 b(There)328 b(are)h(limits)i(on)e(where)g(y)-31 b(ou)329 b(can)g(use)g(certain)g(expressions.)479 b(F)-92 b(or)328 b(exam-)0 46740 y(ple,)451 b(the)435 b(left-hand)h(side)e(of)h (an)g(assignmen)-31 b(t)436 b(statemen)-31 b(t)436 b(has)f(to)g(b)31 b(e)434 b(a)g Fm(variable)h Fn(name,)0 48095 y(not)370 b(an)f(expression.)493 b(So,)370 b(the)f(follo)-31 b(wing)373 b(is)c(illegal:)496 b Fk(minute+1)582 b(=)f(hour)p Fn(.)0 52340 y Fl(2.10)1792 b(Commen)-50 b(ts)0 54648 y Fn(As)386 b(programs)i(get)f(bigger)h(and)f(more)g(complicated,)394 b(they)387 b(get)h(more)f(di\261cult)h(to)g(read.)0 56003 y(F)-92 b(ormal)418 b(languages)g(are)f(dense,)429 b(and)417 b(it)h(is)f(often)h(di\261cult)g(to)g(lo)31 b(ok)418 b(at)g(a)f(piece)g(of)h(co)31 b(de)0 57358 y(and)369 b(\257gure)g(out)h(what)h(it)f(is)f(doing,)i(or)e(wh)-31 b(y)-92 b(.)p eop %%Page: 19 45 19 44 bop 0 -2070 a Fv(2.11)425 b(Glossary)29420 b(19)p 0 -1627 38191 45 v 0 865 a Fn(F)-92 b(or)419 b(this)i(reason,)434 b(it)421 b(is)f(a)g(go)31 b(o)g(d)421 b(idea)g(to)g(add)g(notes)g(to)g (y)-31 b(our)420 b(programs)h(to)g(explain)h(in)0 2220 y(natural)280 b(language)h(what)f(the)f(program)h(is)f(doing.)464 b(These)278 b(notes)h(are)g(called)h Fv(commen)-35 b(ts)p Fn(,)0 3575 y(and)369 b(they)h(are)f(mark)-31 b(ed)370 b(with)g(the)g Fk(#)f Fn(sym)-31 b(b)31 b(ol:)0 5890 y Fk(#)581 b(compute)h(the)g(percentage)h(of)e(the)h(hour)g(that)f(has) h(elapsed)0 7245 y(percentage)h(=)e(\(minute)h(*)f(100\))h(/)f(60)0 9560 y Fn(In)272 b(this)i(case,)292 b(the)273 b(commen)-31 b(t)275 b(app)31 b(ears)272 b(on)h(a)g(line)h(b)-31 b(y)273 b(itself.)462 b(Y)-92 b(ou)273 b(can)g(also)g(put)g(commen)-31 b(ts)0 10915 y(at)370 b(the)f(end)g(of)h(a)f(line:)0 13230 y Fk(percentage)583 b(=)e(\(minute)h(*)f(100\))h(/)f(60)2907 b(#)581 b(caution:)h(integer)g(division)0 15544 y Fn(Ev)-31 b(erything)371 b(from)e(the)h Fk(#)f Fn(to)g(the)h(end)e(of)i(the)f (line)h(is)f(ignored|it)h(has)f(no)g(e\256ect)g(on)h(the)0 16899 y(program.)609 b(The)408 b(message)g(is)g(in)-31 b(tended)409 b(for)e(the)h(programmer)h(or)f(for)f(future)h(program-)0 18254 y(mers)460 b(who)i(migh)-31 b(t)462 b(use)f(this)g(co)31 b(de.)767 b(In)460 b(this)i(case,)484 b(it)461 b(reminds)g(the)g (reader)f(ab)31 b(out)462 b(the)0 19609 y(ev)-31 b(er-surprising)369 b(b)31 b(eha)-31 b(vior)370 b(of)g(in)-31 b(teger)370 b(division.)0 24326 y Fl(2.11)1792 b(Glossary)0 26560 y Fv(v)-71 b(alue:)553 b Fn(A)282 b(n)-31 b(um)g(b)31 b(er)282 b(or)g(string)g(\(or)g(other)g(thing)i(to)e(b)31 b(e)282 b(named)g(later\))h(that)g(can)g(b)31 b(e)281 b(stored)2767 27915 y(in)370 b(a)f(v)-61 b(ariable)371 b(or)e(computed)h(in)f(an)h(expression.)0 30283 y Fv(t)-35 b(yp)35 b(e:)554 b Fn(A)518 b(set)g(of)h(v)-61 b(alues.)941 b(The)519 b(t)-31 b(yp)31 b(e)519 b(of)g(a)f(v)-61 b(alue)519 b(determines)g(ho)-31 b(w)520 b(it)f(can)g(b)31 b(e)518 b(used)2767 31638 y(in)451 b(expressions.)736 b(So)451 b(far,)472 b(the)450 b(t)-31 b(yp)31 b(es)451 b(y)-31 b(ou)451 b(ha)-31 b(v)g(e)452 b(seen)e(are)g(in)-31 b(tegers)451 b(\(t)-31 b(yp)31 b(e)452 b Fk(int)p Fn(\),)2767 32993 y(\260oating-p)31 b(oin)-31 b(t)373 b(n)-31 b(um)g(b)31 b(ers)369 b(\(t)-31 b(yp)31 b(e)370 b Fk(float)p Fn(\),)h(and)e (strings)h(\(t)-31 b(yp)31 b(e)370 b Fk(string)p Fn(\).)0 35361 y Fv(\260oating-p)35 b(oin)-35 b(t:)555 b Fn(A)369 b(format)i(for)e(represen)-31 b(ting)369 b(n)-31 b(um)g(b)31 b(ers)369 b(with)i(fractional)g(parts.)0 37729 y Fv(v)-71 b(ariable:)553 b Fn(A)369 b(name)h(that)h(refers)c(to)j(a)g(v)-61 b(alue.)0 40098 y Fv(statemen)-35 b(t:)554 b Fn(A)307 b(section)g(of)h(co)31 b(de)307 b(that)h(represen)-31 b(ts)306 b(a)h(command)h(or)f(action.)474 b(So)307 b(far,)320 b(the)2767 41452 y(statemen)-31 b(ts)371 b(y)-31 b(ou)370 b(ha)-31 b(v)g(e)370 b(seen)f(are)g(assignmen)-31 b(ts)370 b(and)g(prin)-31 b(t)370 b(statemen)-31 b(ts.)0 43821 y Fv(assignmen)c(t:)554 b Fn(A)369 b(statemen)-31 b(t)371 b(that)g(assigns)e(a)g(v)-61 b(alue)370 b(to)g(a)f(v)-61 b(ariable.)0 46189 y Fv(state)425 b(diagram:)553 b Fn(A)335 b(graphical)i(represen)-31 b(tation)336 b(of)f(a)g(set)g(of)h(v)-61 b(ariables)335 b(and)h(the)f(v)-61 b(alues)2767 47544 y(to)370 b(whic)-31 b(h)370 b(they)g(refer.)0 49912 y Fv(k)-35 b(eyw)g(ord:)554 b Fn(A)441 b(reserv)-31 b(ed)440 b(w)-31 b(ord)441 b(that)h(is)f(used)f(b)-31 b(y)441 b(the)g(compiler)i(to)e(parse)f(a)i(program;)2767 51267 y(y)-31 b(ou)370 b(cannot)h(use)d(k)-31 b(eyw)g(ords)370 b(lik)-31 b(e)371 b Fk(if)p Fn(,)f Fk(def)p Fn(,)f(and)h Fk(while)g Fn(as)f(v)-61 b(ariable)370 b(names.)0 53635 y Fv(op)35 b(erator:)556 b Fn(A)275 b(sp)31 b(ecial)275 b(sym)-31 b(b)31 b(ol)276 b(that)h(represen)-31 b(ts)274 b(a)h(simple)h(computation)i(lik)-31 b(e)276 b(addition,)2767 54990 y(m)-31 b(ultiplication,)375 b(or)369 b(string)h(concatenation.)0 57358 y Fv(op)35 b(erand:)555 b Fn(One)369 b(of)h(the)f(v)-61 b(alues)370 b(on)f(whic)-31 b(h)370 b(an)g(op)31 b(erator)369 b(op)31 b(erates.)p eop %%Page: 20 46 20 45 bop 0 -2070 a Fv(20)15858 b(V)-106 b(ariables,)424 b(expressions)j(and)d(statemen)-35 b(ts)p 0 -1627 38191 45 v 0 865 a(expression:)555 b Fn(A)362 b(com)-31 b(bination)366 b(of)d(v)-61 b(ariables,)364 b(op)31 b(erators,)365 b(and)d(v)-61 b(alues)363 b(that)g(represen)-31 b(ts)2767 2220 y(a)370 b(single)g(result)f(v)-61 b(alue.)0 4461 y Fv(ev)-71 b(aluate:)554 b Fn(T)-92 b(o)405 b(simplify)j(an)d(expression)g(b)-31 b(y)406 b(p)31 b(erforming)406 b(the)f(op)31 b(erations)407 b(in)e(order)g(to)2767 5815 y(yield)371 b(a)e(single)h(v)-61 b(alue.)0 8056 y Fv(in)-35 b(teger)426 b(division:)552 b Fn(An)330 b(op)31 b(eration)331 b(that)g(divides)g(one)f(in)-31 b(teger)331 b(b)-31 b(y)330 b(another)g(and)g(yields)2767 9411 y(an)297 b(in)-31 b(teger.)469 b(In)-31 b(teger)297 b(division)g(yields)g(only)g(the)g(whole)g(n)-31 b(um)g(b)31 b(er)296 b(of)h(times)g(that)h(the)2767 10766 y(n)-31 b(umerator)371 b(is)e(divisible)h(b)-31 b(y)370 b(the)f(denominator)j (and)d(discards)g(an)-31 b(y)370 b(remainder.)0 13006 y Fv(rules)425 b(of)g(precedence:)555 b Fn(The)262 b(set)f(of)h(rules)f (go)-31 b(v)g(erning)263 b(the)f(order)f(in)g(whic)-31 b(h)263 b(expressions)2767 14361 y(in)-31 b(v)g(olving)373 b(m)-31 b(ultiple)371 b(op)31 b(erators)370 b(and)f(op)31 b(erands)369 b(are)g(ev)-61 b(aluated.)0 16602 y Fv(concatenate:)554 b Fn(T)-92 b(o)370 b(join)g(t)-31 b(w)g(o)371 b(op)31 b(erands)369 b(end-to-end.)0 18842 y Fv(comp)35 b(osition:)554 b Fn(The)414 b(abilit)-31 b(y)417 b(to)e(com)-31 b(bine)415 b(simple)g(expressions)e(and)h(statemen)-31 b(ts)415 b(in)-31 b(to)2767 20197 y(comp)31 b(ound)320 b(statemen)-31 b(ts)321 b(and)e(expressions)f(in)i(order)e(to)i(represen)-31 b(t)318 b(complex)i(com-)2767 21552 y(putations)371 b(concisely)-92 b(.)0 23793 y Fv(commen)-35 b(t:)553 b Fn(Information)360 b(in)e(a)f(program)i(that)f(is)g(mean)-31 b(t)358 b(for)g(other)g (programmers)g(\(or)2767 25147 y(an)-31 b(y)g(one)348 b(reading)g(the)e(source)g(co)31 b(de\))347 b(and)g(has)f(no)h (e\256ect)f(on)h(the)g(execution)h(of)f(the)2767 26502 y(program.)p eop %%Page: 21 47 21 46 bop 0 9841 a Fi(Chapter)861 b(3)0 16060 y Fo(F)-258 b(unctions)0 23139 y Fl(3.1)1793 b(F)-149 b(unction)598 b(calls)0 25446 y Fn(Y)-92 b(ou)369 b(ha)-31 b(v)g(e)371 b(already)f(seen)e(one)i(example)g(of)g(a)g Fv(function)424 b(call)p Fn(:)0 27500 y Fk(>>>)582 b(type\("32"\))0 28855 y()0 30909 y Fn(The)306 b(name)h(of)g(the)f(function)i (is)e Fk(type)p Fn(,)319 b(and)307 b(it)g(displa)-31 b(ys)307 b(the)f(t)-31 b(yp)31 b(e)307 b(of)f(a)h(v)-61 b(alue)306 b(or)g(v)-61 b(ariable.)0 32264 y(The)479 b(v)-61 b(alue)479 b(or)g(v)-61 b(ariable,)507 b(whic)-31 b(h)480 b(is)f(called)h(the)f Fv(argumen)-35 b(t)479 b Fn(of)g(the)g(function,)509 b(has)478 b(to)0 33619 y(b)31 b(e)493 b(enclosed)h(in)g(paren)-31 b(theses.)866 b(It)493 b(is)h(common)h(to)f(sa)-31 b(y)494 b(that)h(a)f(function)h (\\tak)-31 b(es")496 b(an)0 34974 y(argumen)-31 b(t)371 b(and)e(\\returns")g(a)h(result.)492 b(The)370 b(result)f(is)g(called)h (the)g Fv(return)426 b(v)-71 b(alue)p Fn(.)0 36947 y(Instead)369 b(of)h(prin)-31 b(ting)371 b(the)e(return)g(v)-61 b(alue,)370 b(w)-31 b(e)369 b(could)h(assign)g(it)g(to)g(a)f(v)-61 b(ariable:)0 39001 y Fk(>>>)582 b(betty)f(=)h(type\("32"\))0 40356 y(>>>)g(print)f(betty)0 41711 y()0 43765 y Fn(As)360 b(another)h(example,)k(the)360 b Fk(id)h Fn(function)h(tak)-31 b(es)361 b(a)g(v)-61 b(alue)361 b(or)f(a)h(v)-61 b(ariable)361 b(and)g(returns)f(an)0 45120 y(in)-31 b(teger)370 b(that)h(acts)e(as)g(a)h(unique)f(iden)-31 b(ti\257er)371 b(for)e(the)g(v)-61 b(alue:)0 47174 y Fk(>>>)582 b(id\(3\))0 48529 y(134882108)0 49884 y(>>>)g(betty)f(=)h(3) 0 51239 y(>>>)g(id\(betty\))0 52594 y(134882108)0 54648 y Fn(Ev)-31 b(ery)405 b(v)-61 b(alue)404 b(has)h(an)f Fk(id)p Fn(,)414 b(whic)-31 b(h)405 b(is)f(a)h(unique)f(n)-31 b(um)g(b)31 b(er)405 b(related)g(to)g(where)f(it)h(is)f(stored)0 56003 y(in)395 b(the)g(memory)h(of)g(the)f(computer.)570 b(The)396 b Fk(id)f Fn(of)g(a)g(v)-61 b(ariable)396 b(is)f(the)g Fk(id)g Fn(of)h(the)f(v)-61 b(alue)395 b(to)0 57358 y(whic)-31 b(h)370 b(it)g(refers.)p eop %%Page: 22 48 22 47 bop 0 -2070 a Fv(22)31548 b(F)-106 b(unctions)p 0 -1627 38191 45 v 0 865 a Fl(3.2)1793 b(T)-50 b(yp)50 b(e)599 b(con)-50 b(v)g(ersion)0 3294 y Fn(Python)389 b(pro)-31 b(vides)388 b(a)g(collection)i(of)e(built-in)i(functions)e (that)h(con)-31 b(v)g(ert)389 b(v)-61 b(alues)388 b(from)g(one)0 4649 y(t)-31 b(yp)31 b(e)313 b(to)h(another.)475 b(The)313 b Fk(int)g Fn(function)h(tak)-31 b(es)314 b(an)-31 b(y)314 b(v)-61 b(alue)313 b(and)g(con)-31 b(v)g(erts)314 b(it)g(to)f(an)g(in) -31 b(teger,)0 6004 y(if)370 b(p)31 b(ossible,)370 b(or)f(complains)i (otherwise:)0 8181 y Fk(>>>)582 b(int\("32"\))0 9536 y(32)0 10891 y(>>>)g(int\("Hello"\))0 12246 y(ValueError:)h(invalid)f (literal)g(for)g(int\(\):)g(Hello)0 14422 y(int)515 b Fn(can)g(also)h(con)-31 b(v)g(ert)516 b(\260oating-p)31 b(oin)-31 b(t)518 b(v)-61 b(alues)515 b(to)h(in)-31 b(tegers,)552 b(but)515 b(remem)-31 b(b)31 b(er)515 b(that)h(it)0 15777 y(truncates)370 b(the)f(fractional)j(part:)0 17954 y Fk(>>>)582 b(int\(3.99999\))0 19309 y(3)0 20664 y(>>>)g(int\(-2.3\))0 22019 y(-2)0 24195 y Fn(The)369 b Fk(float)h Fn(function)h(con)-31 b(v)g(erts)370 b(in)-31 b(tegers)369 b(and)h(strings)f(to)h (\260oating-p)31 b(oin)-31 b(t)373 b(n)-31 b(um)g(b)31 b(ers:)0 26372 y Fk(>>>)582 b(float\(32\))0 27727 y(32.0)0 29082 y(>>>)g(float\("3.14159"\))0 30437 y(3.14159)0 32613 y Fn(Finally)-92 b(,)371 b(the)e Fk(str)h Fn(function)g(con)-31 b(v)g(erts)370 b(to)g(t)-31 b(yp)31 b(e)370 b Fk(string)p Fn(:)0 34790 y Fk(>>>)582 b(str\(32\))0 36145 y('32')0 37500 y(>>>)g(str\(3.14149\))0 38855 y('3.14149')0 41031 y Fn(It)288 b(ma)-31 b(y)289 b(seem)f(o)31 b(dd)287 b(that)i(Python)h (distinguishes)e(the)g(in)-31 b(teger)289 b(v)-61 b(alue)289 b Fk(1)e Fn(from)i(the)f(\260oating-)0 42386 y(p)31 b(oin)-31 b(t)497 b(v)-61 b(alue)496 b Fk(1.0)p Fn(.)872 b(They)496 b(ma)-31 b(y)497 b(represen)-31 b(t)495 b(the)h(same)g(n)-31 b(um)g(b)31 b(er,)528 b(but)495 b(they)i(b)31 b(elong)496 b(to)0 43741 y(di\256eren)-31 b(t)451 b(t)-31 b(yp)31 b(es.)737 b(The)450 b(reason)h(is)f(that)i(they)f(are)g(represen)-31 b(ted)449 b(di\256eren)-31 b(tly)452 b(inside)f(the)0 45096 y(computer.)0 49509 y Fl(3.3)1793 b(T)-50 b(yp)50 b(e)599 b(co)50 b(ercion)0 51938 y Fn(No)-31 b(w)511 b(that)g(w)-31 b(e)510 b(can)g(con)-31 b(v)g(ert)511 b(b)31 b(et)-31 b(w)g(een)511 b(t)-31 b(yp)31 b(es,)546 b(w)-31 b(e)510 b(ha)-31 b(v)g(e)511 b(another)f(w)-31 b(a)g(y)512 b(to)e(deal)h(with)0 53293 y(in)-31 b(teger)383 b(division.)534 b(Returning)382 b(to)h(the)g(example)h(from)e(the)h (previous)f(c)-31 b(hapter,)387 b(supp)31 b(ose)0 54648 y(w)-31 b(e)310 b(w)-31 b(an)g(t)311 b(to)f(calculate)h(the)e(fraction) i(of)f(an)f(hour)g(that)i(has)e(elapsed.)473 b(The)309 b(most)i(ob)-31 b(vious)0 56003 y(expression,)312 b Fk(minute)582 b(/)g(60)p Fn(,)312 b(do)31 b(es)298 b(in)-31 b(teger)298 b(arithmetic,)315 b(so)298 b(the)g(result)f(is)h(alw)-31 b(a)g(ys)300 b(0,)313 b(ev)-31 b(en)0 57358 y(at)370 b(59)g(min)-31 b(utes)370 b(past)g(the)f(hour.)p eop %%Page: 23 49 23 48 bop 0 -2070 a Fv(3.4)425 b(Math)g(functions)26349 b(23)p 0 -1627 38191 45 v 0 865 a Fn(One)408 b(solution)j(is)d(to)i (con)-31 b(v)g(ert)409 b Fk(minute)h Fn(to)f(\260oating-p)31 b(oin)-31 b(t)412 b(and)d(do)g(\260oating-p)31 b(oin)-31 b(t)412 b(divi-)0 2220 y(sion:)0 4544 y Fk(>>>)582 b(minute)g(=)f(59)0 5899 y(>>>)h(float\(minute\))h(/)e(60)0 7254 y(0.983333333333)0 9577 y Fn(Alternativ)-31 b(ely)-92 b(,)514 b(w)-31 b(e)483 b(can)f(tak)-31 b(e)484 b(adv)-61 b(an)-31 b(tage)484 b(of)f(the)g(rules)f(for)g(automatic)k(t)-31 b(yp)31 b(e)482 b(con)-31 b(v)g(er-)0 10932 y(sion,)375 b(whic)-31 b(h)375 b(is)e(called)i Fv(t)-35 b(yp)35 b(e)430 b(co)35 b(ercion)p Fn(.)507 b(F)-92 b(or)372 b(the)i(mathematical)j(op)31 b(erators,)376 b(if)e(either)0 12287 y(op)31 b(erand)369 b(is)g(a)h Fk(float)p Fn(,)g(the)f(other)h(is)f(automatically)374 b(con)-31 b(v)g(erted)370 b(to)g(a)g Fk(float)p Fn(:)0 14611 y Fk(>>>)582 b(minute)g(=)f(59)0 15966 y(>>>)h(minute)g(/)f(60.0) 0 17321 y(0.983333333333)0 19644 y Fn(By)551 b(making)h(the)e (denominator)j(a)e Fk(float)p Fn(,)596 b(w)-31 b(e)551 b(force)g(Python)h(to)f(do)f(\260oating-p)31 b(oin)-31 b(t)0 20999 y(division.)0 25743 y Fl(3.4)1793 b(Math)598 b(functions)0 28350 y Fn(In)442 b(mathematics,)465 b(y)-31 b(ou)443 b(ha)-31 b(v)g(e)444 b(probably)g(seen)e(functions)h(lik)-31 b(e)444 b Fk(sin)f Fn(and)g Fk(log)p Fn(,)462 b(and)443 b(y)-31 b(ou)0 29705 y(ha)g(v)g(e)398 b(learned)f(to)h(ev)-61 b(aluate)399 b(expressions)d(lik)-31 b(e)398 b Fk(sin\(pi/2\))h Fn(and)e Fk(log\(1/x\))p Fn(.)577 b(First,)404 b(y)-31 b(ou)0 31060 y(ev)-61 b(aluate)465 b(the)e(expression)g(in)h(paren)-31 b(theses)463 b(\(the)h(argumen)-31 b(t\).)777 b(F)-92 b(or)463 b(example,)488 b Fk(pi/2)464 b Fn(is)0 32415 y(appro)-31 b(ximately)373 b(1.571,)e(and)f Fk(1/x)f Fn(is)g(0.1)i(\(if)f Fk(x)f Fn(happ)31 b(ens)369 b(to)h(b)31 b(e)369 b(10.0\).)0 34657 y(Then,)416 b(y)-31 b(ou)407 b(ev)-61 b(aluate)407 b(the)g(function)g(itself,)417 b(either)406 b(b)-31 b(y)407 b(lo)31 b(oking)408 b(it)f(up)f(in)g(a)g (table)i(or)e(b)-31 b(y)0 36012 y(p)31 b(erforming)405 b(v)-61 b(arious)404 b(computations.)601 b(The)404 b Fk(sin)h Fn(of)f(1.571)j(is)d(1,)414 b(and)404 b(the)g Fk(log)h Fn(of)g(0.1)g(is)0 37367 y(-1)369 b(\(assuming)i(that)f Fk(log)g Fn(indicates)g(the)g(logarithm)i(base)d(10\).)0 39610 y(This)266 b(pro)31 b(cess)265 b(can)h(b)31 b(e)265 b(applied)i(rep)31 b(eatedly)267 b(to)g(ev)-61 b(aluate)267 b(more)f(complicated)j(expressions)0 40965 y(lik)-31 b(e)530 b Fk(log\(1/sin\(pi/2\)\))p Fn(.)974 b(First,)569 b(y)-31 b(ou)529 b(ev)-61 b(aluate)530 b(the)f(argumen)-31 b(t)531 b(of)e(the)g(innermost)0 42320 y(function,)371 b(then)f(ev)-61 b(aluate)370 b(the)g(function,)h(and)e(so)g(on.)0 44562 y(Python)484 b(has)f(a)g(math)h(mo)31 b(dule)484 b(that)h(pro)-31 b(vides)483 b(most)h(of)f(the)g(familiar)j (mathematical)0 45917 y(functions.)832 b(A)481 b Fv(mo)35 b(dule)483 b Fn(is)f(a)g(\257le)g(that)h(con)-31 b(tains)483 b(a)g(collection)h(of)e(related)h(functions)0 47272 y(group)31 b(ed)369 b(together.)0 49515 y(Before)g(w)-31 b(e)370 b(can)f(use)g(the)g(functions)i(from)e(a)h(mo)31 b(dule,)371 b(w)-31 b(e)369 b(ha)-31 b(v)g(e)370 b(to)g(imp)31 b(ort)371 b(them:)0 51838 y Fk(>>>)582 b(import)g(math)0 54162 y Fn(T)-92 b(o)334 b(call)g(one)g(of)g(the)g(functions,)342 b(w)-31 b(e)334 b(ha)-31 b(v)g(e)334 b(to)g(sp)31 b(ecify)334 b(the)f(name)h(of)g(the)g(mo)31 b(dule)334 b(and)g(the)0 55517 y(name)373 b(of)h(the)f(function,)i(separated)e(b)-31 b(y)373 b(a)g(dot,)i(also)f(kno)-31 b(wn)374 b(as)e(a)h(p)31 b(erio)g(d.)503 b(This)373 b(format)0 56872 y(is)c(called)i Fv(dot)425 b(notation)p Fn(.)p eop %%Page: 24 50 24 49 bop 0 -2070 a Fv(24)31548 b(F)-106 b(unctions)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(decibel)g(=)f(math.log10)i (\(17.0\))0 2220 y(>>>)f(angle)f(=)h(1.5)0 3575 y(>>>)g(height)g(=)f (math.sin\(angle\))0 6010 y Fn(The)365 b(\257rst)g(statemen)-31 b(t)367 b(sets)d Fk(decibel)i Fn(to)g(the)f(logarithm)j(of)d(17,)i (base)e Fk(10)p Fn(.)491 b(There)365 b(is)g(also)0 7365 y(a)k(function)i(called)f Fk(log)g Fn(that)g(tak)-31 b(es)370 b(logarithm)i(base)d Fk(e)p Fn(.)0 9718 y(The)387 b(third)f(statemen)-31 b(t)389 b(\257nds)d(the)h(sine)f(of)h(the)g(v) -61 b(alue)387 b(of)g(the)f(v)-61 b(ariable)388 b Fk(angle)p Fn(.)545 b Fk(sin)387 b Fn(and)0 11073 y(the)442 b(other)g (trigonometric)j(functions)d(\()p Fk(cos)p Fn(,)461 b Fk(tan)p Fn(,)g(etc.\))711 b(tak)-31 b(e)443 b(argumen)-31 b(ts)443 b(in)f(radians.)0 12428 y(T)-92 b(o)428 b(con)-31 b(v)g(ert)429 b(from)f(degrees)f(to)i(radians,)443 b(divide)428 b(b)-31 b(y)428 b(360)h(and)f(m)-31 b(ultiply)430 b(b)-31 b(y)428 b Fk(2*pi)p Fn(.)669 b(F)-92 b(or)0 13783 y(example,)395 b(to)389 b(\257nd)e(the)i(sine)f(of)g(45)h(degrees,)k(\257rst)387 b(calculate)j(the)f(angle)g(in)f(radians)h(and)0 15138 y(then)369 b(tak)-31 b(e)371 b(the)e(sine:)0 17573 y Fk(>>>)582 b(degrees)g(=)f(45)0 18927 y(>>>)h(angle)f(=)h(degrees)g(*)f (2)h(*)f(math.pi)h(/)f(360.0)0 20282 y(>>>)h(math.sin\(angle\))0 21637 y(0.707106781187)0 24072 y Fn(The)401 b(constan)-31 b(t)402 b Fk(pi)e Fn(is)h(also)g(part)g(of)g(the)g(math)h(mo)31 b(dule.)587 b(If)400 b(y)-31 b(ou)402 b(kno)-31 b(w)401 b(y)-31 b(our)401 b(geometry)-92 b(,)0 25427 y(y)-31 b(ou)480 b(can)f(c)-31 b(hec)g(k)479 b(the)g(previous)g(result)f(b)-31 b(y)479 b(comparing)i(it)f(to)f(the)g(square)g(ro)31 b(ot)479 b(of)g(t)-31 b(w)g(o)0 26782 y(divided)370 b(b)-31 b(y)370 b(t)-31 b(w)g(o:)0 29216 y Fk(>>>)582 b(math.sqrt\(2\))h(/)e (2.0)0 30571 y(0.707106781187)0 35729 y Fl(3.5)1793 b(Comp)50 b(osition)0 38491 y Fn(Just)295 b(as)h(with)g(mathematical)k (functions,)312 b(Python)297 b(functions)f(can)g(b)31 b(e)295 b(comp)31 b(osed,)311 b(mean-)0 39846 y(ing)417 b(that)h(y)-31 b(ou)418 b(use)e(one)h(expression)f(as)h(part)g(of)g (another.)636 b(F)-92 b(or)416 b(example,)430 b(y)-31 b(ou)418 b(can)f(use)0 41201 y(an)-31 b(y)370 b(expression)f(as)g(an)g (argumen)-31 b(t)371 b(to)f(a)f(function:)0 43636 y Fk(>>>)582 b(x)f(=)g(math.cos\(angle)i(+)f(pi/2\))0 46070 y Fn(This)344 b(statemen)-31 b(t)345 b(tak)-31 b(es)344 b(the)g(v)-61 b(alue)344 b(of)g Fk(pi)p Fn(,)349 b(divides)344 b(it)g(b)-31 b(y)344 b(2,)349 b(and)343 b(adds)h(the)f(result)h(to)g(the)0 47425 y(v)-61 b(alue)370 b(of)f Fk(angle)p Fn(.)494 b(The)369 b(sum)g(is)g(then)h(passed)e(as)h(an)h(argumen)-31 b(t)370 b(to)g(the)g Fk(cos)f Fn(function.)0 49779 y(Y)-92 b(ou)513 b(can)f(also)h(tak)-31 b(e)514 b(the)e(result)g(of)h(one)g(function)g (and)g(pass)f(it)h(as)f(an)g(argumen)-31 b(t)514 b(to)0 51134 y(another:)0 53569 y Fk(>>>)582 b(x)f(=)g (math.exp\(math.log\(10.0\)\))0 56003 y Fn(This)373 b(statemen)-31 b(t)374 b(\257nds)e(the)g(log)i(base)e Fk(e)g Fn(of)h(10)g(and)f(then)h (raises)f Fk(e)g Fn(to)h(that)g(p)31 b(o)-31 b(w)g(er.)503 b(The)0 57358 y(result)369 b(gets)h(assigned)f(to)h Fk(x)p Fn(.)p eop %%Page: 25 51 25 50 bop 0 -2070 a Fv(3.6)425 b(Adding)g(new)h(functions)22670 b(25)p 0 -1627 38191 45 v 0 865 a Fl(3.6)1793 b(Adding)598 b(new)h(functions)0 3577 y Fn(So)446 b(far,)465 b(w)-31 b(e)446 b(ha)-31 b(v)g(e)446 b(only)h(b)31 b(een)445 b(using)h(the)g(functions)g(that)h(come)f(with)h(Python,)466 b(but)446 b(it)0 4932 y(is)504 b(also)h(p)31 b(ossible)504 b(to)h(add)f(new)h(functions.)898 b(Creating)506 b(new)e(functions)h (to)g(solv)-31 b(e)505 b(y)-31 b(our)0 6287 y(particular)472 b(problems)f(is)g(one)f(of)i(the)f(most)g(useful)g(things)g(ab)31 b(out)472 b(a)f(general-purp)31 b(ose)0 7642 y(programming)371 b(language.)0 9960 y(In)i(the)g(con)-31 b(text)375 b(of)f(programming,) j(a)d Fv(function)g Fn(is)f(a)h(named)g(sequence)e(of)i(statemen)-31 b(ts)0 11315 y(that)468 b(p)31 b(erforms)466 b(a)h(desired)e(op)31 b(eration.)787 b(This)466 b(op)31 b(eration)468 b(is)f(sp)31 b(eci\257ed)466 b(in)h(a)g Fv(function)0 12670 y(de\257nition)p Fn(.)556 b(The)391 b(functions)g(w)-31 b(e)391 b(ha)-31 b(v)g(e)391 b(b)31 b(een)389 b(using)i(so)f(far)g(ha)-31 b(v)g(e)391 b(b)31 b(een)390 b(de\257ned)g(for)g(us,)0 14025 y(and)371 b(these)g(de\257nitions)h(ha)-31 b(v)g(e)372 b(b)31 b(een)370 b(hidden.)497 b(This)372 b(is)e(a)h(go)31 b(o)g(d)372 b(thing,)h(b)31 b(ecause)370 b(it)i(allo)-31 b(ws)0 15380 y(us)369 b(to)h(use)e(the)i(functions)g(without)h(w)-31 b(orrying)371 b(ab)31 b(out)370 b(the)f(details)i(of)e(their)h (de\257nitions.)0 17697 y(The)f(syn)-31 b(tax)371 b(for)e(a)g(function) i(de\257nition)g(is:)0 20096 y Fk(def)582 b(NAME\()f(LIST)h(OF)g (PARAMETERS)g(\):)1162 21451 y(STATEMENTS)0 23850 y Fn(Y)-92 b(ou)339 b(can)g(mak)-31 b(e)340 b(up)f(an)-31 b(y)340 b(names)f(y)-31 b(ou)339 b(w)-31 b(an)g(t)341 b(for)e(the)g(functions)h (y)-31 b(ou)340 b(create,)345 b(except)340 b(that)0 25205 y(y)-31 b(ou)321 b(can't)h(use)f(a)g(name)g(that)h(is)f(a)g(Python)h(k) -31 b(eyw)g(ord.)478 b(The)321 b(list)g(of)h(parameters)f(sp)31 b(eci\257es)0 26560 y(what)367 b(information,)i(if)e(an)-31 b(y)-92 b(,)367 b(y)-31 b(ou)366 b(ha)-31 b(v)g(e)367 b(to)f(pro)-31 b(vide)366 b(in)g(order)f(to)h(use)f(the)h(new)g (function.)0 28877 y(There)425 b(can)h(b)31 b(e)425 b(an)-31 b(y)426 b(n)-31 b(um)g(b)31 b(er)425 b(of)h(statemen)-31 b(ts)427 b(inside)f(the)f(function,)441 b(but)426 b(they)g(ha)-31 b(v)g(e)426 b(to)0 30232 y(b)31 b(e)378 b(inden)-31 b(ted)379 b(from)g(the)g(left)g(margin.)522 b(In)378 b(the)h(examples)g(in)g (this)g(b)31 b(o)g(ok,)382 b(w)-31 b(e)379 b(will)h(use)e(an)0 31587 y(inden)-31 b(tation)372 b(of)e(t)-31 b(w)g(o)371 b(spaces.)0 33905 y(The)405 b(\257rst)g(couple)h(of)g(functions)g(w)-31 b(e)406 b(are)f(going)i(to)f(write)g(ha)-31 b(v)g(e)406 b(no)f(parameters,)416 b(so)405 b(the)0 35260 y(syn)-31 b(tax)370 b(lo)31 b(oks)370 b(lik)-31 b(e)371 b(this:)0 37658 y Fk(def)582 b(newLine\(\):)1162 39013 y(print)0 41412 y Fn(This)437 b(function)h(is)f(named)h Fk(newLine)p Fn(.)696 b(The)437 b(empt)-31 b(y)438 b(paren)-31 b(theses)437 b(indicate)h(that)g(it)g(has)0 42767 y(no)466 b(parameters.)785 b(It)466 b(con)-31 b(tains)467 b(only)h(a)e(single)h(statemen)-31 b(t,)493 b(whic)-31 b(h)467 b(outputs)g(a)g(newline)0 44122 y(c)-31 b(haracter.)490 b(\(That's)361 b(what)g(happ)31 b(ens)359 b(when)g(y)-31 b(ou)360 b(use)f(a)h Fk(print)g Fn(command)h(without)g(an)-31 b(y)0 45477 y(argumen)g(ts.\))0 47795 y(The)426 b(syn)-31 b(tax)427 b(for)f(calling)i(the)e(new)g (function)h(is)f(the)g(same)h(as)e(the)h(syn)-31 b(tax)427 b(for)f(built-in)0 49149 y(functions:)0 51548 y Fk(print)582 b("First)g(Line.")0 52903 y(newLine\(\))0 54258 y(print)g("Second)g (Line.")0 56657 y Fn(The)369 b(output)i(of)f(this)f(program)h(is:)p eop %%Page: 26 52 26 51 bop 0 -2070 a Fv(26)31548 b(F)-106 b(unctions)p 0 -1627 38191 45 v 0 865 a Fk(First)582 b(line.)0 3575 y(Second)g(line.)0 5851 y Fn(Notice)426 b(the)g(extra)f(space)g(b)31 b(et)-31 b(w)g(een)426 b(the)f(t)-31 b(w)g(o)427 b(lines.)660 b(What)425 b(if)h(w)-31 b(e)425 b(w)-31 b(an)g(ted)427 b(more)e(space)0 7206 y(b)31 b(et)-31 b(w)g(een)370 b(the)g(lines?)492 b(W)-92 b(e)368 b(could)i(call)h(the)e(same)h(function)g(rep)31 b(eatedly:)0 9481 y Fk(print)582 b("First)g(Line.")0 10836 y(newLine\(\))0 12191 y(newLine\(\))0 13546 y(newLine\(\))0 14901 y(print)g("Second)g(Line.")0 17176 y Fn(Or)495 b(w)-31 b(e)496 b(could)h(write)f(a)g(new)g(function)i(named)e Fk(threeLines)h Fn(that)g(prin)-31 b(ts)496 b(three)g(new)0 18531 y(lines:)0 20807 y Fk(def)582 b(threeLines\(\):)1162 22162 y(newLine\(\))1162 23517 y(newLine\(\))1162 24872 y(newLine\(\))0 27582 y(print)g("First)g(Line.")0 28936 y(threeLines\(\))0 30291 y(print)g("Second)g(Line.")0 32567 y Fn(This)283 b(function)g(con)-31 b(tains)284 b(three)e(statemen)-31 b(ts,)301 b(all)284 b(of)f(whic)-31 b(h)283 b(are)f(inden)-31 b(ted)283 b(b)-31 b(y)282 b(t)-31 b(w)g(o)284 b(spaces.)0 33922 y(Since)420 b(the)h(next)f(statemen)-31 b(t)422 b(is)e(not)h(inden)-31 b(ted,)435 b(Python)421 b(kno)-31 b(ws)421 b(that)g(it)g(is)f(not)h(part)f(of)0 35277 y(the)369 b(function.)0 37471 y(Y)-92 b(ou)369 b(should)h(notice)g(a)g(few)f(things)i(ab)31 b(out)370 b(this)f(program:)1353 40174 y(1.)554 b(Y)-92 b(ou)409 b(can)g(call)h(the)f(same)g(pro)31 b(cedure)408 b(rep)31 b(eatedly)-92 b(.)611 b(In)409 b(fact,)420 b(it)409 b(is)g(quite)g (common)2767 41529 y(and)370 b(useful)f(to)h(do)g(so.)1353 43824 y(2.)554 b(Y)-92 b(ou)357 b(can)f(ha)-31 b(v)g(e)357 b(one)g(function)h(call)f(another)g(function;)362 b(in)357 b(this)g(case)f Fk(threeLines)2767 45179 y Fn(calls)370 b Fk(newLine)p Fn(.)0 47881 y(So)337 b(far,)343 b(it)338 b(ma)-31 b(y)338 b(not)f(b)31 b(e)336 b(clear)h(wh)-31 b(y)337 b(it)g(is)g(w)-31 b(orth)337 b(the)g(trouble)g(to)h(create)e (all)i(of)f(these)g(new)0 49236 y(functions.)633 b(Actually)-92 b(,)430 b(there)415 b(are)h(a)g(lot)h(of)f(reasons,)427 b(but)416 b(this)g(example)h(demonstrates)0 50591 y(t)-31 b(w)g(o:)1660 53293 y Fj(\262)554 b Fn(Creating)506 b(a)e(new)g (function)h(giv)-31 b(es)504 b(y)-31 b(ou)505 b(an)f(opp)31 b(ortunit)-31 b(y)506 b(to)e(name)g(a)g(group)g(of)2767 54648 y(statemen)-31 b(ts.)560 b(F)-92 b(unctions)391 b(can)g(simplify)i(a)e(program)h(b)-31 b(y)391 b(hiding)i(a)e(complex)h (com-)2767 56003 y(putation)330 b(b)31 b(ehind)327 b(a)g(single)h (command)h(and)e(b)-31 b(y)328 b(using)f(English)i(w)-31 b(ords)327 b(in)h(place)f(of)2767 57358 y(arcane)370 b(co)31 b(de.)p eop %%Page: 27 53 27 52 bop 0 -2070 a Fv(3.7)425 b(De\257nitions)h(and)e(use)24170 b(27)p 0 -1627 38191 45 v 1660 865 a Fj(\262)554 b Fn(Creating)285 b(a)f(new)g(function)h(can)e(mak)-31 b(e)285 b(a)e(program)i(smaller)f (b)-31 b(y)283 b(eliminating)k(rep)31 b(et-)2767 2220 y(itiv)-31 b(e)411 b(co)31 b(de.)613 b(F)-92 b(or)409 b(example,)421 b(a)410 b(short)f(w)-31 b(a)g(y)411 b(to)f(prin)-31 b(t)410 b(nine)f(consecutiv)-31 b(e)411 b(new)f(lines)2767 3575 y(is)370 b(to)f(call)i Fk(threeLines)f Fn(three)f(times.)2767 6338 y Fm(As)809 b(an)h(exer)-57 b(cise,)914 b(write)809 b(a)h(function)h(c)-57 b(al)57 b(le)-57 b(d)810 b Fk(nineLines)h Fm(that)d(uses)2767 7693 y Fk(threeLines)385 b Fm(to)e(print)h(nine)h (blank)e(lines.)506 b(How)383 b(would)f(you)i(print)g(twenty-)2767 9048 y(seven)397 b(new)f(lines?)0 13740 y Fl(3.7)1793 b(De\257nitions)600 b(and)e(use)0 16324 y Fn(Pulling)362 b(together)e(the)g(co)31 b(de)360 b(fragmen)-31 b(ts)360 b(from)g(Section)h(3.6,)i(the)d(whole)h(program)f(lo)31 b(oks)0 17679 y(lik)-31 b(e)370 b(this:)0 19986 y Fk(def)582 b(newLine\(\):)1162 21341 y(print)0 24051 y(def)g(threeLines\(\):)1162 25406 y(newLine\(\))1162 26761 y(newLine\(\))1162 28116 y(newLine\(\))0 30826 y(print)g("First)g(Line.")0 32180 y(threeLines\(\))0 33535 y(print)g("Second)g(Line.")0 35842 y Fn(This)588 b(program)g(con)-31 b(tains)589 b(t)-31 b(w)g(o)590 b(function)e(de\257nitions:)931 b Fk(newLine)588 b Fn(and)g Fk(threeLines)p Fn(.)0 37197 y(F)-92 b(unction)475 b(de\257nitions)g(get)g(executed)g(just)f(lik)-31 b(e)475 b(other)g(statemen)-31 b(ts,)502 b(but)475 b(the)f(e\256ect)g(is)0 38552 y(to)542 b(create)f(the)h(new)f(function.)1010 b(The)542 b(statemen)-31 b(ts)542 b(inside)g(the)f(function)i(do)e(not) h(get)0 39907 y(executed)445 b(un)-31 b(til)446 b(the)e(function)i(is)e (called,)465 b(and)445 b(the)f(function)i(de\257nition)g(generates)f (no)0 41262 y(output.)0 43488 y(As)405 b(y)-31 b(ou)405 b(migh)-31 b(t)407 b(exp)31 b(ect,)415 b(y)-31 b(ou)406 b(ha)-31 b(v)g(e)406 b(to)f(create)h(a)f(function)h(b)31 b(efore)405 b(y)-31 b(ou)406 b(can)f(execute)h(it.)0 44843 y(In)383 b(other)g(w)-31 b(ords,)387 b(the)d(function)g (de\257nition)h(has)e(to)h(b)31 b(e)382 b(executed)i(b)31 b(efore)383 b(the)g(\257rst)g(time)0 46198 y(it)370 b(is)f(called.)2767 48960 y Fm(As)405 b(an)g(exer)-57 b(cise,)408 b(move)d(the)g(last)e (thr)-57 b(e)g(e)406 b(lines)f(of)g(this)g(pr)-57 b(o)g(gr)g(am)405 b(to)f(the)h(top,)2767 50315 y(so)400 b(the)g(function)i(c)-57 b(al)57 b(ls)400 b(app)-57 b(e)g(ar)400 b(b)-57 b(efor)g(e)402 b(the)e(de\257nitions.)523 b(R)-28 b(un)401 b(the)f(pr)-57 b(o)g(gr)g(am)2767 51670 y(and)396 b(se)-57 b(e)397 b(what)e(err)-57 b(or)395 b(message)h(you)h(get.)2767 54433 y(As)639 b(another)g(exer) -57 b(cise,)701 b(start)638 b(with)g(the)h(working)h(version)f(of)h (the)f(pr)-57 b(o-)2767 55788 y(gr)g(am)591 b(and)f(move)g(the)g (de\257nition)h(of)f Fk(newLine)h Fm(after)f(the)g(de\257nition)h(of) 2767 57143 y Fk(threeLines)p Fm(.)512 b(What)395 b(happ)-57 b(ens)395 b(when)h(you)h(run)f(this)g(pr)-57 b(o)g(gr)g(am?)p eop %%Page: 28 54 28 53 bop 0 -2070 a Fv(28)31548 b(F)-106 b(unctions)p 0 -1627 38191 45 v 0 865 a Fl(3.8)1793 b(Flo)-50 b(w)598 b(of)f(execution)0 3394 y Fn(In)469 b(order)f(to)i(ensure)e(that)i(a)f (function)h(is)f(de\257ned)g(b)31 b(efore)469 b(its)g(\257rst)g(use,) 493 b(y)-31 b(ou)470 b(ha)-31 b(v)g(e)470 b(to)0 4749 y(kno)-31 b(w)424 b(the)g(order)e(in)i(whic)-31 b(h)424 b(statemen)-31 b(ts)424 b(are)f(executed,)438 b(whic)-31 b(h)424 b(is)f(called)h(the)g Fv(\260o)-35 b(w)487 b(of)0 6104 y(execution)p Fn(.)0 8291 y(Execution)376 b(alw)-31 b(a)g(ys)376 b(b)31 b(egins)374 b(at)h(the)g(\257rst)e(statemen)-31 b(t)377 b(of)d(the)h(program.)508 b(Statemen)-31 b(ts)376 b(are)0 9646 y(executed)370 b(one)f(at)h(a)f(time,)i(in)f(order)e(from) i(top)g(to)g(b)31 b(ottom.)0 11832 y(F)-92 b(unction)543 b(de\257nitions)h(do)e(not)h(alter)h(the)e(\260o)-31 b(w)544 b(of)e(execution)i(of)f(the)g(program,)587 b(but)0 13187 y(remem)-31 b(b)31 b(er)257 b(that)i(statemen)-31 b(ts)260 b(inside)e(the)g(function)h(are)e(not)h(executed)g(un)-31 b(til)260 b(the)e(function)0 14542 y(is)276 b(called.)463 b(Although)278 b(it)f(is)f(not)h(common,)297 b(y)-31 b(ou)277 b(can)f(de\257ne)g(one)h(function)g(inside)g(another.)0 15897 y(In)318 b(this)h(case,)330 b(the)319 b(inner)f(de\257nition)i (isn't)g(executed)f(un)-31 b(til)320 b(the)f(outer)g(function)i(is)d (called.)0 18084 y(F)-92 b(unction)344 b(calls)g(are)f(lik)-31 b(e)344 b(a)g(detour)f(in)h(the)f(\260o)-31 b(w)345 b(of)e(execution.) 486 b(Instead)343 b(of)h(going)h(to)f(the)0 19439 y(next)379 b(statemen)-31 b(t,)383 b(the)c(\260o)-31 b(w)380 b(jumps)e(to)i(the)e (\257rst)g(line)i(of)f(the)f(called)i(function,)j(executes)0 20794 y(all)370 b(the)g(statemen)-31 b(ts)371 b(there,)e(and)h(then)f (comes)h(bac)-31 b(k)369 b(to)h(pic)-31 b(k)370 b(up)f(where)g(it)h (left)g(o\256.)0 22980 y(That)538 b(sounds)e(simple)h(enough,)579 b(un)-31 b(til)538 b(y)-31 b(ou)537 b(remem)-31 b(b)31 b(er)537 b(that)g(one)g(function)h(can)f(call)0 24335 y(another.)458 b(While)262 b(in)g(the)h(middle)g(of)f(one)h(function,) 285 b(the)262 b(program)h(migh)-31 b(t)264 b(ha)-31 b(v)g(e)263 b(to)g(execute)0 25690 y(the)339 b(statemen)-31 b(ts)341 b(in)e(another)g(function.)484 b(But)339 b(while)h(executing)h(that)f (new)f(function,)347 b(the)0 27045 y(program)370 b(migh)-31 b(t)371 b(ha)-31 b(v)g(e)370 b(to)g(execute)g(y)-31 b(et)370 b(another)g(function!)0 29232 y(F)-92 b(ortunately)g(,)522 b(Python)492 b(is)e(adept)h(at)g(k)-31 b(eeping)491 b(trac)-31 b(k)491 b(of)g(where)f(it)h(is,)521 b(so)490 b(eac)-31 b(h)491 b(time)h(a)0 30587 y(function)397 b(completes,)404 b(the)395 b(program)h(pic)-31 b(ks)396 b(up)f(where)h(it)g(left)g (o\256)g(in)f(the)h(function)h(that)0 31942 y(called)370 b(it.)494 b(When)368 b(it)i(gets)g(to)g(the)f(end)g(of)h(the)f (program,)i(it)f(terminates.)0 34128 y(What's)456 b(the)g(moral)h(of)f (this)f(sordid)h(tale?)752 b(When)455 b(y)-31 b(ou)456 b(read)f(a)h(program,)478 b(don't)457 b(read)0 35483 y(from)370 b(top)g(to)g(b)31 b(ottom.)494 b(Instead,)370 b(follo)-31 b(w)372 b(the)d(\260o)-31 b(w)370 b(of)g(execution.)0 40059 y Fl(3.9)1793 b(P)-50 b(arameters)600 b(and)e(argumen)-50 b(ts)0 42587 y Fn(Some)331 b(of)f(the)g(built-in)h(functions)g(y)-31 b(ou)331 b(ha)-31 b(v)g(e)331 b(used)e(require)g(argumen)-31 b(ts,)340 b(the)330 b(v)-61 b(alues)330 b(that)0 43942 y(con)-31 b(trol)495 b(ho)-31 b(w)495 b(the)f(function)i(do)31 b(es)493 b(its)h(job.)868 b(F)-92 b(or)493 b(example,)527 b(if)494 b(y)-31 b(ou)495 b(w)-31 b(an)g(t)495 b(to)g(\257nd)f(the)0 45297 y(sine)392 b(of)i(a)e(n)-31 b(um)g(b)31 b(er,)399 b(y)-31 b(ou)394 b(ha)-31 b(v)g(e)393 b(to)g(indicate)i(what)e(the)g(n) -31 b(um)g(b)31 b(er)393 b(is.)562 b(Th)-31 b(us,)399 b Fk(sin)393 b Fn(tak)-31 b(es)394 b(a)0 46652 y(n)-31 b(umeric)370 b(v)-61 b(alue)369 b(as)g(an)h(argumen)-31 b(t.)0 48839 y(Some)521 b(functions)g(tak)-31 b(e)522 b(more)e(than)h(one)g(argumen)-31 b(t.)947 b(F)-92 b(or)520 b(example,)560 b Fk(pow)520 b Fn(tak)-31 b(es)521 b(t)-31 b(w)g(o)0 50194 y(argumen)g(ts,)371 b(the)e(base)g(and)h(the)f(exp)31 b(onen)-31 b(t.)494 b(Inside)368 b(the)i(function,)h(the)e(v)-61 b(alues)370 b(that)g(are)0 51549 y(passed)f(get)h(assigned)f(to)h(v)-61 b(ariables)370 b(called)g Fv(parameters)p Fn(.)0 53735 y(Here)f(is)g(an)g(example)i(of)f(a)f(user-de\257ned)f(function)j(that) f(tak)-31 b(es)370 b(a)g(parameter:)0 56003 y Fk(def)582 b(printTwice\(bruce\):)1162 57358 y(print)g(bruce,)g(bruce)p eop %%Page: 29 55 29 54 bop 0 -2070 a Fv(3.9)425 b(P)-35 b(arameters)425 b(and)g(argumen)-35 b(ts)19839 b(29)p 0 -1627 38191 45 v 0 865 a Fn(This)519 b(function)i(tak)-31 b(es)520 b(a)f(single)h (argumen)-31 b(t)521 b(and)e(assigns)g(it)h(to)g(a)f(parameter)h(named) 0 2220 y Fk(bruce)p Fn(.)564 b(The)393 b(v)-61 b(alue)394 b(of)f(the)g(parameter)h(\(at)g(this)f(p)31 b(oin)-31 b(t)394 b(w)-31 b(e)394 b(ha)-31 b(v)g(e)394 b(no)f(idea)g(what)i(it)e (will)0 3575 y(b)31 b(e\))488 b(is)f(prin)-31 b(ted)489 b(t)-31 b(wice,)519 b(follo)-31 b(w)g(ed)491 b(b)-31 b(y)488 b(a)g(newline.)849 b(The)488 b(name)h Fk(bruce)f Fn(w)-31 b(as)488 b(c)-31 b(hosen)488 b(to)0 4930 y(suggest)423 b(that)i(the)e(name)g(y)-31 b(ou)424 b(giv)-31 b(e)424 b(a)g(parameter)f(is)g(up)g(to)h(y)-31 b(ou,)437 b(but)423 b(in)h(general,)437 b(y)-31 b(ou)0 6285 y(w)g(an)g(t)371 b(to)f(c)-31 b(ho)31 b(ose)369 b(something)i(more)f(illustrativ)-31 b(e)372 b(than)e Fk(bruce)p Fn(.)0 8524 y(The)f(function)i Fk(printTwice)f Fn(w)-31 b(orks)370 b(for)f(an)-31 b(y)370 b(t)-31 b(yp)31 b(e)370 b(that)g(can)g(b)31 b(e)369 b(prin)-31 b(ted:)0 10844 y Fk(>>>)582 b(printTwice\('Spam'\))0 12199 y(Spam)g(Spam)0 13554 y(>>>)g(printTwice\(5\))0 14909 y(5)f(5)0 16264 y(>>>)h(printTwice\(3.14159\))0 17619 y(3.14159)g(3.14159)0 19939 y Fn(In)319 b(the)h(\257rst)f (function)j(call,)331 b(the)320 b(argumen)-31 b(t)321 b(is)f(a)g(string.)477 b(In)319 b(the)h(second,)330 b(it's)320 b(an)g(in)-31 b(teger.)0 21294 y(In)369 b(the)g(third,)h(it's)g(a)g Fk(float)p Fn(.)0 23533 y(The)477 b(same)g(rules)f(of)h(comp)31 b(osition)479 b(that)f(apply)f(to)g(built-in)i(functions)e(also)h (apply)f(to)0 24888 y(user-de\257ned)342 b(functions,)350 b(so)343 b(w)-31 b(e)344 b(can)f(use)g(an)-31 b(y)344 b(kind)g(of)f(expression)g(as)h(an)f(argumen)-31 b(t)345 b(for)0 26242 y Fk(printTwice)p Fn(:)0 28563 y Fk(>>>)582 b(printTwice\('Spam'*4\))0 29917 y(SpamSpamSpamSpam)i(SpamSpamSpamSpam) 0 31272 y(>>>)e(printTwice\(math.cos\(math.pi\)\))0 32627 y(-1.0)g(-1.0)0 34947 y Fn(As)356 b(usual,)k(the)d(expression)g(is)g (ev)-61 b(aluated)358 b(b)31 b(efore)356 b(the)h(function)h(is)f(run,)i (so)e Fk(printTwice)0 36302 y Fn(prin)-31 b(ts)369 b Fk(SpamSpamSpamSpam)584 b(SpamSpamSpamSpam)371 b Fn(instead)f(of)g Fk('Spam'*4)582 b('Spam'*4)p Fn(.)2767 39090 y Fm(As)346 b(an)g(exer)-57 b(cise,)357 b(write)345 b(a)h(c)-57 b(al)57 b(l)345 b(to)h Fk(printTwice)h Fm(that)e(do)-57 b(es)346 b(print)g Fk('Spam'*4)2767 40445 y('Spam'*4)p Fm(.)677 b(Hint:)621 b(strings)451 b(c)-57 b(an)452 b(b)-57 b(e)452 b(enclose)-57 b(d)452 b(in)g(either)g(single)g(or)f(double)2767 41800 y(quotes,)471 b(and)455 b(the)h(typ)-57 b(e)456 b(of)f(quote)h(not)f(use)-57 b(d)456 b(to)f(enclose)h(the)f(string)h(c) -57 b(an)456 b(b)-57 b(e)2767 43155 y(use)g(d)397 b(inside)f(it)h(as)e (p)-57 b(art)396 b(of)g(the)g(string.)0 45943 y Fn(W)-92 b(e)368 b(can)i(also)g(use)f(a)g(v)-61 b(ariable)370 b(as)f(an)h(argumen)-31 b(t:)0 48263 y Fk(>>>)582 b(michael)g(=)f ('Eric,)h(the)g(half)f(a)h(bee.')0 49618 y(>>>)g(printTwice\(michael\)) 0 50973 y(Eric,)g(the)f(half)h(a)g(bee.)f(Eric,)h(the)g(half)g(a)f (bee.)0 53293 y Fn(Notice)355 b(something)h(v)-31 b(ery)353 b(imp)31 b(ortan)-31 b(t)356 b(here.)487 b(The)354 b(name)h(of)f(the)g (v)-61 b(ariable)355 b(w)-31 b(e)354 b(pass)f(as)h(an)0 54648 y(argumen)-31 b(t)296 b(\()p Fk(michael)p Fn(\))f(has)g(nothing)g (to)g(do)g(with)g(the)f(name)h(of)g(the)f(parameter)h(\()p Fk(bruce)p Fn(\).)0 56003 y(It)406 b(do)31 b(esn't)406 b(matter)h(what)h(the)e(v)-61 b(alue)406 b(w)-31 b(as)407 b(called)g(bac)-31 b(k)406 b(home)h(\(in)f(the)h(caller\);)425 b(here)406 b(in)0 57358 y Fk(printTwice)p Fn(,)371 b(w)-31 b(e)370 b(call)g(ev)-31 b(eryb)31 b(o)g(dy)369 b Fk(bruce)p Fn(.)p eop %%Page: 30 56 30 55 bop 0 -2070 a Fv(30)31548 b(F)-106 b(unctions)p 0 -1627 38191 45 v 0 865 a Fl(3.10)1792 b(V)-149 b(ariables)599 b(and)f(parameters)i(are)e(lo)50 b(cal)0 4124 y Fn(When)442 b(y)-31 b(ou)444 b(create)f(a)g Fv(lo)35 b(cal)509 b(v)-71 b(ariable)442 b Fn(inside)i(a)f(function,)463 b(it)444 b(only)f(exists)g(inside)h(the)0 5479 y(function,)371 b(and)f(y)-31 b(ou)369 b(cannot)i(use)d(it)i(outside.)494 b(F)-92 b(or)368 b(example:)0 8269 y Fk(def)582 b(catTwice\(part1,)h (part2\):)1162 9624 y(cat)f(=)f(part1)h(+)f(part2)1162 10979 y(printTwice\(cat\))0 13768 y Fn(This)527 b(function)h(tak)-31 b(es)528 b(t)-31 b(w)g(o)528 b(argumen)-31 b(ts,)568 b(concatenates)529 b(them,)567 b(and)527 b(then)g(prin)-31 b(ts)527 b(the)0 15123 y(result)369 b(t)-31 b(wice.)494 b(W)-92 b(e)369 b(can)g(call)i(the)e(function)i(with)f(t)-31 b(w)g(o)371 b(strings:)0 17913 y Fk(>>>)582 b(chant1)g(=)f("Pie)h(Jesu) f(domine,)i(")0 19267 y(>>>)f(chant2)g(=)f("Dona)h(eis)f(requiem.")0 20622 y(>>>)h(catTwice\(chant1,)h(chant2\))0 21977 y(Pie)f(Jesu)f (domine,)i(Dona)e(eis)h(requiem.)g(Pie)g(Jesu)g(domine,)g(Dona)f(eis)h (requiem.)0 24767 y Fn(When)351 b Fk(catTwice)h Fn(terminates,)357 b(the)352 b(v)-61 b(ariable)352 b Fk(cat)g Fn(is)f(destro)-31 b(y)g(ed.)488 b(If)351 b(w)-31 b(e)352 b(try)f(to)i(prin)-31 b(t)352 b(it,)0 26122 y(w)-31 b(e)370 b(get)g(an)f(error:)0 28911 y Fk(>>>)582 b(print)f(cat)0 30266 y(NameError:)i(cat)0 33056 y Fn(P)-31 b(arameters)325 b(are)f(also)h(lo)31 b(cal.)479 b(F)-92 b(or)323 b(example,)335 b(outside)325 b(the)g(function)g Fk(printTwice)p Fn(,)335 b(there)0 34410 y(is)369 b(no)h(suc)-31 b(h)368 b(thing)j(as)e Fk(bruce)p Fn(.)493 b(If)369 b(y)-31 b(ou)370 b(try)f(to)h(use)f(it,)h (Python)h(will)g(complain.)0 40551 y Fl(3.11)1792 b(Stac)-50 b(k)599 b(diagrams)0 43810 y Fn(T)-92 b(o)431 b(k)-31 b(eep)431 b(trac)-31 b(k)432 b(of)f(whic)-31 b(h)431 b(v)-61 b(ariables)432 b(can)f(b)31 b(e)430 b(used)g(where,)446 b(it)432 b(is)e(sometimes)i(useful)f(to)0 45165 y(dra)-31 b(w)353 b(a)f Fv(stac)-35 b(k)404 b(diagram)p Fn(.)487 b(Lik)-31 b(e)353 b(state)g(diagrams,)k(stac)-31 b(k)353 b(diagrams)h(sho)-31 b(w)352 b(the)h(v)-61 b(alue)352 b(of)0 46520 y(eac)-31 b(h)370 b(v)-61 b(ariable,)370 b(but)g(they)f(also)i(sho)-31 b(w)369 b(the)h(function)g(to)g(whic)-31 b(h)370 b(eac)-31 b(h)370 b(v)-61 b(ariable)370 b(b)31 b(elongs.)0 49229 y(Eac)-31 b(h)425 b(function)g(is)f(represen)-31 b(ted)423 b(b)-31 b(y)425 b(a)f Fv(frame)p Fn(.)657 b(A)424 b(frame)h(is)e(a)i(b)31 b(o)-31 b(x)424 b(with)h(the)g(name)f(of)0 50584 y(a)388 b(function)h(b)31 b(eside)388 b(it)h(and)f(the)g (parameters)g(and)g(v)-61 b(ariables)389 b(of)f(the)g(function)h (inside)g(it.)0 51938 y(The)369 b(stac)-31 b(k)370 b(diagram)h(for)f (the)f(previous)g(example)i(lo)31 b(oks)370 b(lik)-31 b(e)371 b(this:)p eop %%Page: 31 57 31 56 bop 0 -2070 a Fv(3.11)425 b(Stac)-35 b(k)424 b(diagrams)25760 b(31)p 0 -1627 38191 45 v 2928 -242 a 19142492 9341009 0 0 19142492 9341009 startTexFig 2928 -242 a %%BeginDocument: illustrations/stack.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: stack.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Sun Dec 30 18:20:56 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 291 142 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 142 moveto 0 0 lineto 291 0 lineto 291 142 lineto closepath clip newpath -34.0 199.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 1425 975 m 5400 975 l 5400 1650 l 1425 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1424 2925 m 5392 2925 l 5392 3300 l 1424 3300 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1425 1800 m 5400 1800 l 5400 2775 l 1425 2775 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 2490 2302 m 2490 2242 l 2338 2242 l 2458 2272 l 2338 2302 l cp eoclip n 2100 2272 m 2475 2272 l gs col0 s gr gr % arrowhead n 2338 2302 m 2458 2272 l 2338 2242 l col0 s % Polyline gs clippath 2490 2602 m 2490 2542 l 2338 2542 l 2458 2572 l 2338 2602 l cp eoclip n 2100 2572 m 2475 2572 l gs col0 s gr gr % arrowhead n 2338 2602 m 2458 2572 l 2338 2542 l col0 s % Polyline gs clippath 2490 2002 m 2490 1942 l 2338 1942 l 2458 1972 l 2338 2002 l cp eoclip n 2100 1972 m 2475 1972 l gs col0 s gr gr % arrowhead n 2338 2002 m 2458 1972 l 2338 1942 l col0 s % Polyline gs clippath 2490 1477 m 2490 1417 l 2338 1417 l 2458 1447 l 2338 1477 l cp eoclip n 2100 1447 m 2475 1447 l gs col0 s gr gr % arrowhead n 2338 1477 m 2458 1447 l 2338 1417 l col0 s % Polyline gs clippath 2490 1177 m 2490 1117 l 2338 1117 l 2458 1147 l 2338 1177 l cp eoclip n 2100 1147 m 2475 1147 l gs col0 s gr gr % arrowhead n 2338 1177 m 2458 1147 l 2338 1117 l col0 s % Polyline gs clippath 2482 3127 m 2482 3067 l 2330 3067 l 2450 3097 l 2330 3127 l cp eoclip n 2092 3097 m 2467 3097 l gs col0 s gr gr % arrowhead n 2330 3127 m 2450 3097 l 2330 3067 l col0 s /Helvetica ff 165.00 scf sf 1350 2025 m gs 1 -1 sc (catTwice) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1200 m gs 1 -1 sc (chant1) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1500 m gs 1 -1 sc (chant2) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1200 m gs 1 -1 sc ("Pie Jesu domine,") col0 sh gr /Helvetica ff 165.00 scf sf 2550 1500 m gs 1 -1 sc ("Dona eis requiem.") col0 sh gr /Helvetica ff 165.00 scf sf 1350 1200 m gs 1 -1 sc (__main__) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 578 3173 m gs 1 -1 sc (printTwice) col0 sh gr /Helvetica ff 165.00 scf sf 2025 2025 m gs 1 -1 sc (part1) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 2325 m gs 1 -1 sc (part2) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 2625 m gs 1 -1 sc (cat) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 2025 m gs 1 -1 sc ("Pie Jesu domine,") col0 sh gr /Helvetica ff 165.00 scf sf 2550 2625 m gs 1 -1 sc ("Pie Jesu domine, Dona eis requiem.") col0 sh gr /Helvetica ff 165.00 scf sf 2550 2325 m gs 1 -1 sc ("Dona eis requiem.") col0 sh gr /Helvetica ff 165.00 scf sf 2017 3150 m gs 1 -1 sc (bruce) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2542 3150 m gs 1 -1 sc ("Pie Jesu domine, Dona eis requiem.") col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 17864 a Fn(The)394 b(order)f(of)h(the)h(stac)-31 b(k)394 b(sho)-31 b(ws)394 b(the)g(\260o)-31 b(w)395 b(of)f(execution.)568 b Fk(printTwice)395 b Fn(w)-31 b(as)395 b(called)g(b)-31 b(y)0 19219 y Fk(catTwice)p Fn(,)484 b(and)460 b Fk(catTwice)h Fn(w)-31 b(as)461 b(called)g(b)-31 b(y)p 19935 19219 349 45 v 20353 19219 V 1297 w Fk(main)p 23096 19219 V 23514 19219 V 837 w Fn(,)483 b(whic)-31 b(h)461 b(is)f(a)g(sp)31 b(ecial)460 b(name)h(for)0 20574 y(the)439 b(topmost)i(function.)704 b(When)439 b(y)-31 b(ou)439 b(create)h(a)f(v)-61 b(ariable)440 b(outside)g(of)g(an)-31 b(y)440 b(function,)458 b(it)0 21929 y(b)31 b(elongs)370 b(to)p 5395 21929 V 5814 21929 V 1207 w Fk(main)p 8557 21929 V 8975 21929 V 837 w Fn(.)0 24420 y(Eac)-31 b(h)476 b(parameter)g(refers)e(to)i(the)f(same)h(v)-61 b(alue)475 b(as)g(its)h(corresp)31 b(onding)475 b(argumen)-31 b(t.)812 b(So,)0 25775 y Fk(part1)354 b Fn(has)f(the)h(same)g(v)-61 b(alue)353 b(as)h Fk(chant1)p Fn(,)j Fk(part2)d Fn(has)g(the)f(same)h (v)-61 b(alue)354 b(as)f Fk(chant2)p Fn(,)358 b(and)0 27130 y Fk(bruce)370 b Fn(has)f(the)g(same)h(v)-61 b(alue)369 b(as)h Fk(cat)p Fn(.)0 29620 y(If)290 b(an)g(error)f(o)31 b(ccurs)289 b(during)i(a)f(function)i(call,)307 b(Python)292 b(prin)-31 b(ts)290 b(the)g(name)h(of)g(the)f(function,)0 30975 y(and)382 b(the)f(name)h(of)g(the)f(function)i(that)g(called)f (it,)k(and)381 b(the)h(name)g(of)f(the)h(function)h(that)0 32330 y(called)370 b Fm(that)p Fn(,)f(all)h(the)g(w)-31 b(a)g(y)370 b(bac)-31 b(k)370 b(to)p 15374 32330 V 15793 32330 V 1207 w Fk(main)p 18535 32330 V 18954 32330 V 838 w Fn(.)0 34820 y(F)-92 b(or)649 b(example,)721 b(if)650 b(w)-31 b(e)651 b(try)e(to)i(access)e Fk(cat)g Fn(from)i(within)g Fk(printTwice)p Fn(,)721 b(w)-31 b(e)650 b(get)h(a)0 36175 y Fk(NameError)p Fn(:)0 38747 y Fk(Traceback)582 b(\(innermost)h(last\):)1162 40102 y(File)f("test.py",)h(line)e(13,)h (in)f(__main__)2325 41457 y(catTwice\(chant1,)i(chant2\))1162 42812 y(File)f("test.py",)h(line)e(5,)h(in)f(catTwice)2325 44167 y(printTwice\(cat\))1162 45521 y(File)h("test.py",)h(line)e(9,)h (in)f(printTwice)2325 46876 y(print)g(cat)0 48231 y(NameError:)i(cat)0 50803 y Fn(This)391 b(list)g(of)f(functions)i(is)e(called)h(a)g Fv(tracebac)-35 b(k)p Fn(.)555 b(It)390 b(tells)h(y)-31 b(ou)391 b(what)g(program)g(\257le)g(the)0 52158 y(error)298 b(o)31 b(ccurred)298 b(in,)314 b(and)299 b(what)h(line,)314 b(and)299 b(what)h(functions)g(w)-31 b(ere)299 b(executing)h(at)g(the)f (time.)0 53513 y(It)369 b(also)h(sho)-31 b(ws)370 b(the)f(line)h(of)g (co)31 b(de)369 b(that)h(caused)f(the)h(error.)0 56003 y(Notice)415 b(the)e(similarit)-31 b(y)417 b(b)31 b(et)-31 b(w)g(een)414 b(the)f(tracebac)-31 b(k)415 b(and)e(the)h(stac)-31 b(k)414 b(diagram.)627 b(It's)414 b(not)g(a)0 57358 y(coincidence.)p eop %%Page: 32 58 32 57 bop 0 -2070 a Fv(32)31548 b(F)-106 b(unctions)p 0 -1627 38191 45 v 0 865 a Fl(3.12)1792 b(F)-149 b(unctions)599 b(with)g(results)0 3498 y Fn(Y)-92 b(ou)408 b(migh)-31 b(t)411 b(ha)-31 b(v)g(e)409 b(noticed)g(b)-31 b(y)409 b(no)-31 b(w)409 b(that)g(some)g(of)g(the)f(functions)i(w)-31 b(e)408 b(are)g(using,)419 b(suc)-31 b(h)0 4853 y(as)361 b(the)f(math)i(functions,)i(yield)e(results.)489 b(Other)361 b(functions,)j(lik)-31 b(e)361 b Fk(newLine)p Fn(,)j(p)31 b(erform)361 b(an)0 6207 y(action)371 b(but)e(don't)i(return)d(a)i(v) -61 b(alue.)493 b(That)370 b(raises)f(some)h(questions:)1353 9037 y(1.)554 b(What)388 b(happ)31 b(ens)388 b(if)g(y)-31 b(ou)388 b(call)h(a)f(function)h(and)f(y)-31 b(ou)388 b(don't)h(do)f(an)-31 b(ything)390 b(with)f(the)2767 10392 y(result)427 b(\(i.e.,)443 b(y)-31 b(ou)428 b(don't)g(assign)f (it)g(to)h(a)f(v)-61 b(ariable)428 b(or)e(use)g(it)i(as)e(part)h(of)h (a)f(larger)2767 11747 y(expression\)?)1353 14165 y(2.)554 b(What)341 b(happ)31 b(ens)339 b(if)i(y)-31 b(ou)341 b(use)e(a)h(function)i(without)g(a)e(result)g(as)g(part)g(of)h(an)f (expres-)2767 15520 y(sion,)370 b(suc)-31 b(h)369 b(as)g Fk(newLine\(\))583 b(+)e(7)p Fn(?)1353 17938 y(3.)554 b(Can)427 b(y)-31 b(ou)427 b(write)f(functions)h(that)g(yield)g (results,)441 b(or)425 b(are)h(y)-31 b(ou)427 b(stuc)-31 b(k)426 b(with)h(simple)2767 19293 y(function)371 b(lik)-31 b(e)370 b Fk(newLine)g Fn(and)g Fk(printTwice)p Fn(?)0 22123 y(The)f(answ)-31 b(er)370 b(to)g(the)f(third)h(question)g(is)f(y) -31 b(es,)370 b(and)f(w)-31 b(e'll)371 b(do)f(it)g(in)f(Chapter)h(5.) 2767 24953 y Fm(As)421 b(an)h(exer)-57 b(cise,)429 b(answer)421 b(the)g(other)f(two)h(questions)h(by)g(trying)g(them)g(out.)2767 26308 y(When)364 b(you)g(have)f(a)g(question)h(ab)-57 b(out)363 b(what)f(is)i(le)-57 b(gal)364 b(or)f(il)57 b(le)-57 b(gal)363 b(in)i(Python,)370 b(a)2767 27663 y(go)-57 b(o)g(d)397 b(way)f(to)f(\257nd)i(out)e(is)h(to)g(ask)g(the)f (interpr)-57 b(eter.)0 32460 y Fl(3.13)1792 b(Glossary)0 34721 y Fv(function)425 b(call:)552 b Fn(A)415 b(statemen)-31 b(t)417 b(that)f(executes)f(a)g(function.)631 b(It)415 b(consists)g(of)g(the)g(name)2767 36076 y(of)370 b(the)g(function)g (follo)-31 b(w)g(ed)372 b(b)-31 b(y)370 b(a)f(list)h(of)g(argumen)-31 b(ts)370 b(enclosed)g(in)f(paren)-31 b(theses.)0 38494 y Fv(argumen)c(t:)554 b Fn(A)430 b(v)-61 b(alue)430 b(pro)-31 b(vided)431 b(to)g(a)f(function)i(when)e(the)g(function)h(is)f(called.) 677 b(This)2767 39849 y(v)-61 b(alue)370 b(is)f(assigned)h(to)g(the)f (corresp)31 b(onding)370 b(parameter)f(in)h(the)f(function.)0 42266 y Fv(return)426 b(v)-71 b(alue:)553 b Fn(The)353 b(result)f(of)g(a)h(function.)488 b(If)352 b(a)h(function)g(call)h(is)e (used)f(as)h(an)h(expres-)2767 43621 y(sion,)370 b(the)g(return)e(v)-61 b(alue)370 b(is)f(the)h(v)-61 b(alue)369 b(of)h(the)f(expression.)0 46039 y Fv(t)-35 b(yp)35 b(e)425 b(con)-35 b(v)g(ersion:)554 b Fn(An)483 b(explicit)j(statemen)-31 b(t)485 b(that)g(tak)-31 b(es)484 b(a)g(v)-61 b(alue)484 b(of)g(one)g(t)-31 b(yp)31 b(e)484 b(and)2767 47394 y(computes)370 b(a)g(corresp)31 b(onding)369 b(v)-61 b(alue)370 b(of)g(another)f(t)-31 b(yp)31 b(e.)0 49812 y Fv(t)-35 b(yp)35 b(e)425 b(co)35 b(ercion:)554 b Fn(A)516 b(t)-31 b(yp)31 b(e)516 b(con)-31 b(v)g(ersion)516 b(that)h(happ)31 b(ens)515 b(automatically)520 b(according)d(to)2767 51167 y(Python's)371 b(co)31 b(ercion)370 b(rules.)0 53585 y Fv(mo)35 b(dule:)554 b Fn(A)369 b(\257le)h(that)g (con)-31 b(tains)371 b(a)f(collection)h(of)f(related)g(functions)g(and) g(classes.)0 56003 y Fv(dot)425 b(notation:)554 b Fn(The)342 b(syn)-31 b(tax)342 b(for)g(calling)i(a)e(function)g(in)g(another)g(mo) 31 b(dule,)349 b(sp)31 b(ecifying)2767 57358 y(the)370 b(mo)31 b(dule)370 b(name)g(follo)-31 b(w)g(ed)372 b(b)-31 b(y)369 b(a)h(dot)g(\(p)31 b(erio)g(d\))370 b(and)f(the)h(function)g (name.)p eop %%Page: 33 59 33 58 bop 0 -2070 a Fv(3.13)425 b(Glossary)29420 b(33)p 0 -1627 38191 45 v 0 865 a(function:)554 b Fn(A)426 b(named)g(sequence) g(of)h(statemen)-31 b(ts)427 b(that)h(p)31 b(erforms)425 b(some)i(useful)f(op)31 b(era-)2767 2220 y(tion.)815 b(F)-92 b(unctions)476 b(ma)-31 b(y)478 b(or)e(ma)-31 b(y)477 b(not)g(tak)-31 b(e)477 b(parameters)g(and)f(ma)-31 b(y)478 b(or)e(ma)-31 b(y)477 b(not)2767 3575 y(pro)31 b(duce)369 b(a)h(result.)0 5815 y Fv(function)425 b(de\257nition:)554 b Fn(A)424 b(statemen)-31 b(t)426 b(that)f(creates)f(a)g(new)g (function,)440 b(sp)31 b(ecifying)425 b(its)2767 7170 y(name,)371 b(parameters,)f(and)f(the)h(statemen)-31 b(ts)371 b(it)f(executes.)0 9411 y Fv(\260o)-35 b(w)425 b(of)g(execution:)554 b Fn(The)351 b(order)g(in)g(whic)-31 b(h)352 b(statemen)-31 b(ts)353 b(are)e(executed)g(during)h(a)f(pro-) 2767 10766 y(gram)370 b(run.)0 13006 y Fv(parameter:)554 b Fn(A)401 b(name)h(used)e(inside)h(a)g(function)i(to)e(refer)f(to)i (the)f(v)-61 b(alue)401 b(passed)g(as)g(an)2767 14361 y(argumen)-31 b(t.)0 16602 y Fv(lo)35 b(cal)424 b(v)-71 b(ariable:)553 b Fn(A)356 b(v)-61 b(ariable)358 b(de\257ned)e(inside)g (a)h(function.)490 b(A)356 b(lo)31 b(cal)358 b(v)-61 b(ariable)357 b(can)g(only)2767 17957 y(b)31 b(e)369 b(used)g(inside)g(its)h(function.)0 20197 y Fv(stac)-35 b(k)424 b(diagram:)553 b Fn(A)379 b(graphical)h(represen)-31 b(tation)381 b(of)e(a)g(stac)-31 b(k)380 b(of)g(functions,)j(their)c(v) -61 b(ari-)2767 21552 y(ables,)370 b(and)g(the)f(v)-61 b(alues)370 b(to)g(whic)-31 b(h)370 b(they)f(refer.)0 23793 y Fv(frame:)553 b Fn(A)436 b(b)31 b(o)-31 b(x)435 b(in)h(a)g(stac)-31 b(k)436 b(diagram)h(that)f(represen)-31 b(ts)434 b(a)i(function)h(call.)692 b(It)435 b(con)-31 b(tains)2767 25147 y(the)370 b(lo)31 b(cal)370 b(v)-61 b(ariables)370 b(and)g(parameters)f(of)h(the)f(function.)0 27388 y Fv(tracebac)-35 b(k:)553 b Fn(A)372 b(list)g(of)g(the)g (functions)h(that)g(are)f(executing,)i(prin)-31 b(ted)372 b(when)g(a)g(run)-31 b(time)2767 28743 y(error)369 b(o)31 b(ccurs.)p eop %%Page: 34 60 34 59 bop 0 -2070 a Fv(34)31548 b(F)-106 b(unctions)p 0 -1627 38191 45 v eop %%Page: 35 61 35 60 bop 0 9812 a Fi(Chapter)861 b(4)0 16002 y Fo(Conditionals)1033 b(and)h(recursion)0 23051 y Fl(4.1)1793 b(The)598 b(mo)50 b(dulus)599 b(op)50 b(erator)0 25328 y Fn(The)323 b Fv(mo)35 b(dulus)371 b(op)35 b(erator)325 b Fn(w)-31 b(orks)323 b(on)g(in)-31 b(tegers)323 b(\(and)g(in)-31 b(teger)323 b(expressions\))g(and)f(yields)0 26683 y(the)374 b(remainder)h(when)f (the)h(\257rst)f(op)31 b(erand)374 b(is)g(divided)h(b)-31 b(y)375 b(the)f(second.)508 b(In)373 b(Python,)378 b(the)0 28038 y(mo)31 b(dulus)468 b(op)31 b(erator)468 b(is)g(a)g(p)31 b(ercen)-31 b(t)467 b(sign)h(\()p Fk(\045)p Fn(\).)789 b(The)468 b(syn)-31 b(tax)468 b(is)g(the)g(same)f(as)h(for)g(other)0 29393 y(op)31 b(erators:)0 31418 y Fk(>>>)582 b(quotient)g(=)f(7)h(/)f (3)0 32773 y(>>>)h(print)f(quotient)0 34128 y(2)0 35483 y(>>>)h(remainder)g(=)f(7)h(\045)f(3)0 36838 y(>>>)h(print)f(remainder) 0 38193 y(1)0 40217 y Fn(So)369 b(7)h(divided)g(b)-31 b(y)369 b(3)h(is)f(2)h(with)g(1)f(left)i(o)-31 b(v)g(er.)0 42161 y(The)467 b(mo)31 b(dulus)467 b(op)31 b(erator)467 b(turns)e(out)j(to)f(b)31 b(e)466 b(surprisingly)g(useful.)785 b(F)-92 b(or)466 b(example,)492 b(y)-31 b(ou)0 43516 y(can)364 b(c)-31 b(hec)g(k)364 b(whether)f(one)h(n)-31 b(um)g(b)31 b(er)363 b(is)h(divisible)h(b)-31 b(y)363 b(another|if)i Fk(x)581 b(\045)h(y)363 b Fn(is)g(zero,)i(then)f Fk(x)0 44871 y Fn(is)369 b(divisible)i(b)-31 b(y)369 b Fk(y)p Fn(.)0 46815 y(Also,)302 b(y)-31 b(ou)284 b(can)h(extract)f (the)g(righ)-31 b(t-most)286 b(digit)g(or)d(digits)i(from)g(a)f(n)-31 b(um)g(b)31 b(er.)464 b(F)-92 b(or)283 b(example,)0 48170 y Fk(x)581 b(\045)h(10)420 b Fn(yields)h(the)g(righ)-31 b(t-most)423 b(digit)f(of)f Fk(x)g Fn(\(in)g(base)g(10\).)648 b(Similarly)423 b Fk(x)581 b(\045)g(100)421 b Fn(yields)0 49525 y(the)369 b(last)i(t)-31 b(w)g(o)370 b(digits.)0 53726 y Fl(4.2)1793 b(Bo)50 b(olean)597 b(expressions)0 56003 y Fn(A)338 b Fv(b)35 b(o)g(olean)390 b(expression)340 b Fn(is)e(an)g(expression)f(that)i(is)f(either)g(true)g(or)g(false.)483 b(In)337 b(Python,)0 57358 y(an)426 b(expression)f(that)i(is)e(true)g (has)h(the)f(v)-61 b(alue)426 b(1,)440 b(and)426 b(an)g(expression)f (that)i(is)e(false)h(has)0 58713 y(the)369 b(v)-61 b(alue)370 b(0.)p eop %%Page: 36 62 36 61 bop 0 -2070 a Fv(36)21941 b(Conditionals)425 b(and)g(recursion)p 0 -1627 38191 45 v 0 865 a Fn(The)369 b(op)31 b(erator)370 b Fk(==)f Fn(compares)h(t)-31 b(w)g(o)371 b(v)-61 b(alues)369 b(and)h(pro)31 b(duces)368 b(a)h(b)31 b(o)g(olean)371 b(expression:)0 2973 y Fk(>>>)582 b(5)f(==)g(5)0 4328 y(1)0 5683 y(>>>)h(5)f(==)g(6)0 7038 y(0)0 9147 y Fn(In)399 b(the)g(\257rst)g(statemen)-31 b(t,)409 b(the)399 b(t)-31 b(w)g(o)401 b(op)31 b(erands)399 b(are)g(equal,)408 b(so)399 b(the)h(expression)f(ev)-61 b(aluates)0 10502 y(to)370 b(1)f(\(true\);)i(in)e(the)h(second)f(statemen)-31 b(t,)372 b(5)d(is)g(not)h(equal)g(to)g(6,)g(so)f(w)-31 b(e)370 b(get)g(0)f(\(false\).)0 12529 y(The)g Fk(==)h Fn(op)31 b(erator)369 b(is)h(one)f(of)h(the)f Fv(comparison)425 b(op)35 b(erators)p Fn(;)372 b(the)e(others)f(are:)3487 14637 y Fk(x)581 b(!=)h(y)8717 b(#)581 b(x)h(is)f(not)h(equal)g(to)f(y) 3487 15992 y(x)g(>)g(y)9299 b(#)581 b(x)h(is)f(greater)h(than)g(y)3487 17347 y(x)f(<)g(y)9299 b(#)581 b(x)h(is)f(less)h(than)g(y)3487 18702 y(x)f(>=)h(y)8717 b(#)581 b(x)h(is)f(greater)h(than)g(or)f(equal) h(to)g(y)3487 20057 y(x)f(<=)h(y)8717 b(#)581 b(x)h(is)f(less)h(than)g (or)f(equal)h(to)f(y)0 22165 y Fn(Although)474 b(these)e(op)31 b(erations)473 b(are)f(probably)h(familiar)i(to)d(y)-31 b(ou,)500 b(the)472 b(Python)h(sym)-31 b(b)31 b(ols)0 23520 y(are)328 b(di\256eren)-31 b(t)328 b(from)g(the)g(mathematical)k (sym)-31 b(b)31 b(ols.)480 b(A)327 b(common)j(error)c(is)i(to)h(use)e (a)h(single)0 24875 y(equal)520 b(sign)g(\()p Fk(=)p Fn(\))g(instead)f(of)h(a)f(double)h(equal)g(sign)g(\()p Fk(==)p Fn(\).)943 b(Remem)-31 b(b)31 b(er)519 b(that)i Fk(=)e Fn(is)g(an)0 26230 y(assignmen)-31 b(t)451 b(op)31 b(erator)450 b(and)g Fk(==)f Fn(is)h(a)f(comparison)i(op)31 b(erator.)734 b(Also,)471 b(there)449 b(is)h(no)f(suc)-31 b(h)0 27585 y(thing)370 b(as)g Fk(=<)f Fn(or)g Fk(=>)p Fn(.)0 31903 y Fl(4.3)1793 b(Logical)597 b(op)50 b(erators)0 34264 y Fn(There)278 b(are)g(three)h Fv(logical)319 b(op)35 b(erators)p Fn(:)449 b Fk(and)p Fn(,)298 b Fk(or)p Fn(,)f(and)278 b Fk(not)p Fn(.)463 b(The)279 b(seman)-31 b(tics)279 b(\(meaning\))0 35619 y(of)426 b(these)f(op)31 b(erators)425 b(is)h(similar)g(to)g(their)g(meaning)h(in)f(English.)662 b(F)-92 b(or)424 b(example,)441 b Fk(x)582 b(>)f(0)0 36974 y(and)h(x)f(<)g(10)369 b Fn(is)h(true)f(only)h(if)f Fk(x)h Fn(is)f(greater)g(than)h(0)g Fm(and)f Fn(less)f(than)i(10.)0 39001 y Fk(n\0452)582 b(==)f(0)g(or)h(n\0453)f(==)h(0)370 b Fn(is)f(true)h(if)h Fm(either)e Fn(of)i(the)f(conditions)i(is)d (true,)i(that)g(is,)f(if)h(the)0 40356 y(n)-31 b(um)g(b)31 b(er)369 b(is)g(divisible)i(b)-31 b(y)369 b(2)h Fm(or)e Fn(3.)0 42383 y(Finally)-92 b(,)422 b(the)411 b Fk(not)g Fn(op)31 b(erator)411 b(negates)g(a)f(b)31 b(o)g(olean)412 b(expression,)421 b(so)410 b Fk(not\(x)582 b(>)f(y\))411 b Fn(is)f(true)0 43738 y(if)370 b Fk(\(x)581 b(>)g(y\))370 b Fn(is)f(false,)h(that)h(is,)e(if)h Fk(x)f Fn(is)g(less)g(than)h(or)f (equal)h(to)g Fk(y)p Fn(.)0 45765 y(Strictly)428 b(sp)31 b(eaking,)441 b(the)426 b(op)31 b(erands)426 b(of)h(the)f(logical)j(op) 31 b(erators)426 b(should)g(b)31 b(e)426 b(b)31 b(o)g(olean)427 b(ex-)0 47120 y(pressions,)375 b(but)g(Python)h(is)e(not)h(v)-31 b(ery)374 b(strict.)509 b(An)-31 b(y)375 b(nonzero)f(n)-31 b(um)g(b)31 b(er)375 b(is)f(in)-31 b(terpreted)375 b(as)0 48475 y(\\true.")0 50584 y Fk(>>>)1163 b(x)581 b(=)g(5)0 51938 y(>>>)1163 b(x)581 b(and)h(1)0 53293 y(1)0 54648 y(>>>)1163 b(y)581 b(=)g(0)0 56003 y(>>>)1163 b(y)581 b(and)h(1)0 57358 y(0)p eop %%Page: 37 63 37 62 bop 0 -2070 a Fv(4.4)425 b(Conditional)g(execution)22650 b(37)p 0 -1627 38191 45 v 0 865 a Fn(In)270 b(general,)291 b(this)271 b(sort)g(of)f(thing)i(is)e(not)i(considered)e(go)31 b(o)g(d)271 b(st)-31 b(yle.)461 b(If)270 b(y)-31 b(ou)271 b(w)-31 b(an)g(t)272 b(to)f(compare)0 2220 y(a)369 b(v)-61 b(alue)370 b(to)g(zero,)g(y)-31 b(ou)369 b(should)h(do)f(it)h (explicitly)-92 b(.)0 6709 y Fl(4.4)1793 b(Conditional)598 b(execution)0 9192 y Fn(In)424 b(order)f(to)i(write)g(useful)f (programs,)439 b(w)-31 b(e)425 b(almost)h(alw)-31 b(a)g(ys)426 b(need)e(the)h(abilit)-31 b(y)427 b(to)d(c)-31 b(hec)g(k)0 10547 y(conditions)403 b(and)e(c)-31 b(hange)402 b(the)f(b)31 b(eha)-31 b(vior)402 b(of)g(the)f(program)h(accordingly)-92 b(.)589 b Fv(Conditional)0 11902 y(statemen)-35 b(ts)370 b Fn(giv)-31 b(e)370 b(us)f(this)g(abilit)-31 b(y)-92 b(.)496 b(The)369 b(simplest)h(form)g(is)f(the)g Fk(if)h Fn(statemen)-31 b(t:)0 14132 y Fk(if)581 b(x)h(>)f(0:)1162 15487 y(print)h("x)g(is)f(positive")0 17717 y Fn(The)382 b(b)31 b(o)g(olean)383 b(expression)e(after)h(the)g Fk(if)g Fn(statemen)-31 b(t)384 b(is)e(called)g(the)g Fv(condition)p Fn(.)531 b(If)382 b(it)g(is)0 19072 y(true,)369 b(then)h(the)f(inden) -31 b(ted)370 b(statemen)-31 b(t)372 b(gets)d(executed.)493 b(If)369 b(not,)i(nothing)g(happ)31 b(ens.)0 21222 y(Lik)-31 b(e)357 b(other)g(comp)31 b(ound)357 b(statemen)-31 b(ts,)361 b(the)c Fk(if)g Fn(statemen)-31 b(t)358 b(is)e(made)i(up)e(of)h(a)f (header)h(and)0 22577 y(a)369 b(blo)31 b(c)-31 b(k)371 b(of)e(statemen)-31 b(ts:)0 24807 y Fk(HEADER:)1162 26162 y(FIRST)582 b(STATEMENT)1162 27517 y(...)1162 28872 y(LAST)g(STATEMENT) 0 31102 y Fn(The)538 b(header)f(b)31 b(egins)537 b(on)h(a)f(new)h(line) g(and)g(ends)e(with)j(a)e(colon)i(\(:\).)998 b(The)538 b(inden)-31 b(ted)0 32457 y(statemen)g(ts)273 b(that)g(follo)-31 b(w)275 b(are)c(called)i(a)f Fv(blo)35 b(c)-35 b(k)p Fn(.)460 b(The)272 b(\257rst)f(uninden)-31 b(ted)273 b(statemen)-31 b(t)274 b(marks)0 33812 y(the)365 b(end)f(of)i(the)f (blo)31 b(c)-31 b(k.)492 b(A)364 b(statemen)-31 b(t)367 b(blo)31 b(c)-31 b(k)366 b(inside)f(a)g(comp)31 b(ound)365 b(statemen)-31 b(t)367 b(is)e(called)0 35167 y(the)k Fv(b)35 b(o)g(dy)371 b Fn(of)f(the)f(statemen)-31 b(t.)0 37317 y(There)396 b(is)g(no)g(limit)i(on)f(the)f(n)-31 b(um)g(b)31 b(er)396 b(of)h(statemen)-31 b(ts)397 b(that)g(can)g(app)31 b(ear)396 b(in)g(the)g(b)31 b(o)g(dy)396 b(of)0 38671 y(an)430 b(if)h(statemen)-31 b(t,)448 b(but)430 b(there)g(has)g(to)h(b) 31 b(e)430 b(at)h(least)g(one.)676 b(Occasionally)-92 b(,)448 b(it)431 b(is)f(useful)g(to)0 40026 y(ha)-31 b(v)g(e)342 b(a)f(b)31 b(o)g(dy)340 b(with)i(no)f(statemen)-31 b(ts)342 b(\(usually)g(as)f(a)g(place)g(k)-31 b(eep)31 b(er)340 b(for)h(co)31 b(de)341 b(y)-31 b(ou)341 b(ha)-31 b(v)g(en't)0 41381 y(written)323 b(y)-31 b(et\).)478 b(In)321 b(that)i(case,)331 b(y)-31 b(ou)322 b(can)g(use)f(the)h Fk(pass)g Fn(statemen)-31 b(t,)333 b(whic)-31 b(h)323 b(do)31 b(es)321 b(nothing.)0 45870 y Fl(4.5)1793 b(Alternativ)-50 b(e)600 b(execution)0 48353 y Fn(A)391 b(second)f(form)h(of)g(the)g Fk(if)f Fn(statemen)-31 b(t)393 b(is)d(alternativ)-31 b(e)394 b(execution,)j(in)391 b(whic)-31 b(h)392 b(there)e(are)0 49708 y(t)-31 b(w)g(o)473 b(p)31 b(ossibilities)473 b(and)f(the)g (condition)h(determines)f(whic)-31 b(h)472 b(one)g(gets)g(executed.)800 b(The)0 51063 y(syn)-31 b(tax)370 b(lo)31 b(oks)370 b(lik)-31 b(e)371 b(this:)0 53293 y Fk(if)581 b(x\0452)h(==)f(0:)1162 54648 y(print)h(x,)g("is)f(even")0 56003 y(else:)1162 57358 y(print)h(x,)g("is)f(odd")p eop %%Page: 38 64 38 63 bop 0 -2070 a Fv(38)21941 b(Conditionals)425 b(and)g(recursion)p 0 -1627 38191 45 v 0 865 a Fn(If)275 b(the)h(remainder)g(when)g Fk(x)g Fn(is)f(divided)i(b)-31 b(y)275 b(2)h(is)g(0,)295 b(then)276 b(w)-31 b(e)276 b(kno)-31 b(w)277 b(that)g Fk(x)e Fn(is)h(ev)-31 b(en,)295 b(and)276 b(the)0 2220 y(program)395 b(displa)-31 b(ys)395 b(a)g(message)f(to)h(that)h (e\256ect.)567 b(If)394 b(the)h(condition)h(is)e(false,)402 b(the)394 b(second)0 3575 y(set)340 b(of)h(statemen)-31 b(ts)342 b(is)e(executed.)484 b(Since)340 b(the)h(condition)h(m)-31 b(ust)341 b(b)31 b(e)340 b(true)g(or)g(false,)347 b(exactly)0 4930 y(one)368 b(of)h(the)f(alternativ)-31 b(es)370 b(will)g(b)31 b(e)367 b(executed.)493 b(The)368 b(alternativ)-31 b(es)370 b(are)e(called)h Fv(branc)-35 b(hes)p Fn(,)0 6285 y(b)31 b(ecause)369 b(they)g(are)g(branc)-31 b(hes)369 b(in)h(the)f(\260o)-31 b(w)370 b(of)g(execution.)0 8559 y(As)404 b(an)h(aside,)414 b(if)405 b(y)-31 b(ou)405 b(need)f(to)h(c)-31 b(hec)g(k)405 b(the)f(parit)-31 b(y)406 b(\(ev)-31 b(enness)404 b(or)g(o)31 b(ddness\))404 b(of)h(n)-31 b(um)g(b)31 b(ers)0 9914 y(often,)371 b(y)-31 b(ou)370 b(migh)-31 b(t)371 b(\\wrap")f(this)g(co) 31 b(de)369 b(in)g(a)h(function:)0 12269 y Fk(def)582 b(printParity\(x\):)1162 13624 y(if)g(x\0452)f(==)h(0:)2325 14979 y(print)f(x,)h("is)g(even")1162 16334 y(else:)2325 17689 y(print)f(x,)h("is)g(odd")0 20044 y Fn(F)-92 b(or)416 b(an)-31 b(y)418 b(v)-61 b(alue)417 b(of)h Fk(x)p Fn(,)429 b Fk(printParity)419 b Fn(displa)-31 b(ys)418 b(an)f(appropriate)h (message.)637 b(When)416 b(y)-31 b(ou)0 21399 y(call)370 b(it,)h(y)-31 b(ou)370 b(can)f(pro)-31 b(vide)370 b(an)-31 b(y)370 b(in)-31 b(teger)370 b(expression)f(as)g(an)h(argumen)-31 b(t.)0 23754 y Fk(>>>)582 b(printParity\(17\))0 25109 y(>>>)g(printParity\(y+1\))0 30027 y Fl(4.6)1793 b(Chained)598 b(conditionals)0 32679 y Fn(Sometimes)465 b(there)f(are)f(more)h(than)g (t)-31 b(w)g(o)465 b(p)31 b(ossibilities)465 b(and)f(w)-31 b(e)464 b(need)f(more)h(than)g(t)-31 b(w)g(o)0 34034 y(branc)g(hes.)811 b(One)476 b(w)-31 b(a)g(y)477 b(to)f(express)e(a)i (computation)j(lik)-31 b(e)477 b(that)g(is)e(a)h Fv(c)-35 b(hained)546 b(condi-)0 35389 y(tional)p Fn(:)0 37744 y Fk(if)581 b(x)h(<)f(y:)1162 39099 y(print)h(x,)g("is)f(less)h(than",) g(y)0 40454 y(elif)g(x)f(>)g(y:)1162 41808 y(print)h(x,)g("is)f (greater)h(than",)g(y)0 43163 y(else:)1162 44518 y(print)g(x,)g("and",) g(y,)f("are)h(equal")0 46873 y(elif)316 b Fn(is)f(an)h(abbreviation)i (of)e(\\else)g(if.")475 b(Again,)329 b(exactly)317 b(one)e(branc)-31 b(h)316 b(will)h(b)31 b(e)315 b(executed.)0 48228 y(There)369 b(is)g(no)h(limit)i(of)e(the)f(n)-31 b(um)g(b)31 b(er)370 b(of)g Fk(elif)f Fn(statemen)-31 b(ts,)372 b(but)e(the)f(last)h(branc) -31 b(h)370 b(has)f(to)0 49583 y(b)31 b(e)369 b(an)g Fk(else)h Fn(statemen)-31 b(t:)0 51938 y Fk(if)581 b(choice)h(==)g ('A':)1162 53293 y(functionA\(\))0 54648 y(elif)g(choice)g(==)f('B':) 1162 56003 y(functionB\(\))0 57358 y(elif)h(choice)g(==)f('C':)1162 58713 y(functionC\(\))0 60068 y(else:)1162 61423 y(print)h("Invalid)h (choice.")p eop %%Page: 39 65 39 64 bop 0 -2070 a Fv(4.7)425 b(Nested)h(conditionals)23937 b(39)p 0 -1627 38191 45 v 0 865 a Fn(Eac)-31 b(h)497 b(condition)i(is)d(c)-31 b(hec)g(k)g(ed)497 b(in)g(order.)873 b(If)496 b(the)h(\257rst)f(is)g(false,)529 b(the)497 b(next)g(is)f(c)-31 b(hec)g(k)g(ed,)0 2220 y(and)408 b(so)g(on.)609 b(If)408 b(one)g(of)h(them)f(is)g(true,)418 b(the)408 b(corresp)31 b(onding)408 b(branc)-31 b(h)408 b(executes,)418 b(and)409 b(the)0 3575 y(statemen)-31 b(t)483 b(ends.)826 b(Ev)-31 b(en)482 b(if)f(more)g(than)g(one)g (condition)i(is)e(true,)508 b(only)482 b(the)f(\257rst)f(true)0 4930 y(branc)-31 b(h)369 b(executes.)5203 7303 y Fm(As)521 b(an)i(exer)-57 b(cise,)554 b(wr)-57 b(ap)522 b(these)g(examples)f(in)i (functions)g(c)-57 b(al)57 b(le)-57 b(d)5203 8658 y Fk(compare\(x,)582 b(y\))397 b Fm(and)f Fk(dispatch\(choice\))p Fm(.)0 13035 y Fl(4.7)1793 b(Nested)599 b(conditionals)0 15439 y Fn(One)381 b(conditional)j(can)d(also)h(b)31 b(e)381 b(nested)g(within)h(another.) 529 b(W)-92 b(e)381 b(could)g(ha)-31 b(v)g(e)382 b(written)h(the)0 16794 y(tric)-31 b(hotom)g(y)372 b(example)f(as)e(follo)-31 b(ws:)0 18944 y Fk(if)581 b(x)h(==)f(y:)1162 20299 y(print)h(x,)g ("and",)g(y,)f("are)h(equal")0 21654 y(else:)1162 23009 y(if)g(x)f(<)g(y:)2325 24364 y(print)g(x,)h("is)g(less)f(than",)h(y) 1162 25719 y(else:)2325 27074 y(print)f(x,)h("is)g(greater)g(than",)g (y)0 29225 y Fn(The)300 b(outer)g(conditional)i(con)-31 b(tains)301 b(t)-31 b(w)g(o)302 b(branc)-31 b(hes.)469 b(The)300 b(\257rst)f(branc)-31 b(h)299 b(con)-31 b(tains)301 b(a)f(simple)0 30580 y(output)486 b(statemen)-31 b(t.)840 b(The)485 b(second)g(branc)-31 b(h)484 b(con)-31 b(tains)486 b(another)f Fk(if)g Fn(statemen)-31 b(t,)516 b(whic)-31 b(h)0 31935 y(has)400 b(t)-31 b(w)g(o)403 b(branc)-31 b(hes)400 b(of)h(its)g(o)-31 b(wn.)588 b(Those)401 b(t)-31 b(w)g(o)402 b(branc)-31 b(hes)400 b(are)h(b)31 b(oth)401 b(output)h(statemen)-31 b(ts,)0 33290 y(although)371 b(they)f(could)g(ha)-31 b(v)g(e)370 b(b)31 b(een)369 b(conditional)j(statemen)-31 b(ts)371 b(as)e(w)-31 b(ell.)0 35359 y(Although)617 b(the)e(inden)-31 b(tation)617 b(of)f(the)f (statemen)-31 b(ts)616 b(mak)-31 b(es)616 b(the)f(structure)f(apparen) -31 b(t,)0 36714 y(nested)501 b(conditionals)j(b)31 b(ecome)501 b(di\261cult)i(to)f(read)e(v)-31 b(ery)501 b(quic)-31 b(kly)-92 b(.)890 b(In)501 b(general,)535 b(it)502 b(is)f(a)0 38069 y(go)31 b(o)g(d)370 b(idea)g(to)g(a)-31 b(v)g(oid)371 b(them)f(when)f(y)-31 b(ou)370 b(can.)0 40139 y(Logical)304 b(op)31 b(erators)303 b(often)g(pro)-31 b(vide)303 b(a)f(w)-31 b(a)g(y)304 b(to)f(simplify)h(nested)d(conditional)306 b(statemen)-31 b(ts.)0 41494 y(F)-92 b(or)368 b(example,)j(w)-31 b(e)370 b(can)g(rewrite)f(the)h(follo)-31 b(wing)372 b(co)31 b(de)370 b(using)f(a)h(single)g(conditional:)0 43645 y Fk(if)581 b(0)h(<)f(x:)1162 45000 y(if)h(x)f(<)g(10:)2325 46355 y(print)g("x)h(is)f(a)h(positive)g(single)g(digit.")0 48506 y Fn(The)347 b Fk(print)h Fn(statemen)-31 b(t)349 b(is)e(executed)h(only)g(if)g(w)-31 b(e)348 b(mak)-31 b(e)348 b(it)g(past)g(b)31 b(oth)347 b(the)h(conditionals,)0 49860 y(so)369 b(w)-31 b(e)370 b(can)f(use)g(the)g Fk(and)h Fn(op)31 b(erator:)0 52011 y Fk(if)581 b(0)h(<)f(x)g(and)h(x)f(<)h(10:) 1162 53366 y(print)g("x)g(is)f(a)g(positive)i(single)f(digit.")0 55517 y Fn(These)278 b(kinds)g(of)h(conditions)h(are)d(common,)299 b(so)278 b(Python)h(pro)-31 b(vides)279 b(an)f(alternativ)-31 b(e)281 b(syn)-31 b(tax)0 56872 y(that)370 b(is)g(similar)g(to)g (mathematical)j(notation:)p eop %%Page: 40 66 40 65 bop 0 -2070 a Fv(40)21941 b(Conditionals)425 b(and)g(recursion)p 0 -1627 38191 45 v 0 865 a Fk(if)581 b(0)h(<)f(x)g(<)h(10:)1162 2220 y(print)g("x)g(is)f(a)g(positive)i(single)f(digit.")0 4344 y Fn(This)463 b(condition)i(is)e(seman)-31 b(tically)467 b(the)c(same)g(as)g(the)g(comp)31 b(ound)464 b(b)31 b(o)g(olean)464 b(expression)0 5699 y(and)369 b(the)h(nested)f(conditional.)0 10039 y Fl(4.8)1793 b(The)598 b Fe(return)h Fl(statemen)-50 b(t)0 12416 y Fn(The)269 b Fk(return)h Fn(statemen)-31 b(t)272 b(allo)-31 b(ws)271 b(y)-31 b(ou)270 b(to)g(terminate)h(the)f (execution)g(of)g(a)f(function)i(b)31 b(efore)0 13771 y(y)-31 b(ou)370 b(reac)-31 b(h)369 b(the)h(end.)492 b(One)369 b(reason)g(to)h(use)f(it)h(is)f(if)g(y)-31 b(ou)370 b(detect)g(an)g(error)e(condition:)0 15896 y Fk(import)582 b(math)0 18606 y(def)g(printLogarithm\(x\):)1162 19960 y(if)g(x)f(<=)g(0:)2325 21315 y(print)g("Positive)i(numbers)f (only,)g(please.")2325 22670 y(return)1162 25380 y(result)g(=)g (math.log\(x\))1162 26735 y(print)g("The)g(log)g(of)f(x)g(is",)h (result)0 28859 y Fn(The)438 b(function)g Fk(printLogarithm)h Fn(tak)-31 b(es)439 b(a)e(parameter)h(named)g Fk(x)p Fn(.)697 b(The)438 b(\257rst)f(thing)h(it)0 30214 y(do)31 b(es)400 b(is)g(c)-31 b(hec)g(k)400 b(whether)g Fk(x)g Fn(is)g(less)g(than)h(or)e(equal)i(to)g(0,)409 b(in)400 b(whic)-31 b(h)401 b(case)f(it)h(displa)-31 b(ys)401 b(an)0 31569 y(error)344 b(message)i(and)g(then)g(uses)e Fk(return)j Fn(to)f(exit)g(the)g(function.)486 b(The)346 b(\260o)-31 b(w)346 b(of)h(execution)0 32924 y(immediately)438 b(returns)c(to)h(the)g(caller,)452 b(and)435 b(the)g(remaining)i(lines) e(of)g(the)g(function)h(are)0 34279 y(not)370 b(executed.)0 36322 y(Remem)-31 b(b)31 b(er)325 b(that)h(to)f(use)f(a)h(function)h (from)f(the)g(math)h(mo)31 b(dule,)335 b(y)-31 b(ou)325 b(ha)-31 b(v)g(e)326 b(to)f(imp)31 b(ort)326 b(it.)0 40663 y Fl(4.9)1793 b(Recursion)0 43039 y Fn(W)-92 b(e)471 b(men)-31 b(tioned)474 b(that)f(it)g(is)f(legal)h(for)f(one)g(function) i(to)e(call)h(another,)499 b(and)472 b(y)-31 b(ou)473 b(ha)-31 b(v)g(e)0 44394 y(seen)378 b(sev)-31 b(eral)379 b(examples)g(of)g(that.)522 b(W)-92 b(e)377 b(neglected)j(to)f(men)-31 b(tion)380 b(that)g(it)f(is)f(also)i(legal)g(for)0 45749 y(a)365 b(function)g(to)g(call)h(itself.)492 b(It)364 b(ma)-31 b(y)365 b(not)g(b)31 b(e)364 b(ob)-31 b(vious)366 b(wh)-31 b(y)365 b(that)g(is)f(a)h(go)31 b(o)g(d)365 b(thing,)i(but)d(it)0 47104 y(turns)408 b(out)h(to)g(b)31 b(e)408 b(one)g(of)h(the)f(most)i(magical)h(and)d(in)-31 b(teresting)410 b(things)f(a)g(program)g(can)0 48459 y(do.)493 b(F)-92 b(or)368 b(example,)j(lo)31 b(ok)371 b(at)f(the)f(follo)-31 b(wing)373 b(function:)0 50584 y Fk(def)582 b(countdown\(n\):)1162 51938 y(if)g(n)f(==)g(0:)2325 53293 y(print)g("Blastoff!")1162 54648 y(else:)2325 56003 y(print)g(n)2325 57358 y(countdown\(n-1\))p eop %%Page: 41 67 41 66 bop 0 -2070 a Fv(4.9)425 b(Recursion)29332 b(41)p 0 -1627 38191 45 v 0 865 a Fk(countdown)276 b Fn(exp)31 b(ects)275 b(the)h(parameter,)295 b Fk(n)p Fn(,)f(to)276 b(b)31 b(e)275 b(a)g(p)31 b(ositiv)-31 b(e)277 b(in)-31 b(teger.)462 b(If)275 b Fk(n)g Fn(is)g(0,)295 b(it)276 b(outputs)0 2220 y(the)388 b(w)-31 b(ord,)394 b(\\Blasto\256)86 b(!")551 b(Otherwise,)393 b(it)c(outputs)f Fk(n)g Fn(and)g(then)g (calls)h(a)f(function)h(named)0 3575 y Fk(countdown)p Fn(|itself|passing)372 b Fk(n-1)e Fn(as)f(an)g(argumen)-31 b(t.)0 5787 y(What)370 b(happ)31 b(ens)368 b(if)i(w)-31 b(e)370 b(call)g(this)g(function)g(lik)-31 b(e)371 b(this:)0 8080 y Fk(>>>)582 b(countdown\(3\))0 10373 y Fn(The)426 b(execution)g(of)g Fk(countdown)h Fn(b)31 b(egins)425 b(with)i Fk(n=3)p Fn(,)440 b(and)426 b(since)f Fk(n)g Fn(is)h(not)g(0,)440 b(it)426 b(outputs)0 11728 y(the)369 b(v)-61 b(alue)370 b(3,)g(and)f(then)h(calls)g(itself...)2767 14464 y(The)407 b(execution)g(of)g Fk(countdown)g Fn(b)31 b(egins)406 b(with)i Fk(n=2)p Fn(,)416 b(and)406 b(since)g Fk(n)g Fn(is)g(not)h(0,)2767 15819 y(it)370 b(outputs)g(the)g(v)-61 b(alue)369 b(2,)h(and)g(then)f(calls)h(itself...)5203 17741 y(The)357 b(execution)h(of)g Fk(countdown)g Fn(b)31 b(egins)357 b(with)h Fk(n=1)p Fn(,)i(and)d(since)g Fk(n)5203 19096 y Fn(is)369 b(not)h(0,)g(it)g(outputs)g(the)f(v)-61 b(alue)370 b(1,)g(and)f(then)h(calls)g(itself...)7273 21048 y(The)283 b(execution)i(of)e Fk(countdown)h Fn(b)31 b(egins)284 b(with)g Fk(n=0)p Fn(,)301 b(and)7273 22403 y(since)371 b Fk(n)h Fn(is)f(0,)i(it)f(outputs)g(the)g(w)-31 b(ord,)373 b(\\Blasto\256)86 b(!")502 b(and)7273 23758 y(then)369 b(returns.)5203 25710 y(The)g Fk(countdown)h Fn(that)h(got)f Fk(n=1)g Fn(returns.)2767 27632 y(The)g Fk(countdown)g Fn(that)h(got)f Fk(n=2)f Fn(returns.)0 30368 y(The)g Fk(countdown)i Fn(that)f(got)h Fk(n=3)e Fn(returns.)0 32580 y(And)h(then)h(y)-31 b(ou're)371 b(bac)-31 b(k)371 b(in)p 12224 32580 349 45 v 12642 32580 V 1207 w Fk(main)p 15385 32580 V 15804 32580 V 1208 w Fn(\(what)h(a)e(trip\).)497 b(So,)371 b(the)g(total)h(output)g(lo)31 b(oks)371 b(lik)-31 b(e)0 33935 y(this:)0 36228 y Fk(3)0 37583 y(2)0 38938 y(1)0 40293 y(Blastoff!)0 42586 y Fn(As)369 b(a)g(second)g(example,)i(lo)31 b(ok)371 b(again)g(at)f(the)f (functions)h Fk(newLine)g Fn(and)g Fk(threeLines)p Fn(:)0 44879 y Fk(def)582 b(newline\(\):)1162 46234 y(print)0 48944 y(def)g(threeLines\(\):)1162 50299 y(newLine\(\))1162 51654 y(newLine\(\))1162 53009 y(newLine\(\))0 55302 y Fn(Although)435 b(these)e(w)-31 b(ork,)451 b(they)434 b(w)-31 b(ould)434 b(not)g(b)31 b(e)433 b(m)-31 b(uc)g(h)434 b(help)g(if)f(w)-31 b(e)434 b(w)-31 b(an)g(ted)435 b(to)f(output)h(2)0 56657 y(newlines,)370 b(or)g(106.)493 b(A)370 b(b)31 b(etter)369 b(alternativ)-31 b(e)372 b(w)-31 b(ould)370 b(b)31 b(e)369 b(this:)p eop %%Page: 42 68 42 67 bop 0 -2070 a Fv(42)21941 b(Conditionals)425 b(and)g(recursion)p 0 -1627 38191 45 v 0 865 a Fk(def)582 b(nLines\(n\):)1162 2220 y(if)g(n)f(>)g(0:)2325 3575 y(print)2325 4930 y(nLines\(n-1\))0 7086 y Fn(This)346 b(program)h(is)f(similar)i(to)e Fk(countdown)p Fn(;)356 b(as)346 b(long)h(as)f Fk(n)g Fn(is)g(greater)g(than)h(0,)k (it)c(outputs)0 8441 y(one)405 b(newline)h(and)f(then)g(calls)h(itself) g(to)f(output)h Fk(n-1)f Fn(additional)j(newlines.)600 b(Th)-31 b(us,)415 b(the)0 9796 y(total)437 b(n)-31 b(um)g(b)31 b(er)436 b(of)f(newlines)h(is)f Fk(1)582 b(+)f(\(n)h(-)f(1\))435 b Fn(whic)-31 b(h,)453 b(if)436 b(y)-31 b(ou)436 b(do)f(y)-31 b(our)436 b(algebra)g(righ)-31 b(t,)0 11151 y(comes)370 b(out)f(to)h Fk(n)p Fn(.)0 13225 y(The)313 b(pro)31 b(cess)311 b(of)i(a)g(function)h(calling)g(itself)g(is)e Fv(recursion)p Fn(,)326 b(and)313 b(suc)-31 b(h)312 b(functions)h(are)g(said)0 14580 y(to)370 b(b)31 b(e)369 b(recursiv)-31 b(e.)0 18965 y Fl(4.10)1792 b(Stac)-50 b(k)599 b(diagrams)g(for)e(recursiv)-50 b(e)601 b(functions)0 21373 y Fn(In)444 b(Section)h(3.11,)465 b(w)-31 b(e)444 b(used)g(a)g(stac)-31 b(k)445 b(diagram)h(to)f (represen)-31 b(t)443 b(the)h(state)h(of)g(a)f(program)0 22728 y(during)342 b(a)g(function)h(call.)485 b(The)342 b(same)g(kind)g(of)h(diagram)g(can)f(help)g(in)-31 b(terpret)342 b(a)g(recursiv)-31 b(e)0 24083 y(function.)0 26158 y(Ev)g(ery)380 b(time)h(a)f(function)h(gets)g(called,)j(Python)d(creates)e(a)h(new)g (function)i(frame,)h(whic)-31 b(h)0 27513 y(con)g(tains)321 b(the)f(function's)h(lo)31 b(cal)321 b(v)-61 b(ariables)320 b(and)f(parameters.)477 b(F)-92 b(or)318 b(a)i(recursiv)-31 b(e)319 b(function,)0 28868 y(there)369 b(migh)-31 b(t)371 b(b)31 b(e)369 b(more)g(than)h(one)g(frame)f(on)h(the)f(stac)-31 b(k)370 b(at)g(the)g(same)f(time.)0 30943 y(This)h(\257gure)f(sho)-31 b(ws)369 b(a)g(stac)-31 b(k)370 b(diagram)h(for)f Fk(countdown)g Fn(called)g(with)h Fk(n)581 b(=)g(3)p Fn(:)11817 32322 y 8617410 9933045 0 0 8617410 9933045 startTexFig 11817 32322 a %%BeginDocument: illustrations/stack2.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: stack2.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 14:16:17 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 131 151 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 151 moveto 0 0 lineto 131 0 lineto 131 151 lineto closepath clip newpath -50.0 177.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 1800 450 m 3000 450 l 3000 825 l 1800 825 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1800 975 m 3000 975 l 3000 1350 l 1800 1350 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1800 1500 m 3000 1500 l 3000 1875 l 1800 1875 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1800 2025 m 3000 2025 l 3000 2400 l 1800 2400 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1800 2550 m 3000 2550 l 3000 2925 l 1800 2925 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 2565 1177 m 2565 1117 l 2413 1117 l 2533 1147 l 2413 1177 l cp eoclip n 2175 1147 m 2550 1147 l gs col0 s gr gr % arrowhead n 2413 1177 m 2533 1147 l 2413 1117 l col0 s % Polyline gs clippath 2565 1702 m 2565 1642 l 2413 1642 l 2533 1672 l 2413 1702 l cp eoclip n 2175 1672 m 2550 1672 l gs col0 s gr gr % arrowhead n 2413 1702 m 2533 1672 l 2413 1642 l col0 s % Polyline gs clippath 2565 2227 m 2565 2167 l 2413 2167 l 2533 2197 l 2413 2227 l cp eoclip n 2175 2197 m 2550 2197 l gs col0 s gr gr % arrowhead n 2413 2227 m 2533 2197 l 2413 2167 l col0 s % Polyline gs clippath 2565 2752 m 2565 2692 l 2413 2692 l 2533 2722 l 2413 2752 l cp eoclip n 2175 2722 m 2550 2722 l gs col0 s gr gr % arrowhead n 2413 2752 m 2533 2722 l 2413 2692 l col0 s /Helvetica ff 165.00 scf sf 1650 675 m gs 1 -1 sc (__main__) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 1650 1200 m gs 1 -1 sc (countdown) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 1650 1725 m gs 1 -1 sc (countdown) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 1650 2250 m gs 1 -1 sc (countdown) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 1650 2775 m gs 1 -1 sc (countdown) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2100 1200 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2625 1200 m gs 1 -1 sc (3) col0 sh gr /Helvetica ff 165.00 scf sf 2100 1725 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2625 1725 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 2100 2250 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2625 2250 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 2100 2775 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2625 2775 m gs 1 -1 sc (0) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 51013 a Fn(As)356 b(usual,)j(the)e(top)g(of)f(the)h(stac)-31 b(k)357 b(is)f(the)g(frame)h(for)p 22468 51013 349 45 v 22886 51013 V 1193 w Fk(main)p 25629 51013 V 26047 51013 V 837 w Fn(.)488 b(It)356 b(is)g(empt)-31 b(y)358 b(b)31 b(ecause)355 b(w)-31 b(e)0 52368 y(did)369 b(not)h(create)g(an) -31 b(y)370 b(v)-61 b(ariables)370 b(in)p 15180 52368 V 15598 52368 V 1206 w Fk(main)p 18341 52368 V 18760 52368 V 1206 w Fn(or)f(pass)g(an)-31 b(y)370 b(parameters)g(to)g(it.)0 54443 y(The)528 b(four)g Fk(countdown)g Fn(frames)g(ha)-31 b(v)g(e)529 b(di\256eren)-31 b(t)528 b(v)-61 b(alues)528 b(for)f(the)h(parameter)h Fk(n)p Fn(.)968 b(The)0 55797 y(b)31 b(ottom)438 b(of)f(the)g(stac)-31 b(k,)454 b(where)436 b Fk(n=0)p Fn(,)454 b(is)436 b(called)i(the)e Fv(base)503 b(case)p Fn(.)694 b(It)436 b(do)31 b(es)436 b(not)h(mak)-31 b(e)438 b(a)0 57152 y(recursiv)-31 b(e)369 b(call,)i(so)e(there)g(are)g (no)g(more)h(frames.)2767 59540 y Fm(As)396 b(an)g(exer)-57 b(cise,)397 b(dr)-57 b(aw)395 b(a)h(stack)g(diagr)-57 b(am)396 b(for)g Fk(nLines)h Fm(c)-57 b(al)57 b(le)-57 b(d)396 b(with)g Fk(n=4)p Fm(.)p eop %%Page: 43 69 43 68 bop 0 -2070 a Fv(4.11)425 b(In\257nite)g(recursion)24666 b(43)p 0 -1627 38191 45 v 0 865 a Fl(4.11)1792 b(In\257nite)599 b(recursion)0 3327 y Fn(If)288 b(a)h(recursion)f(nev)-31 b(er)288 b(reac)-31 b(hes)289 b(a)f(base)h(case,)305 b(it)289 b(go)31 b(es)289 b(on)g(making)h(recursiv)-31 b(e)288 b(calls)h(forev)-31 b(er,)0 4682 y(and)401 b(the)h(program)g (nev)-31 b(er)401 b(terminates.)589 b(This)402 b(is)f(kno)-31 b(wn)402 b(as)f Fv(in\257nite)462 b(recursion)p Fn(,)411 b(and)0 6037 y(it)395 b(is)f(generally)h(not)g(considered)f(a)g(go)31 b(o)g(d)395 b(idea.)567 b(Here)394 b(is)g(a)g(minimal)j(program)d(with) i(an)0 7392 y(in\257nite)370 b(recursion:)0 9601 y Fk(def)582 b(recurse\(\):)1162 10956 y(recurse\(\))0 13165 y Fn(In)547 b(most)g(programming)j(en)-31 b(vironmen)g(ts,)593 b(a)548 b(program)f(with)i(in\257nite)f(recursion)e(do)31 b(es)0 14520 y(not)465 b(really)f(run)f(forev)-31 b(er.)777 b(Python)465 b(rep)31 b(orts)463 b(an)h(error)f(message)h(when)g(the)g (maxim)-31 b(um)0 15875 y(recursion)369 b(depth)g(is)g(reac)-31 b(hed:)1162 18085 y Fk(File)582 b("",)h(line)e(2,)h(in)f (recurse)1162 19439 y(\(98)h(repetitions)h(omitted\))1162 20794 y(File)f("",)h(line)e(2,)h(in)f(recurse)0 22149 y(RuntimeError:)i(Maximum)f(recursion)h(depth)f(exceeded)0 24359 y Fn(This)433 b(tracebac)-31 b(k)433 b(is)g(a)g(little)h(bigger)f (than)h(the)e(one)h(w)-31 b(e)433 b(sa)-31 b(w)433 b(in)g(the)f (previous)h(c)-31 b(hapter.)0 25714 y(When)369 b(the)g(error)f(o)31 b(ccurs,)369 b(there)g(are)g(100)h Fk(recurse)g Fn(frames)g(on)f(the)h (stac)-31 b(k!)2767 28254 y Fm(As)349 b(an)h(exer)-57 b(cise,)360 b(write)349 b(a)h(function)h(with)e(in\257nite)i(r)-57 b(e)g(cursion)351 b(and)e(run)h(it)g(in)2767 29609 y(the)396 b(Python)g(interpr)-57 b(eter.)0 34068 y Fl(4.12)1792 b(Keyb)50 b(oard)599 b(input)0 36530 y Fn(The)301 b(programs)h(w)-31 b(e)302 b(ha)-31 b(v)g(e)302 b(written)g(so)f(far)g(are)g(a)h(bit)g (rude)e(in)i(the)f(sense)f(that)j(they)e(accept)0 37885 y(no)369 b(input)h(from)g(the)g(user.)491 b(They)370 b(just)f(do)h(the)f(same)h(thing)g(ev)-31 b(ery)369 b(time.)0 40013 y(Python)363 b(pro)-31 b(vides)363 b(built-in)g(functions)h(that) f(get)g(input)f(from)h(the)f(k)-31 b(eyb)31 b(oard.)491 b(The)363 b(sim-)0 41368 y(plest)382 b(is)g(called)h Fk(raw)p 8751 41368 349 45 v 418 w(input)p Fn(.)531 b(When)381 b(this)h(function)h(is)f(called,)387 b(the)381 b(program)i(stops)f(and) 0 42723 y(w)-31 b(aits)501 b(for)e(the)h(user)e(to)i(t)-31 b(yp)31 b(e)500 b(something.)885 b(When)499 b(the)h(user)e(presses)f (Return)i(or)h(the)0 44078 y(En)-31 b(ter)357 b(k)-31 b(ey)-92 b(,)359 b(the)d(program)h(resumes)f(and)g Fk(raw)p 19704 44078 V 419 w(input)g Fn(returns)g(what)h(the)f(user)f(t)-31 b(yp)31 b(ed)357 b(as)0 45433 y(a)369 b Fk(string)p Fn(:)0 47642 y Fk(>>>)582 b(input)f(=)h(raw_input)g(\(\))0 48997 y(What)g(are)f(you)h(waiting)g(for?)0 50352 y(>>>)g(print)f(input)0 51707 y(What)h(are)f(you)h(waiting)g(for?)0 53916 y Fn(Before)422 b(calling)j Fk(raw)p 8887 53916 V 419 w(input)p Fn(,)436 b(it)423 b(is)f(a)h(go)31 b(o)g(d)423 b(idea)g(to)g(prin)-31 b(t)423 b(a)f(message)h(telling)h(the)f(user)0 55271 y(what)397 b(to)f(input.)572 b(This)396 b(message)f(is)h(called)g(a)g Fv(prompt)p Fn(.)572 b(W)-92 b(e)395 b(can)h(supply)f(a)h(prompt)g(as)0 56626 y(an)369 b(argumen)-31 b(t)371 b(to)f Fk(raw)p 9657 56626 V 419 w(input)p Fn(:)p eop %%Page: 44 70 44 69 bop 0 -2070 a Fv(44)21941 b(Conditionals)425 b(and)g(recursion)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(name)f(=)h(raw_input)g (\("What...is)h(your)f(name?)g("\))0 2220 y(What...is)g(your)g(name?)g (Arthur,)g(King)g(of)g(the)f(Britons!)0 3575 y(>>>)h(print)f(name)0 4930 y(Arthur,)h(King)g(of)f(the)h(Britons!)0 7214 y Fn(If)369 b(w)-31 b(e)370 b(exp)31 b(ect)369 b(the)g(resp)31 b(onse)368 b(to)i(b)31 b(e)369 b(an)h(in)-31 b(teger,)370 b(w)-31 b(e)370 b(can)f(use)g(the)g Fk(input)h Fn(function:)0 9497 y Fk(prompt)582 b(=)f("What...is)i(the)f(airspeed)g(velocity)g(of) g(an)f(unladen)h(swallow?\\n")0 10852 y(speed)g(=)f(input\(prompt\))0 13136 y Fn(If)454 b(the)h(user)e(t)-31 b(yp)31 b(es)454 b(a)h(string)f(of)h(digits,)478 b(it)455 b(is)f(con)-31 b(v)g(erted)455 b(to)g(an)g(in)-31 b(teger)455 b(and)f(assigned)0 14491 y(to)429 b Fk(speed)p Fn(.)669 b(Unfortunately)-92 b(,)445 b(if)429 b(the)f(user)f(t)-31 b(yp)31 b(es)428 b(a)g(c)-31 b(haracter)428 b(that)h(is)f(not)h(a)f(digit,)445 b(the)0 15846 y(program)370 b(crashes:)0 18129 y Fk(>>>)582 b(speed)f(=)h(input)g(\(prompt\))0 19484 y(What...is)g(the)g(airspeed)g (velocity)h(of)e(an)h(unladen)g(swallow?)0 20839 y(What)g(do)f(you)h (mean,)g(an)f(African)h(or)g(a)f(European)h(swallow?)0 22194 y(SyntaxError:)h(invalid)f(syntax)0 24478 y Fn(T)-92 b(o)387 b(a)-31 b(v)g(oid)389 b(this)e(kind)g(of)g(error,)j(it)d(is)g (generally)h(a)f(go)31 b(o)g(d)387 b(idea)h(to)f(use)f Fk(raw)p 31703 24478 349 45 v 419 w(input)h Fn(to)g(get)0 25833 y(a)369 b(string)h(and)g(then)f(use)g(con)-31 b(v)g(ersion)370 b(functions)g(to)g(con)-31 b(v)g(ert)370 b(to)g(other)g(t)-31 b(yp)31 b(es.)0 30456 y Fl(4.13)1792 b(Glossary)0 32658 y Fv(mo)35 b(dulus)425 b(op)35 b(erator:)556 b Fn(An)330 b(op)31 b(erator,)338 b(denoted)331 b(with)g(a)f(p)31 b(ercen)-31 b(t)329 b(sign)h(\()p Fk(\045)p Fn(\),)340 b(that)330 b(w)-31 b(orks)2767 34013 y(on)398 b(in)-31 b(tegers)398 b(and)g(yields)g(the)f(remainder)h(when)f(one)h(n)-31 b(um)g(b)31 b(er)397 b(is)h(divided)g(b)-31 b(y)398 b(an-)2767 35368 y(other.)0 37678 y Fv(b)35 b(o)g(olean)426 b(expression:)555 b Fn(An)369 b(expression)g(that)i(is)e(either)g(true)g(or)g(false.)0 39988 y Fv(comparison)425 b(op)35 b(erator:)556 b Fn(One)460 b(of)i(the)f(op)31 b(erators)461 b(that)h(compares)f(t)-31 b(w)g(o)463 b(v)-61 b(alues:)676 b Fk(==)p Fn(,)2767 41343 y Fk(!=)p Fn(,)370 b Fk(>)p Fn(,)g Fk(<)p Fn(,)f Fk(>=)p Fn(,)h(and)g Fk(<=)p Fn(.)0 43653 y Fv(logical)424 b(op)35 b(erator:)555 b Fn(One)537 b(of)g(the)g(op)31 b(erators)537 b(that)h(com)-31 b(bines)537 b(b)31 b(o)g(olean)538 b(expressions:)2767 45008 y Fk(and)p Fn(,)370 b Fk(or)p Fn(,)g(and)g Fk(not)p Fn(.)0 47318 y Fv(conditional)424 b(statemen)-35 b(t:)554 b Fn(A)422 b(statemen)-31 b(t)423 b(that)g(con)-31 b(trols)423 b(the)f(\260o)-31 b(w)422 b(of)g(execution)h(de-)2767 48673 y(p)31 b(ending)370 b(on)f(some)h(condition.)0 50983 y Fv(condition:)554 b Fn(The)329 b(b)31 b(o)g(olean)331 b(expression)e(in)g(a)h (conditional)i(statemen)-31 b(t)331 b(that)g(determines)2767 52338 y(whic)-31 b(h)371 b(branc)-31 b(h)369 b(is)g(executed.)0 54648 y Fv(comp)35 b(ound)426 b(statemen)-35 b(t:)554 b Fn(A)514 b(statemen)-31 b(t)515 b(that)g(consists)f(of)g(a)g(header)g (and)g(a)g(b)31 b(o)g(dy)-92 b(.)2767 56003 y(The)451 b(header)e(ends)h(with)h(a)f(colon)h(\(:\).)736 b(The)451 b(b)31 b(o)g(dy)450 b(is)f(inden)-31 b(ted)451 b(relativ)-31 b(e)452 b(to)f(the)2767 57358 y(header.)p eop %%Page: 45 71 45 70 bop 0 -2070 a Fv(4.13)425 b(Glossary)29420 b(45)p 0 -1627 38191 45 v 0 865 a(blo)35 b(c)-35 b(k:)553 b Fn(A)369 b(group)h(of)f(consecutiv)-31 b(e)371 b(statemen)-31 b(ts)371 b(with)f(the)g(same)f(inden)-31 b(tation.)0 3106 y Fv(b)35 b(o)g(dy:)555 b Fn(The)369 b(blo)31 b(c)-31 b(k)370 b(in)g(a)f(comp)31 b(ound)370 b(statemen)-31 b(t)371 b(that)g(follo)-31 b(ws)371 b(the)f(header.)0 5346 y Fv(nesting:)554 b Fn(One)451 b(program)h(structure)e(within)j (another,)472 b(suc)-31 b(h)451 b(as)g(a)g(conditional)j(state-)2767 6701 y(men)-31 b(t)371 b(inside)e(a)h(branc)-31 b(h)369 b(of)g(another)h(conditional)j(statemen)-31 b(t.)0 8942 y Fv(recursion:)555 b Fn(The)369 b(pro)31 b(cess)368 b(of)i(calling)h(the)e(function)i(that)f(is)g(curren)-31 b(tly)369 b(executing.)0 11182 y Fv(base)425 b(case:)553 b Fn(A)378 b(branc)-31 b(h)377 b(of)i(the)e(conditional)k(statemen)-31 b(t)380 b(in)e(a)g(recursiv)-31 b(e)377 b(function)i(that)2767 12537 y(do)31 b(es)369 b(not)h(result)f(in)h(a)f(recursiv)-31 b(e)369 b(call.)0 14777 y Fv(in\257nite)425 b(recursion:)554 b Fn(A)353 b(function)g(that)h(calls)f(itself)h(recursiv)-31 b(ely)352 b(without)j(ev)-31 b(er)352 b(reac)-31 b(h-)2767 16132 y(ing)321 b(the)g(base)f(case.)477 b(Ev)-31 b(en)g(tually)-92 b(,)333 b(an)320 b(in\257nite)i(recursion)e(causes)g(a)g(run)-31 b(time)321 b(error.)0 18373 y Fv(prompt:)554 b Fn(A)369 b(visual)i(cue)e(that)h(tells)g(the)g(user)e(to)i(input)g(data.)p eop %%Page: 46 72 46 71 bop 0 -2070 a Fv(46)21941 b(Conditionals)425 b(and)g(recursion)p 0 -1627 38191 45 v eop %%Page: 47 73 47 72 bop 0 9911 a Fi(Chapter)861 b(5)0 16200 y Fo(F)-258 b(ruitful)1032 b(functions)0 23349 y Fl(5.1)1793 b(Return)599 b(v)-100 b(alues)0 25725 y Fn(Some)402 b(of)f(the)h(built-in)g (functions)h(w)-31 b(e)401 b(ha)-31 b(v)g(e)402 b(used,)409 b(suc)-31 b(h)401 b(as)g(the)g(math)h(functions,)411 b(ha)-31 b(v)g(e)0 27080 y(pro)31 b(duced)359 b(results.)489 b(Calling)363 b(the)d(function)h(generates)f(a)g(new)g(v)-61 b(alue,)363 b(whic)-31 b(h)361 b(w)-31 b(e)360 b(usually)0 28435 y(assign)370 b(to)g(a)f(v)-61 b(ariable)370 b(or)f(use)g(as)g (part)g(of)h(an)g(expression.)0 30559 y Fk(e)581 b(=)h(math.exp\(1.0\)) 0 31914 y(height)g(=)f(radius)h(*)g(math.sin\(angle\))0 34038 y Fn(But)370 b(so)f(far,)g(none)h(of)g(the)f(functions)h(w)-31 b(e)370 b(ha)-31 b(v)g(e)370 b(written)g(has)g(returned)e(a)i(v)-61 b(alue.)0 36082 y(In)455 b(this)h(c)-31 b(hapter,)478 b(w)-31 b(e)456 b(are)f(going)j(to)e(write)g(functions)h(that)f(return) f(v)-61 b(alues,)478 b(whic)-31 b(h)456 b(w)-31 b(e)0 37436 y(will)442 b(call)f Fv(fruitful)505 b(functions)p Fn(,)459 b(for)439 b(w)-31 b(an)g(t)442 b(of)e(a)g(b)31 b(etter)440 b(name.)705 b(The)440 b(\257rst)g(example)h(is)0 38791 y Fk(area)p Fn(,)370 b(whic)-31 b(h)370 b(returns)e(the)i(area)f (of)h(a)f(circle)h(with)g(the)g(giv)-31 b(en)370 b(radius:)0 40916 y Fk(import)582 b(math)0 43625 y(def)g(area\(radius\):)1162 44980 y(temp)g(=)f(math.pi)i(*)e(radius**2)1162 46335 y(return)h(temp)0 48459 y Fn(W)-92 b(e)295 b(ha)-31 b(v)g(e)298 b(seen)d(the)h Fk(return)h Fn(statemen)-31 b(t)299 b(b)31 b(efore,)311 b(but)296 b(in)g(a)h(fruitful)g(function)h(the)e Fk(return)0 49814 y Fn(statemen)-31 b(t)412 b(includes)f(a)g Fv(return)473 b(v)-71 b(alue)p Fn(.)616 b(This)411 b(statemen)-31 b(t)412 b(means:)576 b(\\Return)410 b(immedi-)0 51169 y(ately)285 b(from)f(this)g(function)g(and)g(use)f(the)h(follo)-31 b(wing)287 b(expression)c(as)g(a)h(return)f(v)-61 b(alue.")465 b(The)0 52524 y(expression)260 b(pro)-31 b(vided)260 b(can)g(b)31 b(e)260 b(arbitrarily)h(complicated,)285 b(so)260 b(w)-31 b(e)260 b(could)h(ha)-31 b(v)g(e)260 b(written)i(this)0 53879 y(function)371 b(more)e(concisely:)0 56003 y Fk(def)582 b(area\(radius\):)1162 57358 y(return)g(math.pi)h(*) e(radius**2)p eop %%Page: 48 74 48 73 bop 0 -2070 a Fv(48)27205 b(F)-106 b(ruitful)424 b(functions)p 0 -1627 38191 45 v 0 865 a Fn(On)525 b(the)h(other)g (hand,)565 b Fv(temp)35 b(orary)605 b(v)-71 b(ariables)526 b Fn(lik)-31 b(e)526 b Fk(temp)g Fn(often)h(mak)-31 b(e)526 b(debugging)0 2220 y(easier.)0 4425 y(Sometimes)423 b(it)f(is)f(useful) g(to)h(ha)-31 b(v)g(e)422 b(m)-31 b(ultiple)424 b(return)c(statemen)-31 b(ts,)436 b(one)422 b(in)f(eac)-31 b(h)422 b(branc)-31 b(h)0 5780 y(of)370 b(a)f(conditional:)0 8067 y Fk(def)582 b(absoluteValue\(x\):)1162 9422 y(if)g(x)f(<)g(0:)2325 10777 y(return)h(-x)1162 12132 y(else:)2325 13487 y(return)g(x)0 15773 y Fn(Since)293 b(these)g Fk(return)h Fn(statemen)-31 b(ts)295 b(are)e(in)g(an)g(alternativ)-31 b(e)296 b(conditional,)312 b(only)294 b(one)g(will)g(b)31 b(e)0 17128 y(executed.)466 b(As)286 b(so)31 b(on)287 b(as)g(one)g(is)g(executed,)305 b(the)287 b(function)h(terminates)g(without)i(executing)0 18483 y(an)-31 b(y)370 b(subsequen)-31 b(t)369 b(statemen)-31 b(ts.)0 20688 y(Co)31 b(de)499 b(that)h(app)31 b(ears)498 b(after)i(a)f Fk(return)g Fn(statemen)-31 b(t,)534 b(or)498 b(an)-31 b(y)499 b(other)g(place)h(the)f(\260o)-31 b(w)499 b(of)0 22043 y(execution)371 b(can)e(nev)-31 b(er)369 b(reac)-31 b(h,)370 b(is)f(called)h Fv(dead)425 b(co)35 b(de)p Fn(.)0 24249 y(In)275 b(a)g(fruitful)i(function,)296 b(it)276 b(is)f(a)h(go)31 b(o)g(d)276 b(idea)g(to)g(ensure)e(that)i(ev) -31 b(ery)276 b(p)31 b(ossible)275 b(path)h(through)0 25604 y(the)369 b(program)h(hits)g(a)f Fk(return)h Fn(statemen)-31 b(t.)495 b(F)-92 b(or)368 b(example:)0 27890 y Fk(def)582 b(absoluteValue\(x\):)1162 29245 y(if)g(x)f(<)g(0:)2325 30600 y(return)h(-x)1162 31955 y(elif)g(x)f(>)h(0:)2325 33310 y(return)g(x)0 35596 y Fn(This)412 b(program)g(is)g(not)g (correct)f(b)31 b(ecause)411 b(if)h Fk(x)g Fn(happ)31 b(ens)411 b(to)h(b)31 b(e)411 b(0,)423 b(neither)411 b(condition)j(is)0 36951 y(true,)431 b(and)418 b(the)h(function)g(ends) f(without)i(hitting)g(a)f Fk(return)g Fn(statemen)-31 b(t.)641 b(In)418 b(this)h(case,)0 38306 y(the)369 b(return)g(v)-61 b(alue)370 b(is)f(a)g(sp)31 b(ecial)370 b(v)-61 b(alue)370 b(called)g Fk(None)p Fn(:)0 40592 y Fk(>>>)582 b(print)f (absoluteValue\(0\))0 41947 y(None)5203 44752 y Fm(As)365 b(an)h(exer)-57 b(cise,)373 b(write)366 b(a)g Fk(compare)h Fm(function)g(that)e(r)-57 b(eturns)366 b Fk(1)g Fm(if)5203 46107 y Fk(x)581 b(>)g(y)p Fm(,)397 b Fk(0)f Fm(if)h Fk(x)581 b(==)h(y)p Fm(,)397 b(and)e Fk(-1)i Fm(if)g Fk(x)581 b(<)g(y)p Fm(.)0 50738 y Fl(5.2)1793 b(Program)598 b(dev)-50 b(elopmen)g(t)0 53293 y Fn(A)-31 b(t)425 b(this)f(p)31 b(oin)-31 b(t,)440 b(y)-31 b(ou)424 b(should)h(b)31 b(e)423 b(able)i(to)g(lo)31 b(ok)425 b(at)g(complete)g(functions)g(and)f(tell)i (what)0 54648 y(they)298 b(do.)469 b(Also,)313 b(if)298 b(y)-31 b(ou)298 b(ha)-31 b(v)g(e)298 b(b)31 b(een)297 b(doing)i(the)e(exercises,)312 b(y)-31 b(ou)298 b(ha)-31 b(v)g(e)298 b(written)h(some)f(small)0 56003 y(functions.)469 b(As)293 b(y)-31 b(ou)295 b(write)f(larger)g(functions,)311 b(y)-31 b(ou)294 b(migh)-31 b(t)296 b(start)e(to)h(ha)-31 b(v)g(e)294 b(more)h(di\261cult)-31 b(y)-92 b(,)0 57358 y(esp)31 b(ecially)370 b(with)h(run)-31 b(time)370 b(and)g(seman)-31 b(tic)370 b(errors.)p eop %%Page: 49 75 49 74 bop 0 -2070 a Fv(5.2)425 b(Program)h(dev)-35 b(elopmen)g(t)22552 b(49)p 0 -1627 38191 45 v 0 865 a Fn(T)-92 b(o)278 b(deal)g(with)h (increasingly)g(complex)g(programs,)296 b(w)-31 b(e)278 b(are)g(going)h(to)f(suggest)g(a)g(tec)-31 b(hnique)0 2220 y(called)358 b Fv(incremen)-35 b(tal)411 b(dev)-35 b(elopmen)g(t)p Fn(.)489 b(The)357 b(goal)i(of)f(incremen)-31 b(tal)359 b(dev)-31 b(elopmen)g(t)359 b(is)e(to)0 3575 y(a)-31 b(v)g(oid)486 b(long)f(debugging)h(sessions)d(b)-31 b(y)484 b(adding)h(and)g(testing)g(only)g(a)f(small)h(amoun)-31 b(t)486 b(of)0 4930 y(co)31 b(de)369 b(at)h(a)g(time.)0 7279 y(As)532 b(an)h(example,)575 b(supp)31 b(ose)531 b(y)-31 b(ou)533 b(w)-31 b(an)g(t)534 b(to)f(\257nd)g(the)f(distance)h (b)31 b(et)-31 b(w)g(een)533 b(t)-31 b(w)g(o)535 b(p)31 b(oin)-31 b(ts,)0 8634 y(giv)g(en)471 b(b)-31 b(y)471 b(the)g(co)31 b(ordinates)471 b(\()p Fg(x)13684 8800 y Ff(1)14181 8634 y Fg(;)184 b(y)15215 8800 y Ff(1)15712 8634 y Fn(\))470 b(and)h(\()p Fg(x)19929 8800 y Ff(2)20426 8634 y Fg(;)184 b(y)21460 8800 y Ff(2)21957 8634 y Fn(\).)796 b(By)471 b(the)f(Pythagorean)j(theorem,)0 9989 y(the)369 b(distance)h(is:)10188 13949 y Fg(distance)309 b Fn(=)15784 12948 y Fd(p)p 16891 12948 11112 45 v 1001 x Fn(\()p Fg(x)17954 14115 y Ff(2)18697 13949 y Fj(\241)246 b Fg(x)20437 14115 y Ff(1)20933 13949 y Fn(\))21363 13629 y Ff(2)22106 13949 y Fn(+)g(\()p Fg(y)24186 14115 y Ff(2)24929 13949 y Fj(\241)g Fg(y)26579 14115 y Ff(1)27075 13949 y Fn(\))27505 13629 y Ff(2)35915 13949 y Fn(\(5.1\))0 16224 y(The)253 b(\257rst)g(step)g(is)f(to)i(consider)f(what)h(a)g Fk(distance)g Fn(function)g(should)f(lo)31 b(ok)255 b(lik)-31 b(e)254 b(in)f(Python.)0 17579 y(In)283 b(other)i(w)-31 b(ords,)301 b(what)285 b(are)f(the)g(inputs)g(\(parameters\))i(and)e(what)h(is)f (the)g(output)h(\(return)0 18934 y(v)-61 b(alue\)?)0 21282 y(In)423 b(this)g(case,)437 b(the)423 b(t)-31 b(w)g(o)425 b(p)31 b(oin)-31 b(ts)424 b(are)f(the)g(inputs,)437 b(whic)-31 b(h)424 b(w)-31 b(e)424 b(can)f(represen)-31 b(t)422 b(using)i(four)0 22637 y(parameters.)493 b(The)370 b(return)e(v)-61 b(alue)370 b(is)f(the)g(distance,)i(whic)-31 b(h)370 b(is)f(a)g(\260oating-p)31 b(oin)-31 b(t)373 b(v)-61 b(alue.)0 24986 y(Already)370 b(w)-31 b(e)370 b(can)f(write)h(an)f (outline)i(of)f(the)f(function:)0 27416 y Fk(def)582 b(distance\(x1,)h(y1,)e(x2,)h(y2\):)1162 28771 y(return)g(0.0)0 31201 y Fn(Ob)-31 b(viously)-92 b(,)566 b(this)525 b(v)-31 b(ersion)526 b(of)f(the)h(function)g(do)31 b(esn't)526 b(compute)g(distances;)604 b(it)526 b(alw)-31 b(a)g(ys)0 32556 y(returns)398 b(zero.)582 b(But)400 b(it)g(is)f(syn)-31 b(tactically)403 b(correct,)k(and)399 b(it)h(will)h(run,)406 b(whic)-31 b(h)400 b(means)g(that)0 33911 y(w)-31 b(e)370 b(can)f(test)h(it)g(b)31 b(efore)369 b(w)-31 b(e)369 b(mak)-31 b(e)371 b(it)f(more)f(complicated.)0 36260 y(T)-92 b(o)370 b(test)f(the)h(new)f(function,)i(w)-31 b(e)370 b(call)g(it)g(with)h(sample)f(v)-61 b(alues:)0 38690 y Fk(>>>)582 b(distance\(1,)g(2,)g(4,)f(6\))0 40045 y(0.0)0 42475 y Fn(W)-92 b(e)379 b(c)-31 b(hose)380 b(these)g(v)-61 b(alues)381 b(so)f(that)h(the)f(horizon)-31 b(tal)383 b(distance)e(equals)f(3)h(and)f(the)g(v)-31 b(ertical)0 43829 y(distance)363 b(equals)f(4;)j(that)e(w)-31 b(a)g(y)-92 b(,)365 b(the)e(result)e(is)h(5)g(\(the)h(h)-31 b(yp)31 b(oten)-31 b(use)363 b(of)f(a)g(3-4-5)h(triangle\).)0 45184 y(When)369 b(testing)h(a)g(function,)h(it)f(is)f(useful)g(to)h (kno)-31 b(w)370 b(the)g(righ)-31 b(t)370 b(answ)-31 b(er.)0 47533 y(A)g(t)393 b(this)f(p)31 b(oin)-31 b(t)393 b(w)-31 b(e)393 b(ha)-31 b(v)g(e)393 b(con\257rmed)f(that)h(the)g (function)g(is)f(syn)-31 b(tactically)396 b(correct,)i(and)0 48888 y(w)-31 b(e)422 b(can)g(start)h(adding)g(lines)f(of)g(co)31 b(de.)651 b(After)422 b(eac)-31 b(h)422 b(incremen)-31 b(tal)424 b(c)-31 b(hange,)436 b(w)-31 b(e)422 b(test)h(the)0 50243 y(function)390 b(again.)551 b(If)388 b(an)h(error)e(o)31 b(ccurs)388 b(at)h(an)-31 b(y)389 b(p)31 b(oin)-31 b(t,)395 b(w)-31 b(e)388 b(kno)-31 b(w)390 b(where)e(it)h(m)-31 b(ust)389 b(b)31 b(e|in)0 51598 y(the)369 b(last)i(line)e(w)-31 b(e)370 b(added.)0 53947 y(A)475 b(logical)k(\257rst)c(step)g(in)h(the) f(computation)k(is)c(to)i(\257nd)e(the)h(di\256erences)e Fg(x)32811 54113 y Ff(2)33624 53947 y Fj(\241)317 b Fg(x)35435 54113 y Ff(1)36407 53947 y Fn(and)0 55302 y Fg(y)543 55468 y Ff(2)1186 55302 y Fj(\241)147 b Fg(y)2737 55468 y Ff(1)3233 55302 y Fn(.)476 b(W)-92 b(e)318 b(will)k(store)d(those)h (v)-61 b(alues)319 b(in)h(temp)31 b(orary)321 b(v)-61 b(ariables)320 b(named)g Fk(dx)f Fn(and)h Fk(dy)g Fn(and)0 56657 y(prin)-31 b(t)370 b(them.)p eop %%Page: 50 76 50 75 bop 0 -2070 a Fv(50)27205 b(F)-106 b(ruitful)424 b(functions)p 0 -1627 38191 45 v 0 865 a Fk(def)582 b(distance\(x1,)h (y1,)e(x2,)h(y2\):)1162 2220 y(dx)g(=)f(x2)g(-)h(x1)1162 3575 y(dy)g(=)f(y2)g(-)h(y1)1162 4930 y(print)g("dx)g(is",)g(dx)1162 6285 y(print)g("dy)g(is",)g(dy)1162 7640 y(return)g(0.0)0 9942 y Fn(If)280 b(the)h(function)h(is)f(w)-31 b(orking,)300 b(the)281 b(outputs)h(should)f(b)31 b(e)280 b(3)h(and)f(4.)464 b(If)280 b(so,)299 b(w)-31 b(e)281 b(kno)-31 b(w)282 b(that)g(the)0 11297 y(function)428 b(is)f(getting)i(the)f(righ)-31 b(t)428 b(parameters)f(and)g(p)31 b(erforming)428 b(the)f(\257rst)g (computation)0 12652 y(correctly)-92 b(.)493 b(If)369 b(not,)h(there)f(are)g(only)i(a)e(few)h(lines)f(to)h(c)-31 b(hec)g(k.)0 14874 y(Next)370 b(w)-31 b(e)370 b(compute)g(the)f(sum)g (of)h(squares)f(of)g Fk(dx)h Fn(and)f Fk(dy)p Fn(:)0 17176 y Fk(def)582 b(distance\(x1,)h(y1,)e(x2,)h(y2\):)1162 18531 y(dx)g(=)f(x2)g(-)h(x1)1162 19886 y(dy)g(=)f(y2)g(-)h(y1)1162 21241 y(dsquared)h(=)e(dx**2)h(+)f(dy**2)1162 22596 y(print)h ("dsquared)h(is:)e(",)h(dsquared)1162 23951 y(return)g(0.0)0 26253 y Fn(Notice)449 b(that)f(w)-31 b(e)447 b(remo)-31 b(v)g(ed)448 b(the)g Fk(print)f Fn(statemen)-31 b(ts)449 b(w)-31 b(e)448 b(wrote)g(in)f(the)g(previous)h(step.)0 27608 y(Co)31 b(de)255 b(lik)-31 b(e)257 b(that)f(is)f(called)h Fv(sca\256olding)e Fn(b)31 b(ecause)255 b(it)h(is)e(helpful)i(for)f (building)i(the)e(program)0 28963 y(but)369 b(is)h(not)f(part)h(of)g (the)f(\257nal)h(pro)31 b(duct.)0 31185 y(Again,)482 b(w)-31 b(e)459 b(w)-31 b(ould)459 b(run)f(the)g(program)h(at)g(this)f (stage)h(and)f(c)-31 b(hec)g(k)459 b(the)f(output)h(\(whic)-31 b(h)0 32539 y(should)370 b(b)31 b(e)368 b(25\).)0 34761 y(Finally)-92 b(,)356 b(if)351 b(w)-31 b(e)350 b(ha)-31 b(v)g(e)351 b(imp)31 b(orted)352 b(the)e(math)h(mo)31 b(dule,)356 b(w)-31 b(e)350 b(can)h(use)f(the)g Fk(sqrt)h Fn(function)g(to)0 36116 y(compute)370 b(and)g(return)e(the)i(result:)0 38418 y Fk(def)582 b(distance\(x1,)h(y1,)e(x2,)h(y2\):)1162 39773 y(dx)g(=)f(x2)g(-)h(x1)1162 41128 y(dy)g(=)f(y2)g(-)h(y1)1162 42483 y(dsquared)h(=)e(dx**2)h(+)f(dy**2)1162 43838 y(result)h(=)g (math.sqrt\(dsquared\))1162 45193 y(return)g(result)0 47495 y Fn(If)407 b(that)h(w)-31 b(orks)407 b(correctly)-92 b(,)417 b(y)-31 b(ou)408 b(are)e(done.)606 b(Otherwise,)418 b(y)-31 b(ou)407 b(migh)-31 b(t)409 b(w)-31 b(an)g(t)409 b(to)e(prin)-31 b(t)408 b(the)0 48850 y(v)-61 b(alue)370 b(of)f Fk(result)h Fn(b)31 b(efore)369 b(the)h(return)e(statemen)-31 b(t.)0 51072 y(When)420 b(y)-31 b(ou)421 b(start)g(out,)435 b(y)-31 b(ou)422 b(should)f(add)f(only)i(a)f(line)g(or)g(t)-31 b(w)g(o)422 b(of)f(co)31 b(de)421 b(at)g(a)g(time.)648 b(As)0 52427 y(y)-31 b(ou)317 b(gain)g(more)f(exp)31 b(erience,)327 b(y)-31 b(ou)317 b(migh)-31 b(t)317 b(\257nd)f(y)-31 b(ourself)317 b(writing)g(and)g(debugging)g(bigger)0 53782 y(c)-31 b(h)g(unks.)508 b(Either)375 b(w)-31 b(a)g(y)-92 b(,)378 b(the)c(incremen)-31 b(tal)377 b(dev)-31 b(elopmen)g(t)376 b(pro)31 b(cess)373 b(can)i(sa)-31 b(v)g(e)375 b(y)-31 b(ou)375 b(a)g(lot)g(of)0 55137 y(debugging)c(time.)0 57358 y(The)e(k)-31 b(ey)370 b(asp)31 b(ects)369 b(of)h(the)f(pro)31 b(cess)368 b(are:)p eop %%Page: 51 77 51 76 bop 0 -2070 a Fv(5.3)425 b(Comp)35 b(osition)27824 b(51)p 0 -1627 38191 45 v 1353 865 a Fn(1.)554 b(Start)440 b(with)g(a)f(w)-31 b(orking)440 b(program)f(and)g(mak)-31 b(e)440 b(small)g(incremen)-31 b(tal)441 b(c)-31 b(hanges.)701 b(A)-31 b(t)2767 2220 y(an)g(y)370 b(p)31 b(oin)-31 b(t,)371 b(if)f(there)f(is)g(an)g(error,)g(y)-31 b(ou)370 b(will)h(kno)-31 b(w)370 b(exactly)h(where)e(it)h(is.)1353 4617 y(2.)554 b(Use)470 b(temp)31 b(orary)471 b(v)-61 b(ariables)471 b(to)f(hold)h(in)-31 b(termediate)473 b(v)-61 b(alues)470 b(so)g(y)-31 b(ou)470 b(can)h(output)2767 5972 y(and)370 b(c)-31 b(hec)g(k)369 b(them.)1353 8368 y(3.)554 b(Once)530 b(the)h(program)g(is)f(w)-31 b(orking,)573 b(y)-31 b(ou)531 b(migh)-31 b(t)533 b(w)-31 b(an)g(t)532 b(to)f(remo)-31 b(v)g(e)531 b(some)g(of)g(the)2767 9723 y(sca\256olding)320 b(or)e(consolidate)j(m)-31 b(ultiple)320 b(statemen)-31 b(ts)320 b(in)-31 b(to)320 b(comp)31 b(ound)319 b(expressions,)2767 11078 y(but)370 b(only)g(if)g(it)g(do)31 b(es)368 b(not)i(mak)-31 b(e)371 b(the)e(program)h(di\261cult)h(to)f(read.)2767 13886 y Fm(As)563 b(an)g(exer)-57 b(cise,)606 b(use)563 b(incr)-57 b(emental)565 b(development)e(to)g(write)f(a)h(function)2767 15241 y(c)-57 b(al)57 b(le)-57 b(d)555 b Fk(hypotenuse)h Fm(that)d(r)-57 b(eturns)554 b(the)g(length)g(of)h(the)f(hyp)-57 b(otenuse)554 b(of)h(a)2767 16595 y(right)348 b(triangle)g(given)h(the) e(lengths)h(of)g(the)f(two)g(le)-57 b(gs)348 b(as)f(p)-57 b(ar)g(ameters.)493 b(R)-57 b(e)g(c)g(or)g(d)2767 17950 y(e)g(ach)397 b(stage)e(of)i(the)e(incr)-57 b(emental)398 b(development)f(pr)-57 b(o)g(c)g(ess)396 b(as)f(you)i(go.)0 22713 y Fl(5.3)1793 b(Comp)50 b(osition)0 25330 y Fn(As)423 b(y)-31 b(ou)424 b(should)g(exp)31 b(ect)424 b(b)-31 b(y)424 b(no)-31 b(w,)438 b(y)-31 b(ou)424 b(can)g(call)h(one)f (function)g(from)h(within)g(another.)0 26684 y(This)370 b(abilit)-31 b(y)371 b(is)f(called)g Fv(comp)35 b(osition)p Fn(.)0 28934 y(As)422 b(an)h(example,)438 b(w)-31 b(e'll)425 b(write)e(a)g(function)h(that)g(tak)-31 b(es)423 b(t)-31 b(w)g(o)425 b(p)31 b(oin)-31 b(ts,)437 b(the)423 b(cen)-31 b(ter)423 b(of)g(the)0 30289 y(circle)369 b(and)h(a)f(p)31 b(oin)-31 b(t)371 b(on)e(the)h(p)31 b(erimeter,)369 b(and)h(computes)g (the)f(area)h(of)f(the)h(circle.)0 32538 y(Assume)520 b(that)i(the)f(cen)-31 b(ter)520 b(p)31 b(oin)-31 b(t)522 b(is)e(stored)g(in)h(the)g(v)-61 b(ariables)521 b Fk(xc)f Fn(and)h Fk(yc)p Fn(,)559 b(and)521 b(the)0 33893 y(p)31 b(erimeter)333 b(p)31 b(oin)-31 b(t)335 b(is)e(in)g Fk(xp)h Fn(and)f Fk(yp)p Fn(.)481 b(The)333 b(\257rst)g(step)g(is)g(to)h (\257nd)f(the)h(radius)f(of)h(the)f(circle,)0 35248 y(whic)-31 b(h)391 b(is)e(the)h(distance)h(b)31 b(et)-31 b(w)g(een)390 b(the)g(t)-31 b(w)g(o)392 b(p)31 b(oin)-31 b(ts.)555 b(F)-92 b(ortunately)g(,)396 b(there)389 b(is)h(a)g(function,)0 36602 y Fk(distance)p Fn(,)371 b(that)f(do)31 b(es)369 b(that:)0 38933 y Fk(radius)582 b(=)f(distance\(xc,)i(yc,)f(xp,)f(yp\)) 0 41263 y Fn(The)369 b(second)g(step)h(is)f(to)h(\257nd)f(the)g(area)g (of)h(a)g(circle)f(with)h(that)h(radius)e(and)g(return)g(it:)0 43593 y Fk(result)582 b(=)f(area\(radius\))0 44948 y(return)h(result)0 47278 y Fn(W)-92 b(rapping)369 b(that)i(up)e(in)g(a)h(function,)h(w)-31 b(e)369 b(get:)0 49608 y Fk(def)582 b(area2\(xc,)g(yc,)g(xp,)f(yp\):) 1162 50963 y(radius)h(=)g(distance\(xc,)h(yc,)e(xp,)h(yp\))1162 52318 y(result)g(=)g(area\(radius\))1162 53673 y(return)g(result)0 56003 y Fn(W)-92 b(e)395 b(called)h(this)g(function)h Fk(area2)e Fn(to)h(distinguish)h(it)f(from)g(the)g Fk(area)f Fn(function)i(de\257ned)0 57358 y(earlier.)454 b(There)253 b(can)h(only)g(b)31 b(e)253 b(one)g(function)i(with)f(a)f(giv)-31 b(en)255 b(name)f(within)h(a)e(giv)-31 b(en)254 b(mo)31 b(dule.)p eop %%Page: 52 78 52 77 bop 0 -2070 a Fv(52)27205 b(F)-106 b(ruitful)424 b(functions)p 0 -1627 38191 45 v 0 865 a Fn(The)481 b(temp)31 b(orary)482 b(v)-61 b(ariables)481 b Fk(radius)h Fn(and)f Fk(result)g Fn(are)g(useful)g(for)g(dev)-31 b(elopmen)g(t)483 b(and)0 2220 y(debugging,)440 b(but)425 b(once)f(the)h(program)g(is)f (w)-31 b(orking,)440 b(w)-31 b(e)425 b(can)g(mak)-31 b(e)425 b(it)g(more)g(concise)g(b)-31 b(y)0 3575 y(comp)31 b(osing)371 b(the)e(function)i(calls:)0 5911 y Fk(def)582 b(area2\(xc,)g(yc,)g(xp,)f(yp\):)1162 7266 y(return)h (area\(distance\(xc,)i(yc,)e(xp,)f(yp\)\))2767 10165 y Fm(As)469 b(an)f(exer)-57 b(cise,)488 b(write)469 b(a)f(function)j Fk(slope\(x1,)582 b(y1,)g(x2,)f(y2\))469 b Fm(that)f(r)-57 b(e-)2767 11520 y(turns)451 b(the)h(slop)-57 b(e)451 b(of)g(the)g(line)i(thr)-57 b(ough)451 b(the)g(p)-57 b(oints)451 b Fn(\()p Fg(x)p Fn(1)p Fg(;)184 b(y)40 b Fn(1\))454 b Fm(and)d Fn(\()p Fg(x)p Fn(2)p Fg(;)184 b(y)40 b Fn(2\))p Fm(.)2767 12875 y(Then)322 b(use)g(this)f(function)i (in)f(a)g(function)h(c)-57 b(al)57 b(le)-57 b(d)322 b Fk(intercept\(x1,)583 b(y1,)e(x2,)2767 14230 y(y2\))437 b Fm(that)e(r)-57 b(eturns)436 b(the)g(y-inter)-57 b(c)g(ept)438 b(of)e(the)g(line)h(thr)-57 b(ough)435 b(the)h(p)-57 b(oints)436 b Fk(\(x1,)2767 15585 y(y1\))397 b Fm(and)f Fk(\(x2,)582 b(y2\))p Fm(.)0 20364 y Fl(5.4)1793 b(Bo)50 b(olean)597 b(functions)0 22989 y Fn(F)-92 b(unctions)371 b(can)g(return)f(b)31 b(o)g(olean)372 b(v)-61 b(alues,)372 b(whic)-31 b(h)372 b(is)f(often)g(con)-31 b(v)g(enien)g(t)373 b(for)e(hiding)h(com-)0 24344 y(plicated)f(tests)e(inside)h(functions.) 493 b(F)-92 b(or)369 b(example:)0 26679 y Fk(def)582 b(isDivisible\(x,)h(y\):)1162 28034 y(if)f(x)f(\045)g(y)h(==)f(0:)2325 29389 y(return)h(1)4068 b(#)581 b(it's)h(true)1162 30744 y(else:)2325 32099 y(return)g(0)4068 b(#)581 b(it's)h(false)0 34435 y Fn(The)368 b(name)h(of)f(this)h(function)g(is)f Fk(isDivisible)p Fn(.)494 b(It)367 b(is)h(common)i(to)f(giv)-31 b(e)369 b(b)31 b(o)g(olean)369 b(func-)0 35790 y(tions)c(names)g(that)h (sound)e(lik)-31 b(e)366 b(y)-31 b(es/no)365 b(questions.)492 b Fk(isDivisible)366 b Fn(returns)d(either)i Fk(1)f Fn(or)0 37145 y Fk(0)369 b Fn(to)h(indicate)h(whether)e(the)h Fk(x)f Fn(is)g(or)g(is)g(not)h(divisible)h(b)-31 b(y)369 b Fk(y)p Fn(.)0 39399 y(W)-92 b(e)448 b(can)h(mak)-31 b(e)450 b(the)g(function)g(more)f(concise)g(b)-31 b(y)449 b(taking)i(adv)-61 b(an)-31 b(tage)451 b(of)f(the)f(fact)h(that)0 40754 y(the)371 b(condition)i(of)f(the)f Fk(if)g Fn(statemen)-31 b(t)373 b(is)e(itself)i(a)e(b)31 b(o)g(olean)372 b(expression.)498 b(W)-92 b(e)370 b(can)i(return)0 42109 y(it)e(directly)-92 b(,)370 b(a)-31 b(v)g(oiding)372 b(the)e Fk(if)f Fn(statemen)-31 b(t)371 b(altogether:)0 44445 y Fk(def)582 b(isDivisible\(x,)h(y\):) 1162 45800 y(return)f(x)g(\045)f(y)g(==)h(0)0 48136 y Fn(This)370 b(session)e(sho)-31 b(ws)370 b(the)f(new)h(function)g(in)g (action:)0 50471 y Fk(>>>)1744 b(isDivisible\(6,)583 b(4\))0 51826 y(0)0 53181 y(>>>)1744 b(isDivisible\(6,)583 b(3\))0 54536 y(1)0 56872 y Fn(Bo)31 b(olean)371 b(functions)f(are)f (often)h(used)f(in)g(conditional)j(statemen)-31 b(ts:)p eop %%Page: 53 79 53 78 bop 0 -2070 a Fv(5.5)425 b(More)h(recursion)26386 b(53)p 0 -1627 38191 45 v 0 865 a Fk(if)581 b(isDivisible\(x,)j(y\):) 1162 2220 y(print)e("x)g(is)f(divisible)i(by)e(y")0 3575 y(else:)1162 4930 y(print)h("x)g(is)f(not)h(divisible)g(by)g(y")0 7174 y Fn(It)369 b(migh)-31 b(t)371 b(b)31 b(e)369 b(tempting)i(to)f (write)g(something)h(lik)-31 b(e:)0 9418 y Fk(if)581 b(isDivisible\(x,)j(y\))d(==)h(1:)0 11662 y Fn(But)370 b(the)f(extra)h(comparison)g(is)f(unnecessary)-92 b(.)2767 14301 y Fm(As)424 b(an)h(exer)-57 b(cise,)433 b(write)424 b(a)h(function)h Fk(isBetween\(x,)583 b(y,)e(z\))425 b Fm(that)f(r)-57 b(eturns)2767 15656 y Fk(1)397 b Fm(if)g Fg(y)346 b Fj(\267)308 b Fg(x)f Fj(\267)h Fg(z)444 b Fm(or)396 b Fk(0)g Fm(otherwise.)0 20163 y Fl(5.5)1793 b(More)598 b(recursion)0 22660 y Fn(So)547 b(far,)592 b(y)-31 b(ou)547 b(ha)-31 b(v)g(e)548 b(only)f(learned)g(a)g(small)h (subset)e(of)i(Python,)592 b(but)547 b(y)-31 b(ou)548 b(migh)-31 b(t)548 b(b)31 b(e)0 24014 y(in)-31 b(terested)351 b(to)h(kno)-31 b(w)351 b(that)h(this)f(subset)f(is)h(a)f Fm(c)-57 b(omplete)351 b Fn(programming)i(language,)k(whic)-31 b(h)0 25369 y(means)390 b(that)h(an)-31 b(ything)393 b(that)e(can)f(b)31 b(e)389 b(computed)i(can)g(b)31 b(e)389 b(expressed)g(in)h(this)g(language.)0 26724 y(An)-31 b(y)395 b(program)f(ev)-31 b(er)394 b(written)i(could)e(b)31 b(e)394 b(rewritten)h(using)f(only)h(the)g(language)h(features)0 28079 y(y)-31 b(ou)426 b(ha)-31 b(v)g(e)427 b(learned)f(so)f(far)h (\(actually)-92 b(,)443 b(y)-31 b(ou)426 b(w)-31 b(ould)427 b(need)e(a)h(few)g(commands)h(to)f(con)-31 b(trol)0 29434 y(devices)369 b(lik)-31 b(e)371 b(the)e(k)-31 b(eyb)31 b(oard,)371 b(mouse,)f(disks,)f(etc.,)h(but)g(that's)g(all\).)0 31597 y(Pro)-31 b(ving)436 b(that)f(claim)h(is)e(a)g(non)-31 b(trivial)437 b(exercise)c(\257rst)h(accomplished)i(b)-31 b(y)434 b(Alan)h(T)-92 b(uring,)0 32952 y(one)508 b(of)g(the)g(\257rst) f(computer)h(scien)-31 b(tists)508 b(\(some)h(w)-31 b(ould)509 b(argue)f(that)g(he)g(w)-31 b(as)508 b(a)g(math-)0 34307 y(ematician,)d(but)476 b(a)g(lot)h(of)f(early)h(computer)f(scien)-31 b(tists)477 b(started)f(as)f(mathematicians\).)0 35662 y(Accordingly)-92 b(,)553 b(it)515 b(is)f(kno)-31 b(wn)515 b(as)g(the)f(T)-92 b(uring)515 b(Thesis.)928 b(If)514 b(y)-31 b(ou)515 b(tak)-31 b(e)516 b(a)e(course)g(on)h(the)0 37017 y(Theory)370 b(of)f(Computation,)374 b(y)-31 b(ou)370 b(will)h(ha)-31 b(v)g(e)370 b(a)f(c)-31 b(hance)370 b(to)g(see)e(the)i (pro)31 b(of.)0 39180 y(T)-92 b(o)496 b(giv)-31 b(e)496 b(y)-31 b(ou)496 b(an)f(idea)h(of)f(what)i(y)-31 b(ou)495 b(can)h(do)f(with)h(the)g(to)31 b(ols)496 b(y)-31 b(ou)496 b(ha)-31 b(v)g(e)496 b(learned)f(so)0 40535 y(far,)321 b(w)-31 b(e'll)310 b(ev)-61 b(aluate)310 b(a)e(few)h(recursiv)-31 b(ely)309 b(de\257ned)f(mathematical)k(functions.)473 b(A)308 b(recursiv)-31 b(e)0 41889 y(de\257nition)544 b(is)e(similar)h(to)g(a)g(circular)f(de\257nition,)588 b(in)542 b(the)g(sense)g(that)h(the)f(de\257nition)0 43244 y(con)-31 b(tains)316 b(a)f(reference)f(to)h(the)g(thing)h(b)31 b(eing)315 b(de\257ned.)474 b(A)314 b(truly)i(circular)e(de\257nition)j (is)d(not)0 44599 y(v)-31 b(ery)369 b(useful:)0 47238 y Fv(frab)71 b(juous:)554 b Fn(An)369 b(adjectiv)-31 b(e)371 b(used)e(to)h(describ)31 b(e)368 b(something)j(that)g(is)e (frab)61 b(juous.)0 49877 y(If)298 b(y)-31 b(ou)299 b(sa)-31 b(w)298 b(that)h(de\257nition)h(in)e(the)h(dictionary)-92 b(,)314 b(y)-31 b(ou)299 b(migh)-31 b(t)300 b(b)31 b(e)297 b(anno)-31 b(y)g(ed.)471 b(On)297 b(the)i(other)0 51232 y(hand,)321 b(if)308 b(y)-31 b(ou)309 b(lo)31 b(ok)-31 b(ed)309 b(up)f(the)g(de\257nition)i(of)e(the)h(mathematical)j (function)d(factorial,)323 b(y)-31 b(ou)0 52587 y(migh)g(t)371 b(get)f(something)h(lik)-31 b(e)370 b(this:)16776 54407 y(0!)309 b(=)e(1)16776 56094 y Fg(n)p Fn(!)i(=)e Fg(n)p Fn(\()p Fg(n)247 b Fj(\241)f Fn(1\)!)0 58713 y(This)432 b(de\257nition)h(sa)-31 b(ys)432 b(that)g(the)g(factorial)i(of)e(0)g (is)f(1,)448 b(and)432 b(the)f(factorial)j(of)e(an)-31 b(y)433 b(other)0 60068 y(v)-61 b(alue,)370 b Fg(n)p Fn(,)g(is)f Fg(n)h Fn(m)-31 b(ultiplied)372 b(b)-31 b(y)369 b(the)h(factorial)h(of)f Fg(n)246 b Fj(\241)g Fn(1.)p eop %%Page: 54 80 54 79 bop 0 -2070 a Fv(54)27205 b(F)-106 b(ruitful)424 b(functions)p 0 -1627 38191 45 v 0 865 a Fn(So)277 b(3!)h(is)f(3)g (times)h(2!,)296 b(whic)-31 b(h)278 b(is)f(2)g(times)h(1!,)297 b(whic)-31 b(h)278 b(is)f(1)g(times)h(0!.)462 b(Putting)279 b(it)f(all)g(together,)0 2220 y(3!)370 b(equals)g(3)f(times)h(2)g (times)g(1)f(times)h(1,)g(whic)-31 b(h)370 b(is)f(6.)0 4395 y(If)483 b(y)-31 b(ou)483 b(can)g(write)h(a)f(recursiv)-31 b(e)483 b(de\257nition)h(of)g(something,)513 b(y)-31 b(ou)484 b(can)f(usually)h(write)g(a)0 5749 y(Python)356 b(program)g(to)f(ev)-61 b(aluate)356 b(it.)489 b(The)355 b(\257rst)f(step)h(is)f(to)i(decide)f(what)h(the)f(parameters)0 7104 y(are)460 b(for)g(this)h(function.)767 b(With)460 b(little)j(e\256ort,)483 b(y)-31 b(ou)461 b(should)g(conclude)f(that)i Fk(factorial)0 8459 y Fn(tak)-31 b(es)370 b(a)g(single)g(parameter:)0 10715 y Fk(def)582 b(factorial\(n\):)0 12970 y Fn(If)369 b(the)g(argumen)-31 b(t)371 b(happ)31 b(ens)369 b(to)h(b)31 b(e)368 b(0,)i(all)h(w)-31 b(e)370 b(ha)-31 b(v)g(e)370 b(to)g(do)f(is)g(return)g(1:)0 15226 y Fk(def)582 b(factorial\(n\):) 1162 16581 y(if)g(n)f(==)g(0:)2325 17936 y(return)h(1)0 20191 y Fn(Otherwise,)385 b(and)c(this)g(is)g(the)g(in)-31 b(teresting)382 b(part,)j(w)-31 b(e)381 b(ha)-31 b(v)g(e)382 b(to)g(mak)-31 b(e)382 b(a)f(recursiv)-31 b(e)380 b(call)i(to)0 21546 y(\257nd)369 b(the)g(factorial)j(of)e Fg(n)246 b Fj(\241)g Fn(1)370 b(and)f(then)g(m)-31 b(ultiply)372 b(it)e(b)-31 b(y)370 b Fg(n)p Fn(:)0 23802 y Fk(def)582 b(factorial\(n\):)1162 25157 y(if)g(n)f(==)g(0:)2325 26512 y(return)h(1)1162 27867 y(else:)2325 29222 y(recurse)g(=)f (factorial\(n-1\))2325 30576 y(result)h(=)f(n)g(*)h(recurse)2325 31931 y(return)g(result)0 34187 y Fn(The)442 b(\260o)-31 b(w)442 b(of)g(execution)h(for)e(this)h(program)h(is)e(similar)i(to)f (the)g(\260o)-31 b(w)442 b(of)g Fk(countdown)h Fn(in)0 35542 y(Section)370 b(4.9.)494 b(If)369 b(w)-31 b(e)370 b(call)g Fk(factorial)h Fn(with)f(the)g(v)-61 b(alue)369 b(3:)0 37716 y(Since)e(3)f(is)h(not)g(0,)h(w)-31 b(e)367 b(tak)-31 b(e)368 b(the)e(second)h(branc)-31 b(h)366 b(and)h(calculate)h(the)f(factorial)i(of)e Fk(n-1)p Fn(...)2767 40380 y(Since)270 b(2)f(is)h(not)g(0,)290 b(w)-31 b(e)269 b(tak)-31 b(e)271 b(the)e(second)g(branc)-31 b(h)270 b(and)f(calculate)j(the)d(factorial)2767 41735 y(of)370 b Fk(n-1)p Fn(...)5203 43588 y(Since)378 b(1)g(is)f(not)i(0,)h(w)-31 b(e)378 b(tak)-31 b(e)379 b(the)f(second)f(branc)-31 b(h)378 b(and)g(calculate)5203 44943 y(the)369 b(factorial)j(of)e Fk(n-1)p Fn(...)7273 46860 y(Since)407 b(0)g Fm(is)g Fn(0,)417 b(w)-31 b(e)408 b(tak)-31 b(e)408 b(the)f(\257rst)g(branc)-31 b(h)407 b(and)g(return)7273 48215 y(1)369 b(without)j(making)f(an)-31 b(y)370 b(more)f(recursiv)-31 b(e)369 b(calls.)5203 50132 y(The)450 b(return)g(v)-61 b(alue)451 b(\(1\))h(is)e(m)-31 b(ultiplied)453 b(b)-31 b(y)451 b Fg(n)p Fn(,)472 b(whic)-31 b(h)451 b(is)f(1,)472 b(and)5203 51487 y(the)369 b(result)g(is)g (returned.)2767 53340 y(The)348 b(return)e(v)-61 b(alue)348 b(\(1\))h(is)e(m)-31 b(ultiplied)350 b(b)-31 b(y)347 b Fg(n)p Fn(,)353 b(whic)-31 b(h)348 b(is)f(2,)352 b(and)c(the)f (result)h(is)2767 54694 y(returned.)0 57358 y(The)395 b(return)f(v)-61 b(alue)395 b(\(2\))h(is)f(m)-31 b(ultiplied)397 b(b)-31 b(y)395 b Fg(n)p Fn(,)402 b(whic)-31 b(h)396 b(is)f(3,)402 b(and)394 b(the)h(result,)402 b(6,)g(b)31 b(ecomes)0 58713 y(the)369 b(return)g(v)-61 b(alue)370 b(of)f(the)h(function)g(call)h(that)f(started)g(the)f(whole)i(pro)31 b(cess.)p eop %%Page: 55 81 55 80 bop 0 -2070 a Fv(5.6)425 b(Leap)f(of)h(faith)27753 b(55)p 0 -1627 38191 45 v 0 865 a Fn(Here)369 b(is)g(what)h(the)g(stac) -31 b(k)370 b(diagram)h(lo)31 b(oks)370 b(lik)-31 b(e)370 b(for)f(this)h(sequence)f(of)g(function)i(calls:)1928 3044 y 20326563 9933045 0 0 20326563 9933045 startTexFig 1928 3044 a %%BeginDocument: illustrations/stack3.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: stack3.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 16:06:14 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 309 151 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 151 moveto 0 0 lineto 309 0 lineto 309 151 lineto closepath clip newpath -57.0 177.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 1800 975 m 5700 975 l 5700 1350 l 1800 1350 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1800 1500 m 5700 1500 l 5700 1875 l 1800 1875 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1800 2025 m 5700 2025 l 5700 2400 l 1800 2400 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1800 2550 m 5700 2550 l 5700 2925 l 1800 2925 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1800 450 m 5700 450 l 5700 825 l 1800 825 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 2565 1177 m 2565 1117 l 2413 1117 l 2533 1147 l 2413 1177 l cp eoclip n 2175 1147 m 2550 1147 l gs col0 s gr gr % arrowhead n 2413 1177 m 2533 1147 l 2413 1117 l col0 s /Helvetica ff 165.00 scf sf 2100 1200 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2625 1200 m gs 1 -1 sc (3) col0 sh gr % Polyline gs clippath 4065 1177 m 4065 1117 l 3913 1117 l 4033 1147 l 3913 1177 l cp eoclip n 3675 1147 m 4050 1147 l gs col0 s gr gr % arrowhead n 3913 1177 m 4033 1147 l 3913 1117 l col0 s /Helvetica ff 165.00 scf sf 3600 1200 m gs 1 -1 sc (recurse) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4125 1200 m gs 1 -1 sc (2) col0 sh gr % Polyline gs clippath 4065 1702 m 4065 1642 l 3913 1642 l 4033 1672 l 3913 1702 l cp eoclip n 3675 1672 m 4050 1672 l gs col0 s gr gr % arrowhead n 3913 1702 m 4033 1672 l 3913 1642 l col0 s /Helvetica ff 165.00 scf sf 3600 1725 m gs 1 -1 sc (recurse) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4125 1725 m gs 1 -1 sc (1) col0 sh gr % Polyline gs clippath 4065 2227 m 4065 2167 l 3913 2167 l 4033 2197 l 3913 2227 l cp eoclip n 3675 2197 m 4050 2197 l gs col0 s gr gr % arrowhead n 3913 2227 m 4033 2197 l 3913 2167 l col0 s /Helvetica ff 165.00 scf sf 3600 2250 m gs 1 -1 sc (recurse) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4125 2250 m gs 1 -1 sc (1) col0 sh gr % Polyline gs clippath 5415 2227 m 5415 2167 l 5263 2167 l 5383 2197 l 5263 2227 l cp eoclip n 5025 2197 m 5400 2197 l gs col0 s gr gr % arrowhead n 5263 2227 m 5383 2197 l 5263 2167 l col0 s % Polyline gs clippath 5415 1702 m 5415 1642 l 5263 1642 l 5383 1672 l 5263 1702 l cp eoclip n 5025 1672 m 5400 1672 l gs col0 s gr gr % arrowhead n 5263 1702 m 5383 1672 l 5263 1642 l col0 s % Polyline gs clippath 5415 1177 m 5415 1117 l 5263 1117 l 5383 1147 l 5263 1177 l cp eoclip n 5025 1147 m 5400 1147 l gs col0 s gr gr % arrowhead n 5263 1177 m 5383 1147 l 5263 1117 l col0 s /Helvetica ff 165.00 scf sf 5475 2250 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 4950 2250 m gs 1 -1 sc (return) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 5475 1725 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 4950 1725 m gs 1 -1 sc (return) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 5475 1200 m gs 1 -1 sc (6) col0 sh gr /Helvetica ff 165.00 scf sf 4950 1200 m gs 1 -1 sc (return) dup sw pop neg 0 rm col0 sh gr % Arc gs clippath 5694 2216 m 5676 2274 l 5821 2319 l 5716 2255 l 5839 2262 l cp eoclip n 5700.0 2475.0 225.0 90.0 -90.0 arcn gs col0 s gr gr % arrowhead n 5839 2262 m 5716 2255 l 5821 2319 l col0 s % Arc gs clippath 5694 1691 m 5676 1749 l 5821 1794 l 5716 1730 l 5839 1737 l cp eoclip n 5700.0 1950.0 225.0 90.0 -90.0 arcn gs col0 s gr gr % arrowhead n 5839 1737 m 5716 1730 l 5821 1794 l col0 s % Arc gs clippath 5694 641 m 5676 699 l 5821 744 l 5716 680 l 5839 687 l cp eoclip n 5700.0 900.0 225.0 90.0 -90.0 arcn gs col0 s gr gr % arrowhead n 5839 687 m 5716 680 l 5821 744 l col0 s % Arc gs clippath 5694 1166 m 5676 1224 l 5821 1269 l 5716 1205 l 5839 1212 l cp eoclip n 5700.0 1425.0 225.0 90.0 -90.0 arcn gs col0 s gr gr % arrowhead n 5839 1212 m 5716 1205 l 5821 1269 l col0 s % Polyline gs clippath 2565 1702 m 2565 1642 l 2413 1642 l 2533 1672 l 2413 1702 l cp eoclip n 2175 1672 m 2550 1672 l gs col0 s gr gr % arrowhead n 2413 1702 m 2533 1672 l 2413 1642 l col0 s % Polyline gs clippath 2565 2227 m 2565 2167 l 2413 2167 l 2533 2197 l 2413 2227 l cp eoclip n 2175 2197 m 2550 2197 l gs col0 s gr gr % arrowhead n 2413 2227 m 2533 2197 l 2413 2167 l col0 s % Polyline gs clippath 2565 2752 m 2565 2692 l 2413 2692 l 2533 2722 l 2413 2752 l cp eoclip n 2175 2722 m 2550 2722 l gs col0 s gr gr % arrowhead n 2413 2752 m 2533 2722 l 2413 2692 l col0 s /Helvetica ff 165.00 scf sf 1650 675 m gs 1 -1 sc (__main__) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 1650 1200 m gs 1 -1 sc (factorial) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2100 1725 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2625 1725 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 2100 2250 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2625 2250 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 2100 2775 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2625 2775 m gs 1 -1 sc (0) col0 sh gr /Helvetica ff 165.00 scf sf 1650 1725 m gs 1 -1 sc (factorial) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 1650 2250 m gs 1 -1 sc (factorial) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 1650 2775 m gs 1 -1 sc (factorial) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 6000 2550 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 6000 2025 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 6000 1500 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 6000 975 m gs 1 -1 sc (6) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 22635 a Fn(The)319 b(return)g(v)-61 b(alues)319 b(are)g(sho)-31 b(wn)319 b(b)31 b(eing)320 b(passed)f(bac)-31 b(k)319 b(up)g(the)h(stac)-31 b(k.)476 b(In)319 b(eac)-31 b(h)320 b(frame,)330 b(the)0 23990 y(return)369 b(v)-61 b(alue)369 b(is)g(the)h(v)-61 b(alue)369 b(of)h Fk(result)p Fn(,)g(whic)-31 b(h)371 b(is)e(the)g(pro)31 b(duct)369 b(of)h Fk(n)f Fn(and)h Fk(recurse)p Fn(.)0 26165 y(Notice)440 b(that)f(in)f(the)h (last)g(frame,)456 b(the)438 b(lo)31 b(cal)440 b(v)-61 b(ariables)439 b Fk(recurse)g Fn(and)f Fk(result)h Fn(do)f(not)0 27520 y(exist,)370 b(b)31 b(ecause)369 b(the)g(branc)-31 b(h)370 b(that)g(creates)f(them)h(did)g(not)f(execute.)0 32061 y Fl(5.6)1793 b(Leap)598 b(of)f(faith)0 34574 y Fn(F)-92 b(ollo)-31 b(wing)358 b(the)e(\260o)-31 b(w)356 b(of)g(execution)h(is)e(one)h(w)-31 b(a)g(y)356 b(to)h(read)e (programs,)k(but)c(it)i(can)e(quic)-31 b(kly)0 35929 y(b)31 b(ecome)382 b(lab)-31 b(yrin)g(thine.)533 b(An)382 b(alternativ)-31 b(e)385 b(is)d(what)h(w)-31 b(e)382 b(call)h(the)f(\\leap)h(of)g(faith.")532 b(When)0 37284 y(y)-31 b(ou)527 b(come)f(to)h(a)f(function)h(call,)567 b(instead)527 b(of)f(follo)-31 b(wing)530 b(the)c(\260o)-31 b(w)527 b(of)f(execution,)567 b(y)-31 b(ou)0 38638 y Fm(assume)369 b Fn(that)h(the)f(function)i(w)-31 b(orks)370 b(correctly)f(and)h(returns)e(the)h(appropriate)i(v)-61 b(alue.)0 40814 y(In)345 b(fact,)351 b(y)-31 b(ou)347 b(are)e(already)h(practicing)h(this)f(leap)g(of)g(faith)h(when)e(y)-31 b(ou)346 b(use)f(built-in)i(func-)0 42168 y(tions.)485 b(When)342 b(y)-31 b(ou)344 b(call)g Fk(math.cos)f Fn(or)g Fk(math.exp)p Fn(,)350 b(y)-31 b(ou)343 b(don't)h(examine)g(the)f (implemen-)0 43523 y(tations)381 b(of)e(those)h(functions.)523 b(Y)-92 b(ou)380 b(just)f(assume)g(that)h(they)g(w)-31 b(ork)380 b(b)31 b(ecause)378 b(the)h(p)31 b(eople)0 44878 y(who)370 b(wrote)g(the)f(built-in)i(libraries)f(w)-31 b(ere)369 b(go)31 b(o)g(d)370 b(programmers.)0 47053 y(The)480 b(same)h(is)f(true)g(when)g(y)-31 b(ou)481 b(call)g(one)f(of)h(y)-31 b(our)480 b(o)-31 b(wn)481 b(functions.)827 b(F)-92 b(or)479 b(example,)510 b(in)0 48408 y(Section)417 b(5.4,)430 b(w)-31 b(e)416 b(wrote)h(a)f(function)i (called)f Fk(isDivisible)g Fn(that)g(determines)g(whether)0 49763 y(one)339 b(n)-31 b(um)g(b)31 b(er)338 b(is)h(divisible)h(b)-31 b(y)339 b(another.)483 b(Once)338 b(w)-31 b(e)339 b(ha)-31 b(v)g(e)340 b(con)-31 b(vinced)339 b(ourselv)-31 b(es)339 b(that)h(this)0 51118 y(function)282 b(is)e(correct|b)-31 b(y)280 b(testing)i(and)f(examining)h(the)f(co)31 b(de|w)-31 b(e)281 b(can)f(use)g(the)h(function)0 52473 y(without)371 b(lo)31 b(oking)372 b(at)e(the)f(co)31 b(de)369 b(again.)0 54648 y(The)468 b(same)h(is)f(true)g(of)h(recursiv)-31 b(e)467 b(programs.)791 b(When)467 b(y)-31 b(ou)469 b(get)g(to)g(the)g (recursiv)-31 b(e)467 b(call,)0 56003 y(instead)346 b(of)g(follo)-31 b(wing)349 b(the)c(\260o)-31 b(w)346 b(of)g(execution,)352 b(y)-31 b(ou)346 b(should)f(assume)h(that)g(the)f(recursiv)-31 b(e)p eop %%Page: 56 82 56 81 bop 0 -2070 a Fv(56)27205 b(F)-106 b(ruitful)424 b(functions)p 0 -1627 38191 45 v 0 865 a Fn(call)443 b(w)-31 b(orks)443 b(\(yields)g(the)g(correct)f(result\))h(and)f(then)h (ask)f(y)-31 b(ourself,)462 b(\\Assuming)443 b(that)g(I)0 2220 y(can)388 b(\257nd)f(the)h(factorial)i(of)f Fg(n)258 b Fj(\241)h Fn(1,)393 b(can)388 b(I)f(compute)i(the)f(factorial)i(of)e Fg(n)p Fn(?")548 b(In)387 b(this)i(case,)0 3575 y(it)370 b(is)f(clear)h(that)g(y)-31 b(ou)370 b(can,)g(b)-31 b(y)369 b(m)-31 b(ultiplying)373 b(b)-31 b(y)370 b Fg(n)p Fn(.)0 5888 y(Of)405 b(course,)413 b(it's)406 b(a)f(bit)g(strange)g(to)h (assume)e(that)i(the)f(function)h(w)-31 b(orks)405 b(correctly)h(when)0 7243 y(y)-31 b(ou)370 b(ha)-31 b(v)g(en't)371 b(\257nished)e(writing)i (it,)f(but)g(that's)g(wh)-31 b(y)370 b(it's)g(called)h(a)e(leap)h(of)g (faith!)0 12198 y Fl(5.7)1793 b(One)598 b(more)g(example)0 14904 y Fn(In)317 b(the)g(previous)h(example,)329 b(w)-31 b(e)318 b(used)f(temp)31 b(orary)318 b(v)-61 b(ariables)318 b(to)g(sp)31 b(ell)317 b(out)h(the)g(steps)f(and)0 16259 y(to)370 b(mak)-31 b(e)370 b(the)g(co)31 b(de)369 b(easier)g(to)h (debug,)g(but)f(w)-31 b(e)370 b(could)g(ha)-31 b(v)g(e)370 b(sa)-31 b(v)g(ed)370 b(a)f(few)h(lines:)0 18653 y Fk(def)582 b(factorial\(n\):)1162 20008 y(if)g(n)f(==)g(0:)2325 21363 y(return)h(1)1162 22718 y(else:)2325 24072 y(return)g(n)f(*)g (factorial\(n-1\))0 26467 y Fn(F)-92 b(rom)442 b(no)-31 b(w)444 b(on,)462 b(w)-31 b(e)443 b(will)i(tend)e(to)g(use)g(the)g (more)g(concise)g(form,)462 b(but)443 b(w)-31 b(e)443 b(recommend)0 27822 y(that)463 b(y)-31 b(ou)463 b(use)f(the)g(more)g (explicit)i(v)-31 b(ersion)463 b(while)g(y)-31 b(ou)463 b(are)f(dev)-31 b(eloping)464 b(co)31 b(de.)771 b(When)0 29176 y(y)-31 b(ou)370 b(ha)-31 b(v)g(e)370 b(it)g(w)-31 b(orking,)371 b(y)-31 b(ou)370 b(can)g(tigh)-31 b(ten)371 b(it)f(up)f(if)h(y)-31 b(ou)370 b(are)f(feeling)h(inspired.)0 31490 y(After)478 b Fk(factorial)p Fn(,)507 b(the)478 b(most)g(common)i(example)f(of)f(a)g(recursiv)-31 b(ely)478 b(de\257ned)g(mathe-)0 32845 y(matical)372 b(function)e(is)g Fk(fibonacci)p Fn(,)g(whic)-31 b(h)371 b(has)e(the)g(follo)-31 b(wing)373 b(de\257nition:)7475 35757 y Fg(f)119 b(ibonacci)p Fn(\(0\))310 b(=)d(1)7475 37444 y Fg(f)119 b(ibonacci)p Fn(\(1\))310 b(=)d(1)7475 39131 y Fg(f)119 b(ibonacci)p Fn(\()p Fg(n)p Fn(\))310 b(=)d Fg(f)119 b(ibonacci)p Fn(\()p Fg(n)248 b Fj(\241)e Fn(1\))h(+)f Fg(f)119 b(ibonacci)p Fn(\()p Fg(n)248 b Fj(\241)e Fn(2\);)0 41730 y(T)-92 b(ranslated)370 b(in)-31 b(to)371 b(Python,)g(it)f(lo)31 b(oks)370 b(lik)-31 b(e)370 b(this:)0 44125 y Fk(def)582 b(fibonacci)g(\(n\):)1162 45480 y(if)g(n)f(==)g(0)h(or)f(n)h(==)f(1:) 2325 46834 y(return)h(1)1162 48189 y(else:)2325 49544 y(return)g(fibonacci\(n-1\))h(+)e(fibonacci\(n-2\))0 51938 y Fn(If)366 b(y)-31 b(ou)367 b(try)g(to)g(follo)-31 b(w)369 b(the)e(\260o)-31 b(w)367 b(of)g(execution)h(here,)f(ev)-31 b(en)367 b(for)f(fairly)i(small)g(v)-61 b(alues)366 b(of)h Fg(n)p Fn(,)0 53293 y(y)-31 b(our)386 b(head)g(explo)31 b(des.)542 b(But)386 b(according)h(to)f(the)g(leap)h(of)f(faith,)392 b(if)386 b(y)-31 b(ou)386 b(assume)g(that)h(the)0 54648 y(t)-31 b(w)g(o)404 b(recursiv)-31 b(e)402 b(calls)h(w)-31 b(ork)404 b(correctly)-92 b(,)411 b(then)403 b(it)g(is)f(clear)h(that)h (y)-31 b(ou)403 b(get)g(the)g(righ)-31 b(t)403 b(result)0 56003 y(b)-31 b(y)369 b(adding)i(them)f(together.)p eop %%Page: 57 83 57 82 bop 0 -2070 a Fv(5.8)425 b(Chec)-35 b(king)425 b(t)-35 b(yp)35 b(es)26373 b(57)p 0 -1627 38191 45 v 0 865 a Fl(5.8)1793 b(Chec)-50 b(king)599 b(t)-50 b(yp)50 b(es)0 3243 y Fn(What)370 b(happ)31 b(ens)368 b(if)i(w)-31 b(e)370 b(call)g Fk(factorial)h Fn(and)e(giv)-31 b(e)370 b(it)g(1.5)h(as)e(an)g(argumen)-31 b(t?)0 5369 y Fk(>>>)582 b(factorial)g(\(1.5\))0 6724 y(RuntimeError:)h(Maximum)f(recursion)h (depth)f(exceeded)0 8849 y Fn(It)354 b(lo)31 b(oks)355 b(lik)-31 b(e)355 b(an)f(in\257nite)h(recursion.)487 b(But)354 b(ho)-31 b(w)355 b(can)f(that)h(b)31 b(e?)487 b(There)353 b(is)h(a)g(base)g(case|)0 10204 y(when)369 b Fk(n)582 b(==)f(0)p Fn(.)493 b(The)369 b(problem)h(is)f(that)i(the)e (v)-61 b(alues)369 b(of)h Fk(n)f Fm(miss)g Fn(the)h(base)f(case.)0 12249 y(In)458 b(the)h(\257rst)f(recursiv)-31 b(e)457 b(call,)483 b(the)459 b(v)-61 b(alue)458 b(of)h Fk(n)g Fn(is)f(0.5.)762 b(In)458 b(the)g(next,)482 b(it)459 b(is)g(-0.5.)761 b(F)-92 b(rom)0 13604 y(there,)369 b(it)h(gets)g (smaller)g(and)g(smaller,)g(but)g(it)f(will)i(nev)-31 b(er)369 b(b)31 b(e)369 b(0.)0 15648 y(W)-92 b(e)347 b(ha)-31 b(v)g(e)349 b(t)-31 b(w)g(o)349 b(c)-31 b(hoices.)486 b(W)-92 b(e)347 b(can)h(try)g(to)h(generalize)g(the)f Fk(factorial)g Fn(function)i(to)e(w)-31 b(ork)0 17003 y(with)426 b(\260oating-p)31 b(oin)-31 b(t)429 b(n)-31 b(um)g(b)31 b(ers,)439 b(or)425 b(w)-31 b(e)426 b(can)f(mak)-31 b(e)427 b Fk(factorial)f Fn(c)-31 b(hec)g(k)426 b(the)f(t)-31 b(yp)31 b(e)426 b(of)g(its)0 18358 y(parameter.)468 b(The)292 b(\257rst)g(option)i(is)e(called)h(the)f(gamma)j(function)e(and)g(it's) g(a)f(little)i(b)31 b(ey)-31 b(ond)0 19713 y(the)369 b(scop)31 b(e)369 b(of)h(this)g(b)31 b(o)g(ok.)493 b(So)369 b(w)-31 b(e'll)371 b(go)f(for)f(the)h(second.)0 21757 y(W)-92 b(e)364 b(can)i(use)e Fk(type)i Fn(to)g(compare)g(the)f(t)-31 b(yp)31 b(e)366 b(of)f(the)h(parameter)g(to)g(the)f(t)-31 b(yp)31 b(e)366 b(of)f(a)h(kno)-31 b(wn)0 23112 y(in)g(teger)465 b(v)-61 b(alue)464 b(\(lik)-31 b(e)465 b(1\).)777 b(While)464 b(w)-31 b(e're)464 b(at)g(it,)489 b(w)-31 b(e)464 b(also)g(mak)-31 b(e)465 b(sure)e(the)h(parameter)g(is)0 24467 y(p)31 b(ositiv)-31 b(e:)0 26593 y Fk(def)582 b(factorial)g(\(n\):)1162 27948 y(if)g(type\(n\))g(!=)f(type\(1\):)2325 29303 y(print)g ("Factorial)i(is)f(only)f(defined)i(for)e(integers.")2325 30658 y(return)h(-1)1162 32013 y(elif)g(n)f(<)h(0:)2325 33367 y(print)f("Factorial)i(is)f(only)f(defined)i(for)e(positive)h (integers.")2325 34722 y(return)g(-1)1162 36077 y(elif)g(n)f(==)h(0:) 2325 37432 y(return)g(1)1162 38787 y(else:)2325 40142 y(return)g(n)f(*)g(factorial\(n-1\))0 42268 y Fn(No)-31 b(w)270 b(w)-31 b(e)269 b(ha)-31 b(v)g(e)269 b(three)g(base)f(cases.) 459 b(The)269 b(\257rst)f(catc)-31 b(hes)269 b(nonin)-31 b(tegers.)460 b(The)269 b(second)f(catc)-31 b(hes)0 43623 y(negativ)g(e)553 b(in)-31 b(tegers.)1037 b(In)550 b(b)31 b(oth)550 b(cases,)596 b(the)551 b(program)g(prin)-31 b(ts)551 b(an)f(error)g(message)h(and)0 44978 y(returns)368 b(a)i(sp)31 b(ecial)369 b(v)-61 b(alue,)371 b(-1,)e(to)h(indicate)h (that)g(something)g(w)-31 b(en)g(t)370 b(wrong:)0 47103 y Fk(>>>)582 b(factorial)g(\("fred"\))0 48458 y(Factorial)g(is)g(only)g (defined)g(for)f(integers.)0 49813 y(-1)0 51168 y(>>>)h(factorial)g (\(-2\))0 52523 y(Factorial)g(is)g(only)g(defined)g(for)f(positive)i (integers.)0 53878 y(-1)0 56003 y Fn(If)422 b(w)-31 b(e)423 b(get)g(past)g(b)31 b(oth)422 b(c)-31 b(hec)g(ks,)436 b(then)423 b(w)-31 b(e)423 b(kno)-31 b(w)423 b(that)h Fg(n)e Fn(is)g(a)h(p)31 b(ositiv)-31 b(e)424 b(in)-31 b(teger,)437 b(and)422 b(w)-31 b(e)0 57358 y(can)369 b(pro)-31 b(v)g(e)370 b(that)h(the)e(recursion)g(terminates.)p eop %%Page: 58 84 58 83 bop 0 -2070 a Fv(58)27205 b(F)-106 b(ruitful)424 b(functions)p 0 -1627 38191 45 v 0 865 a Fn(This)395 b(program)g(demonstrates)g(a)g(pattern)g(sometimes)g(called)h(a)e Fv(guardian)p Fn(.)569 b(The)394 b(\257rst)0 2220 y(t)-31 b(w)g(o)480 b(conditionals)h(act)e(as)f(guardians,)507 b(protecting)480 b(the)e(co)31 b(de)479 b(that)g(follo)-31 b(ws)481 b(from)d(v)-61 b(al-)0 3575 y(ues)482 b(that)j(migh)-31 b(t)484 b(cause)f(an)g(error.)833 b(The)484 b(guardians)f(mak)-31 b(e)485 b(it)e(p)31 b(ossible)483 b(to)h(pro)-31 b(v)g(e)484 b(the)0 4930 y(correctness)368 b(of)i(the)f(co)31 b(de.)0 9441 y Fl(5.9)1793 b(Glossary)0 11606 y Fv(fruitful)424 b(function:)554 b Fn(A)369 b(function)i(that)f(yields)g(a)f(return)g(v) -61 b(alue.)0 13846 y Fv(return)426 b(v)-71 b(alue:)553 b Fn(The)370 b(v)-61 b(alue)369 b(pro)-31 b(vided)370 b(as)f(the)h(result)f(of)h(a)f(function)i(call.)0 16087 y Fv(temp)35 b(orary)426 b(v)-71 b(ariable:)553 b Fn(A)300 b(v)-61 b(ariable)302 b(used)e(to)h(store)g(an)g(in)-31 b(termediate)303 b(v)-61 b(alue)301 b(in)f(a)h(com-)2767 17442 y(plex)370 b(calculation.)0 19682 y Fv(dead)425 b(co)35 b(de:)554 b Fn(P)-31 b(art)475 b(of)g(a)f(program)g(that)h(can) f(nev)-31 b(er)474 b(b)31 b(e)473 b(executed,)501 b(often)475 b(b)31 b(ecause)473 b(it)2767 21037 y(app)31 b(ears)369 b(after)h(a)f Fk(return)h Fn(statemen)-31 b(t.)0 23278 y Fk(None)p Fv(:)554 b Fn(A)367 b(sp)31 b(ecial)368 b(Python)h(v)-61 b(alue)368 b(returned)f(b)-31 b(y)368 b(functions)g(that)h(ha)-31 b(v)g(e)368 b(no)g(return)f(state-)2767 24633 y(men)-31 b(t,)371 b(or)e(a)h(return)e(statemen)-31 b(t)371 b(without)h(an)d (argumen)-31 b(t.)0 26873 y Fv(incremen)c(tal)424 b(dev)-35 b(elopmen)g(t:)555 b Fn(A)431 b(program)i(dev)-31 b(elopmen)g(t)435 b(plan)d(in)-31 b(tended)433 b(to)g(a)-31 b(v)g(oid)2767 28228 y(debugging)371 b(b)-31 b(y)370 b(adding)g(and)f(testing)i(only)f (a)g(small)g(amoun)-31 b(t)371 b(of)f(co)31 b(de)369 b(at)h(a)g(time.)0 30468 y Fv(sca\256olding:)553 b Fn(Co)31 b(de)350 b(that)i(is)d(used)h(during)g(program)g(dev)-31 b(elopmen)g(t)353 b(but)d(is)g(not)g(part)g(of)2767 31823 y(the)370 b(\257nal)g(v)-31 b(ersion.)0 34064 y Fv(guardian:)554 b Fn(A)413 b(condition)j(that)f(c)-31 b(hec)g(ks)414 b(for)f(and)h(handles)g(circumstances)g(that)h(migh)-31 b(t)2767 35419 y(cause)369 b(an)h(error.)p eop %%Page: 59 85 59 84 bop 0 10202 a Fi(Chapter)861 b(6)0 16783 y Fo(Iteration)0 24223 y Fl(6.1)1793 b(Multiple)599 b(assignmen)-50 b(t)0 26959 y Fn(As)422 b(y)-31 b(ou)424 b(ma)-31 b(y)424 b(ha)-31 b(v)g(e)423 b(disco)-31 b(v)g(ered,)438 b(it)423 b(is)g(legal)h(to)g (mak)-31 b(e)423 b(more)g(than)h(one)f(assignmen)-31 b(t)424 b(to)0 28314 y(the)361 b(same)g(v)-61 b(ariable.)491 b(A)361 b(new)g(assignmen)-31 b(t)362 b(mak)-31 b(es)361 b(an)g(existing)i(v)-61 b(ariable)361 b(refer)f(to)i(a)f(new)0 29669 y(v)-61 b(alue)370 b(\(and)g(stop)f(referring)g(to)h(the)f(old)h (v)-61 b(alue\).)0 32084 y Fk(bruce)582 b(=)f(5)0 33439 y(print)h(bruce,)0 34794 y(bruce)g(=)f(7)0 36149 y(print)h(bruce)0 38565 y Fn(The)383 b(output)g(of)g(this)g(program)g(is)f Fk(5)581 b(7)p Fn(,)386 b(b)31 b(ecause)382 b(the)h(\257rst)f(time)h Fk(bruce)g Fn(is)f(prin)-31 b(ted,)387 b(his)0 39920 y(v)-61 b(alue)433 b(is)g(5,)449 b(and)433 b(the)f(second)h(time,)450 b(his)432 b(v)-61 b(alue)433 b(is)g(7.)683 b(The)433 b(comma)h(at)f(the)g(end)g(of)g(the)0 41274 y(\257rst)502 b Fk(print)h Fn(statemen)-31 b(t)505 b(suppresses)500 b(the)j(newline)h(after)f(the)g(output,)537 b(whic)-31 b(h)504 b(is)e(wh)-31 b(y)0 42629 y(b)31 b(oth)370 b(outputs)g(app)31 b(ear)369 b(on)g(the)h(same)f(line.)0 44964 y(Here)g(is)g(what)h Fv(m)-35 b(ultiple)424 b(assignmen)-35 b(t)369 b Fn(lo)31 b(oks)370 b(lik)-31 b(e)371 b(in)e(a)h(state)g(diagram:)14706 46343 y 5196759 2828615 0 0 5196759 2828615 startTexFig 14706 46343 a %%BeginDocument: illustrations/assign2.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: assign2.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 10:52:44 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 79 43 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 43 moveto 0 0 lineto 79 0 lineto 79 43 lineto closepath clip newpath -129.0 100.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 2175 975 m 3450 975 l 3450 1650 l 2175 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 3139 1500 m 3158 1443 l 3015 1394 l 3119 1462 l 2995 1451 l cp eoclip n 2760 1339 m 3135 1467 l gs col0 s gr gr % arrowhead n 2995 1451 m 3119 1462 l 3015 1394 l col0 s % Polyline [15 45] 45 sd n 2766 1271 m 3141 1174 l gs col0 s gr [] 0 sd % Polyline n 3075 1080 m 3300 1230 l gs col0 s gr % Polyline n 3300 1080 m 3075 1230 l gs col0 s gr /Helvetica ff 165.00 scf sf 3150 1530 m gs 1 -1 sc (7) col0 sh gr /Helvetica ff 165.00 scf sf 3150 1230 m gs 1 -1 sc (5) col0 sh gr /Helvetica ff 165.00 scf sf 2730 1340 m gs 1 -1 sc (bruce) dup sw pop neg 0 rm col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 53293 a Fn(With)415 b(m)-31 b(ultiple)417 b(assignmen)-31 b(t)416 b(it)f(is)f(esp)31 b(ecially)416 b(imp)31 b(ortan)-31 b(t)416 b(to)g(distinguish)f(b)31 b(et)-31 b(w)g(een)416 b(an)0 54648 y(assignmen)-31 b(t)493 b(op)31 b(eration)493 b(and)f(a)f(statemen)-31 b(t)494 b(of)e(equalit)-31 b(y)-92 b(.)861 b(Because)492 b(Python)g(uses)f(the)0 56003 y(equal)337 b(sign)g(\()p Fk(=)p Fn(\))g(for)f(assignmen)-31 b(t,)345 b(it)338 b(is)e(tempting)i(to)f(in)-31 b(terpret)337 b(a)g(statemen)-31 b(t)338 b(lik)-31 b(e)337 b Fk(a)582 b(=)f(b)0 57358 y Fn(as)369 b(a)h(statemen)-31 b(t)371 b(of)e(equalit)-31 b(y)-92 b(.)495 b(It)370 b(is)f(not!)p eop %%Page: 60 86 60 85 bop 0 -2070 a Fv(60)32021 b(Iteration)p 0 -1627 38191 45 v 0 865 a Fn(First,)423 b(equalit)-31 b(y)414 b(is)e(comm)-31 b(utativ)g(e)416 b(and)c(assignmen)-31 b(t)414 b(is)e(not.)622 b(F)-92 b(or)411 b(example,)424 b(in)413 b(mathe-)0 2220 y(matics,)369 b(if)e Fg(a)308 b Fn(=)f(7)367 b(then)g(7)308 b(=)g Fg(a)p Fn(.)491 b(But)367 b(in)g(Python,)i(the)e(statemen)-31 b(t)369 b Fk(a)581 b(=)g(7)367 b Fn(is)g(legal)h(and)f Fk(7)0 3575 y(=)581 b(a)369 b Fn(is)h(not.)0 5664 y(F)-92 b(urthermore,)423 b(in)413 b(mathematics,)427 b(a)413 b(statemen)-31 b(t)415 b(of)e(equalit)-31 b(y)415 b(is)e(alw)-31 b(a)g(ys)414 b(true.)623 b(If)413 b Fg(a)380 b Fn(=)g Fg(b)0 7019 y Fn(no)-31 b(w,)353 b(then)346 b Fg(a)h Fn(will)h(alw)-31 b(a)g(ys)349 b(equal)e Fg(b)p Fn(.)485 b(In)346 b(Python,)353 b(an)347 b(assignmen)-31 b(t)348 b(statemen)-31 b(t)349 b(can)e(mak)-31 b(e)0 8374 y(t)g(w)g(o)371 b(v)-61 b(ariables)370 b(equal,)g(but)g(they)f(don't)i(ha)-31 b(v)g(e)370 b(to)g(sta)-31 b(y)370 b(that)g(w)-31 b(a)g(y:)0 10544 y Fk(a)581 b(=)h(5)0 11899 y(b)f(=)h(a)2324 b(#)582 b(a)f(and)h(b)f(are)g(now)h(equal)0 13254 y(a)f(=)h(3)2324 b(#)582 b(a)f(and)h(b)f(are)g(no)h(longer)g (equal)0 15423 y Fn(The)465 b(third)g(line)g(c)-31 b(hanges)466 b(the)f(v)-61 b(alue)465 b(of)g Fk(a)g Fn(but)g(do)31 b(es)464 b(not)i(c)-31 b(hange)465 b(the)g(v)-61 b(alue)466 b(of)f Fk(b)p Fn(,)489 b(so)0 16778 y(they)381 b(are)f(no)h(longer)h (equal.)527 b(\(In)381 b(some)g(programming)i(languages,)i(a)c (di\256eren)-31 b(t)381 b(sym)-31 b(b)31 b(ol)0 18133 y(is)369 b(used)g(for)g(assignmen)-31 b(t,)371 b(suc)-31 b(h)369 b(as)g Fk(<-)g Fn(or)h Fk(:=)p Fn(,)f(to)h(a)-31 b(v)g(oid)371 b(confusion.\))0 20222 y(Although)351 b(m)-31 b(ultiple)351 b(assignmen)-31 b(t)351 b(is)e(frequen)-31 b(tly)350 b(helpful,)k(y)-31 b(ou)350 b(should)f(use)g(it)g(with)i (cau-)0 21577 y(tion.)502 b(If)372 b(the)g(v)-61 b(alues)373 b(of)f(v)-61 b(ariables)373 b(c)-31 b(hange)373 b(frequen)-31 b(tly)-92 b(,)374 b(it)f(can)f(mak)-31 b(e)373 b(the)f(co)31 b(de)372 b(di\261cult)0 22932 y(to)e(read)f(and)g(debug.)0 27336 y Fl(6.2)1793 b(The)598 b Fe(while)h Fl(statemen)-50 b(t)0 29759 y Fn(Computers)384 b(are)e(often)i(used)e(to)i(automate)h (rep)31 b(etitiv)-31 b(e)384 b(tasks.)534 b(Rep)31 b(eating)384 b(iden)-31 b(tical)385 b(or)0 31113 y(similar)446 b(tasks)g(without)h (making)g(errors)c(is)i(something)i(that)f(computers)f(do)g(w)-31 b(ell)447 b(and)0 32468 y(p)31 b(eople)370 b(do)f(p)31 b(o)g(orly)-92 b(.)0 34557 y(W)g(e)350 b(ha)-31 b(v)g(e)353 b(seen)d(t)-31 b(w)g(o)353 b(programs,)j Fk(nLines)c Fn(and)f Fk(countdown)p Fn(,)356 b(that)d(use)d(recursion)h(to)h(p)31 b(er-)0 35912 y(form)313 b(rep)31 b(etition,)325 b(whic)-31 b(h)313 b(is)f(also)h(called)g Fv(iteration)p Fn(.)474 b(Because)312 b(iteration)i(is)e(so)g(common,)0 37267 y(Python)425 b(pro)-31 b(vides)423 b(sev)-31 b(eral)424 b(language)i(features)d(to)h(mak)-31 b(e)425 b(it)f(easier.)655 b(The)424 b(\257rst)e(feature)0 38622 y(w)-31 b(e)370 b(are)f(going)i(to)f(lo)31 b(ok)370 b(at)g(is)f(the)g Fk(while)h Fn(statemen)-31 b(t.)0 40711 y(Here)369 b(is)g(what)h Fk(countdown)h Fn(lo)31 b(oks)370 b(lik)-31 b(e)370 b(with)g(a)g Fk(while)g Fn(statemen)-31 b(t:)0 42881 y Fk(def)582 b(countdown\(n\):)1162 44236 y(while)g(n)f(>)h(0:)2325 45591 y(print)f(n)2325 46946 y(n)g(=)g(n-1)1162 48301 y(print)h("Blastoff!")0 50471 y Fn(Since)369 b(w)-31 b(e)370 b(remo)-31 b(v)g(ed)370 b(the)g(recursiv)-31 b(e)368 b(call,)j(this)f(function)g(is)g(not)f(recursiv)-31 b(e.)0 52559 y(Y)-92 b(ou)278 b(can)f(almost)j(read)d(the)g Fk(while)h Fn(statemen)-31 b(t)280 b(as)d(if)h(it)g(w)-31 b(ere)278 b(English.)463 b(It)277 b(means,)297 b(\\While)0 53914 y Fk(n)454 b Fn(is)h(greater)f(than)i(0,)476 b(con)-31 b(tin)g(ue)456 b(displa)-31 b(ying)457 b(the)e(v)-61 b(alue)454 b(of)h Fk(n)g Fn(and)f(then)h(reducing)g(the)0 55269 y(v)-61 b(alue)370 b(of)f Fk(n)g Fn(b)-31 b(y)370 b(1.)493 b(When)369 b(y)-31 b(ou)369 b(get)h(to)g(0,)g(displa)-31 b(y)371 b(the)e(w)-31 b(ord)370 b Fk(Blastoff!)p Fn(")0 57358 y(More)f(formally)-92 b(,)371 b(here)e(is)g(the)g(\260o)-31 b(w)371 b(of)e(execution)i(for)e(a)h Fk(while)f Fn(statemen)-31 b(t:)p eop %%Page: 61 87 61 86 bop 0 -2070 a Fv(6.2)425 b(The)g Fk(while)g Fv(statemen)-35 b(t)23430 b(61)p 0 -1627 38191 45 v 1353 865 a Fn(1.)554 b(Ev)-61 b(aluate)371 b(the)f(condition,)i(yielding)f Fk(0)e Fn(or)g Fk(1)p Fn(.)1353 3012 y(2.)554 b(If)346 b(the)f(condition)j(is)d(false)h(\(0\),)352 b(exit)347 b(the)f Fk(while)g Fn(statemen)-31 b(t)347 b(and)f(con)-31 b(tin)g(ue)347 b(execu-)2767 4367 y(tion)371 b(at)f(the)f(next)h (statemen)-31 b(t.)1353 6514 y(3.)554 b(If)458 b(the)h(condition)h(is)e (true)g(\(1\),)482 b(execute)458 b(eac)-31 b(h)459 b(of)f(the)h (statemen)-31 b(ts)459 b(in)g(the)f(b)31 b(o)g(dy)2767 7869 y(and)370 b(then)f(go)h(bac)-31 b(k)370 b(to)g(step)f(1.)0 10227 y(The)527 b(b)31 b(o)g(dy)527 b(consists)g(of)h(all)g(of)f(the)h (statemen)-31 b(ts)528 b(b)31 b(elo)-31 b(w)528 b(the)f(header)g(with)h (the)g(same)0 11582 y(inden)-31 b(tation.)0 13646 y(This)396 b(t)-31 b(yp)31 b(e)395 b(of)h(\260o)-31 b(w)397 b(is)e(called)h(a)g Fv(lo)35 b(op)396 b Fn(b)31 b(ecause)395 b(the)h(third)f(step)h(lo)31 b(ops)396 b(bac)-31 b(k)396 b(around)f(to)0 15001 y(the)337 b(top.)483 b(Notice)338 b(that)h(if)e(the)g(condition)i(is)e(false)h (the)f(\257rst)g(time)h(through)g(the)f(lo)31 b(op,)345 b(the)0 16356 y(statemen)-31 b(ts)371 b(inside)e(the)h(lo)31 b(op)370 b(are)f(nev)-31 b(er)369 b(executed.)0 18420 y(The)382 b(b)31 b(o)g(dy)382 b(of)g(the)g(lo)31 b(op)382 b(should)g(c)-31 b(hange)383 b(the)f(v)-61 b(alue)382 b(of)g(one)g(or)g(more)g(v)-61 b(ariables)382 b(so)g(that)0 19775 y(ev)-31 b(en)g(tually)377 b(the)d(condition)j(b)31 b(ecomes)374 b(false)h(and)g(the)f(lo)31 b(op)376 b(terminates.)509 b(Otherwise)375 b(the)0 21130 y(lo)31 b(op)455 b(will)h(rep)31 b(eat)455 b(forev)-31 b(er,)476 b(whic)-31 b(h)455 b(is)f(called)i(an)f Fv(in\257nite)522 b(lo)35 b(op)p Fn(.)749 b(An)455 b(endless)f(source)0 22485 y(of)404 b(am)-31 b(usemen)g(t)405 b(for)e(computer)h(scien)-31 b(tists)404 b(is)g(the)f(observ)-61 b(ation)404 b(that)h(the)f (directions)g(on)0 23840 y(shamp)31 b(o)g(o,)370 b(\\Lather,)h(rinse,)e (rep)31 b(eat,")370 b(are)f(an)h(in\257nite)g(lo)31 b(op.)0 25905 y(In)457 b(the)h(case)f(of)i Fk(countdown)p Fn(,)481 b(w)-31 b(e)458 b(can)g(pro)-31 b(v)g(e)458 b(that)h(the)f(lo)31 b(op)458 b(terminates)h(b)31 b(ecause)457 b(w)-31 b(e)0 27259 y(kno)g(w)312 b(that)g(the)g(v)-61 b(alue)311 b(of)h Fk(n)e Fn(is)h(\257nite,)324 b(and)311 b(w)-31 b(e)312 b(can)f(see)f(that)j(the)e(v)-61 b(alue)311 b(of)h Fk(n)f Fn(gets)g(smaller)0 28614 y(eac)-31 b(h)406 b(time)g(through)g(the)f (lo)31 b(op,)416 b(so)405 b(ev)-31 b(en)g(tually)408 b(w)-31 b(e)406 b(ha)-31 b(v)g(e)406 b(to)g(get)g(to)g(0.)601 b(In)404 b(other)i(cases,)0 29969 y(it)370 b(is)f(not)h(so)f(easy)g(to) h(tell:)0 32115 y Fk(def)582 b(sequence\(n\):)1162 33470 y(while)g(n)f(!=)h(1:)2325 34825 y(print)f(n,)2325 36180 y(if)g(n\0452)h(==)f(0:)4650 b(#)581 b(n)g(is)h(even)3487 37534 y(n)f(=)g(n/2)2325 38889 y(else:)8718 b(#)581 b(n)g(is)h(odd)3487 40244 y(n)f(=)g(n*3+1)0 42390 y Fn(The)482 b(condition)i(for)e(this)g (lo)31 b(op)483 b(is)f Fk(n)581 b(!=)h(1)p Fn(,)510 b(so)482 b(the)g(lo)31 b(op)483 b(will)h(con)-31 b(tin)g(ue)483 b(un)-31 b(til)484 b Fk(n)e Fn(is)f Fk(1)p Fn(,)0 43745 y(whic)-31 b(h)370 b(will)h(mak)-31 b(e)370 b(the)g(condition)h(false.) 0 45809 y(Eac)-31 b(h)296 b(time)h(through)f(the)g(lo)31 b(op,)311 b(the)296 b(program)g(outputs)h(the)e(v)-61 b(alue)296 b(of)g Fk(n)g Fn(and)f(then)h(c)-31 b(hec)g(ks)0 47164 y(whether)305 b(it)g(is)g(ev)-31 b(en)304 b(or)h(o)31 b(dd.)471 b(If)304 b(it)i(is)e(ev)-31 b(en,)318 b(the)305 b(v)-61 b(alue)305 b(of)g Fk(n)g Fn(is)f(divided)i(b)-31 b(y)305 b(2.)471 b(If)305 b(it)g(is)f(o)31 b(dd,)0 48519 y(the)307 b(v)-61 b(alue)306 b(is)h(replaced)f(b)-31 b(y)307 b Fk(n*3+1)p Fn(.)472 b(F)-92 b(or)306 b(example,)320 b(if)307 b(the)g(starting)h(v)-61 b(alue)306 b(\(the)h(argumen)-31 b(t)0 49874 y(passed)369 b(to)h(sequence\))f(is)g(3,)h(the)f(resulting) h(sequence)f(is)g(3,)h(10,)h(5,)f(16,)g(8,)g(4,)g(2,)g(1.)0 51938 y(Since)343 b Fk(n)g Fn(sometimes)h(increases)e(and)h(sometimes)h (decreases,)k(there)342 b(is)h(no)g(ob)-31 b(vious)344 b(pro)31 b(of)0 53293 y(that)419 b Fk(n)g Fn(will)g(ev)-31 b(er)418 b(reac)-31 b(h)419 b(1,)431 b(or)418 b(that)h(the)g(program)g (terminates.)641 b(F)-92 b(or)417 b(some)i(particular)0 54648 y(v)-61 b(alues)434 b(of)g Fk(n)p Fn(,)450 b(w)-31 b(e)434 b(can)g(pro)-31 b(v)g(e)434 b(termination.)689 b(F)-92 b(or)433 b(example,)452 b(if)434 b(the)g(starting)h(v)-61 b(alue)434 b(is)g(a)0 56003 y(p)31 b(o)-31 b(w)g(er)364 b(of)f(t)-31 b(w)g(o,)367 b(then)c(the)h(v)-61 b(alue)363 b(of)h Fk(n)f Fn(will)i(b)31 b(e)363 b(ev)-31 b(en)363 b(eac)-31 b(h)364 b(time)g(through)g(the)f(lo)31 b(op)364 b(un)-31 b(til)0 57358 y(it)323 b(reac)-31 b(hes)322 b(1.)477 b(The)323 b(previous)f(example)i(ends)e(with)h(suc)-31 b(h)322 b(a)h(sequence,)331 b(starting)324 b(with)g(16.)p eop %%Page: 62 88 62 87 bop 0 -2070 a Fv(62)32021 b(Iteration)p 0 -1627 38191 45 v 0 865 a Fn(P)-31 b(articular)442 b(v)-61 b(alues)441 b(aside,)458 b(the)441 b(in)-31 b(teresting)442 b(question)f(is)f (whether)h(w)-31 b(e)440 b(can)h(pro)-31 b(v)g(e)441 b(that)0 2220 y(this)299 b(program)g(terminates)g(for)f Fm(al)57 b(l)298 b Fn(v)-61 b(alues)298 b(of)h Fk(n)p Fn(.)468 b(So)299 b(far,)313 b(no)298 b(one)h(has)f(b)31 b(een)298 b(able)g(to)h(pro)-31 b(v)g(e)0 3575 y(it)370 b Fm(or)e Fn(dispro)-31 b(v)g(e)370 b(it!)2767 6367 y Fm(As)418 b(an)f(exer)-57 b(cise,)425 b(r)-57 b(ewrite)417 b(the)h(function)h Fk(nLines)g Fm(fr)-57 b(om)418 b(Se)-57 b(ction)419 b(4.9)f(using)2767 7722 y(iter)-57 b(ation)397 b(inste)-57 b(ad)397 b(of)f(r)-57 b(e)g(cursion.)0 12460 y Fl(6.3)1793 b(T)-149 b(ables)0 15065 y Fn(One)323 b(of)g(the)g (things)h(lo)31 b(ops)323 b(are)g(go)31 b(o)g(d)323 b(for)g(is)g (generating)h(tabular)g(data.)479 b(Before)323 b(comput-)0 16420 y(ers)j(w)-31 b(ere)327 b(readily)h(a)-31 b(v)-61 b(ailable,)338 b(p)31 b(eople)327 b(had)g(to)h(calculate)h(logarithms,) 338 b(sines)326 b(and)h(cosines,)0 17774 y(and)387 b(other)h (mathematical)j(functions)e(b)-31 b(y)387 b(hand.)547 b(T)-92 b(o)388 b(mak)-31 b(e)389 b(that)f(easier,)k(mathematics)0 19129 y(b)31 b(o)g(oks)406 b(con)-31 b(tained)409 b(long)e(tables)g (listing)i(the)d(v)-61 b(alues)406 b(of)h(these)g(functions.)605 b(Creating)408 b(the)0 20484 y(tables)370 b(w)-31 b(as)370 b(slo)-31 b(w)370 b(and)g(b)31 b(oring,)370 b(and)f(they)h(tended)f(to) h(b)31 b(e)369 b(full)h(of)g(errors.)0 22725 y(When)365 b(computers)h(app)31 b(eared)366 b(on)g(the)g(scene,)g(one)g(of)g(the)g (initial)j(reactions)e(w)-31 b(as,)367 b(\\This)0 24080 y(is)400 b(great!)588 b(W)-92 b(e)400 b(can)h(use)f(the)g(computers)h (to)h(generate)f(the)g(tables,)409 b(so)401 b(there)f(will)j(b)31 b(e)400 b(no)0 25435 y(errors.")478 b(That)331 b(turned)e(out)g(to)h(b) 31 b(e)329 b(true)g(\(mostly\))i(but)f(shortsigh)-31 b(ted.)480 b(So)31 b(on)330 b(thereafter,)0 26790 y(computers)370 b(and)f(calculators)i(w)-31 b(ere)369 b(so)g(p)31 b(erv)-61 b(asiv)-31 b(e)369 b(that)i(the)e(tables)h(b)31 b(ecame)370 b(obsolete.)0 29031 y(W)-92 b(ell,)499 b(almost.)805 b(F)-92 b(or)472 b(some)h(op)31 b(erations,)500 b(computers)473 b(use)f(tables)i(of)f(v)-61 b(alues)473 b(to)g(get)h(an)0 30386 y(appro)-31 b(ximate)471 b(answ)-31 b(er)468 b(and)h(then)f(p)31 b(erform)468 b(computations)j(to)e(impro)-31 b(v)g(e)470 b(the)f(appro)-31 b(xi-)0 31741 y(mation.)713 b(In)441 b(some)i(cases,)460 b(there)442 b(ha)-31 b(v)g(e)442 b(b)31 b(een)442 b(errors)e(in)j(the)f(underlying)h(tables,)461 b(most)0 33096 y(famously)337 b(in)e(the)g(table)h(the)f(In)-31 b(tel)335 b(P)-31 b(en)g(tium)337 b(used)d(to)i(p)31 b(erform)334 b(\260oating-p)31 b(oin)-31 b(t)339 b(division.)0 35337 y(Although)552 b(a)e(log)i(table)f(is)f(not)h(as)f(useful)g(as)g (it)h(once)f(w)-31 b(as,)597 b(it)550 b(still)i(mak)-31 b(es)551 b(a)f(go)31 b(o)g(d)0 36692 y(example)311 b(of)f(iteration.) 476 b(The)310 b(follo)-31 b(wing)313 b(program)e(outputs)f(a)g (sequence)f(of)i(v)-61 b(alues)310 b(in)g(the)0 38047 y(left)370 b(column)h(and)e(their)g(logarithms)j(in)d(the)h(righ)-31 b(t)370 b(column:)0 40368 y Fk(x)581 b(=)h(1.0)0 41723 y(while)g(x)f(<)g(10.0:)1162 43078 y(print)h(x,)g('\\t',)g (math.log\(x\))1162 44433 y(x)g(=)f(x)g(+)g(1.0)0 46755 y Fn(The)369 b(string)h Fk('\\t')g Fn(represen)-31 b(ts)368 b(a)h Fv(tab)g Fn(c)-31 b(haracter.)0 48996 y(As)319 b(c)-31 b(haracters)320 b(and)f(strings)h(are)f(displa)-31 b(y)g(ed)321 b(on)f(the)f(screen,)329 b(an)320 b(in)-31 b(visible)321 b(mark)-31 b(er)320 b(called)0 50351 y(the)520 b Fv(cursor)g Fn(k)-31 b(eeps)519 b(trac)-31 b(k)520 b(of)g(where)f(the)h(next)g(c)-31 b(haracter)520 b(will)h(go.)944 b(After)520 b(a)f Fk(print)0 51706 y Fn(statemen)-31 b(t,)372 b(the)d(cursor)f(normally)j(go)31 b(es)370 b(to)g(the)f(b)31 b(eginning)371 b(of)e(the)h(next)g(line.)0 53947 y(The)412 b(tab)g(c)-31 b(haracter)412 b(shifts)f(the)h(cursor)f(to)h(the)f(righ) -31 b(t)413 b(un)-31 b(til)413 b(it)f(reac)-31 b(hes)411 b(one)h(of)g(the)f(tab)0 55302 y(stops.)608 b(T)-92 b(abs)408 b(are)f(useful)h(for)g(making)i(columns)e(of)g(text)h(line)f(up,)418 b(as)408 b(in)g(the)g(output)g(of)0 56657 y(the)369 b(previous)h (program:)p eop %%Page: 63 89 63 88 bop 0 -2070 a Fv(6.3)425 b(T)-106 b(ables)31321 b(63)p 0 -1627 38191 45 v 0 865 a Fk(1.0)2906 b(0.0)0 2220 y(2.0)g(0.69314718056)0 3575 y(3.0)g(1.09861228867)0 4930 y(4.0)g(1.38629436112)0 6285 y(5.0)g(1.60943791243)0 7640 y(6.0)g(1.79175946923)0 8995 y(7.0)g(1.94591014906)0 10350 y(8.0)g(2.07944154168)0 11705 y(9.0)g(2.19722457734)0 13862 y Fn(If)442 b(these)f(v)-61 b(alues)442 b(seem)g(o)31 b(dd,)460 b(remem)-31 b(b)31 b(er)442 b(that)h(the)f Fk(log)g Fn(function)h(uses)e(base)g Fk(e)p Fn(.)711 b(Since)0 15216 y(p)31 b(o)-31 b(w)g(ers)534 b(of)h(t)-31 b(w)g(o)535 b(are)f(so)g(imp)31 b(ortan)-31 b(t)536 b(in)e(computer)h (science,)575 b(w)-31 b(e)535 b(often)g(w)-31 b(an)g(t)535 b(to)g(\257nd)0 16571 y(logarithms)310 b(with)g(resp)31 b(ect)307 b(to)i(base)f(2.)472 b(T)-92 b(o)309 b(do)f(that,)322 b(w)-31 b(e)309 b(can)f(use)g(the)g(follo)-31 b(wing)312 b(form)-31 b(ula:)15590 20276 y(log)17020 20546 y Ff(2)17701 20276 y Fg(x)307 b Fn(=)19942 19527 y Fg(l)22 b(og)21359 19693 y Fc(e)21834 19527 y Fg(x)p 19942 20021 2525 45 v 19982 21035 a(l)g(og)21399 21201 y Fc(e)21874 21035 y Fn(2)35915 20276 y(\(6.1\))0 23391 y(Changing)371 b(the)f(output)g (statemen)-31 b(t)371 b(to:)1743 25548 y Fk(print)582 b(x,)g('\\t',)1163 b(math.log\(x\)/math.log\(2.0\))0 27705 y Fn(yields:)0 29862 y Fk(1.0)2906 b(0.0)0 31217 y(2.0)g(1.0)0 32572 y(3.0)g(1.58496250072)0 33927 y(4.0)g(2.0)0 35281 y(5.0)g(2.32192809489)0 36636 y(6.0)g(2.58496250072)0 37991 y(7.0)g(2.80735492206)0 39346 y(8.0)g(3.0)0 40701 y(9.0)g(3.16992500144)0 42858 y Fn(W)-92 b(e)375 b(can)h(see)f(that)i (1,)i(2,)f(4,)g(and)e(8)g(are)g(p)31 b(o)-31 b(w)g(ers)376 b(of)g(t)-31 b(w)g(o)377 b(b)31 b(ecause)376 b(their)g(logarithms)i (base)0 44213 y(2)438 b(are)g(round)g(n)-31 b(um)g(b)31 b(ers.)699 b(If)437 b(w)-31 b(e)439 b(w)-31 b(an)g(ted)439 b(to)g(\257nd)f(the)g(logarithms)i(of)f(other)f(p)31 b(o)-31 b(w)g(ers)438 b(of)0 45568 y(t)-31 b(w)g(o,)371 b(w)-31 b(e)370 b(could)g(mo)31 b(dify)371 b(the)e(program)h(lik)-31 b(e)370 b(this:)0 47725 y Fk(x)581 b(=)h(1.0)0 49080 y(while)g(x)f(<)g(100.0:)1162 50435 y(print)h(x,)g('\\t',)g (math.log\(x\)/math.log\(2.0\))1162 51790 y(x)g(=)f(x)g(*)g(2.0)0 53947 y Fn(No)-31 b(w)340 b(instead)g(of)f(adding)h(something)h(to)f Fk(x)f Fn(eac)-31 b(h)339 b(time)h(through)g(the)f(lo)31 b(op,)346 b(whic)-31 b(h)340 b(yields)0 55302 y(an)442 b(arithmetic)j(sequence,)460 b(w)-31 b(e)443 b(m)-31 b(ultiply)445 b Fk(x)d Fn(b)-31 b(y)442 b(something,)463 b(yielding)444 b(a)f(geometric)h(se-)0 56657 y(quence.)493 b(The)369 b(result)g(is:)p eop %%Page: 64 90 64 89 bop 0 -2070 a Fv(64)32021 b(Iteration)p 0 -1627 38191 45 v 0 865 a Fk(1.0)2906 b(0.0)0 2220 y(2.0)g(1.0)0 3575 y(4.0)g(2.0)0 4930 y(8.0)g(3.0)0 6285 y(16.0)2325 b(4.0)0 7640 y(32.0)g(5.0)0 8995 y(64.0)g(6.0)0 11083 y Fn(Because)390 b(of)g(the)h(tab)g(c)-31 b(haracters)390 b(b)31 b(et)-31 b(w)g(een)391 b(the)f(columns,)396 b(the)391 b(p)31 b(osition)391 b(of)g(the)f(second)0 12437 y(column)370 b(do)31 b(es)369 b(not)h(dep)31 b(end)369 b(on)g(the)h(n)-31 b(um)g(b)31 b(er)369 b(of)h(digits)g(in)g(the)f(\257rst)g(column.)0 14444 y(Logarithm)552 b(tables)f(ma)-31 b(y)551 b(not)f(b)31 b(e)550 b(useful)g(an)-31 b(y)550 b(more,)596 b(but)550 b(for)g(computer)h(scien)-31 b(tists,)0 15799 y(kno)g(wing)371 b(the)f(p)31 b(o)-31 b(w)g(ers)369 b(of)h(t)-31 b(w)g(o)371 b(is!)2767 17992 y Fm(As)384 b(an)h(exer)-57 b(cise,)387 b(mo)-57 b(dify)386 b(this)e(pr)-57 b(o)g(gr)g(am)385 b(so)f(that)f(it)i(outputs)e(the)h(p)-57 b(owers)383 b(of)2767 19347 y(two)395 b(up)h(to)g(65,536)f(\(that's)g Fn(2)15343 18945 y Ff(16)16281 19347 y Fm(\).)510 b(Print)396 b(it)g(out)g(and)g(memorize)g(it.)0 21540 y Fn(The)570 b(bac)-31 b(kslash)571 b(c)-31 b(haracter)570 b(in)g Fk('\\t')g Fn(indicates)h(the)f(b)31 b(eginning)572 b(of)e(an)g Fv(escap)35 b(e)656 b(se-)0 22895 y(quence)p Fn(.)g(Escap)31 b(e)424 b(sequences)f(are)g(used)g(to)h(represen)-31 b(t)423 b(in)-31 b(visible)425 b(c)-31 b(haracters)424 b(lik)-31 b(e)425 b(tabs)0 24250 y(and)369 b(newlines.)494 b(The)369 b(sequence)g Fk(\\n)g Fn(represen)-31 b(ts)368 b(a)i(newline.)0 26257 y(An)419 b(escap)31 b(e)418 b(sequence)g(can)h (app)31 b(ear)418 b(an)-31 b(ywhere)420 b(in)f(a)g(string;)444 b(in)419 b(the)f(example,)433 b(the)419 b(tab)0 27612 y(escap)31 b(e)369 b(sequence)g(is)g(the)g(only)h(thing)h(in)e(the)h (string.)0 29619 y(Ho)-31 b(w)370 b(do)g(y)-31 b(ou)370 b(think)g(y)-31 b(ou)370 b(represen)-31 b(t)368 b(a)i(bac)-31 b(kslash)370 b(in)f(a)h(string?)2767 31812 y Fm(As)396 b(an)g(exer)-57 b(cise,)397 b(write)f(a)g(single)g(string)h(that)2767 33988 y Fk(produces)7417 35343 y(this)12066 36698 y(output.)0 41439 y Fl(6.4)1793 b(Tw)-50 b(o-dimensional)599 b(tables)0 43779 y Fn(A)360 b(t)-31 b(w)g(o-dimensional)364 b(table)d(is)f(a)g (table)i(where)d(y)-31 b(ou)361 b(read)f(the)g(v)-61 b(alue)360 b(at)h(the)f(in)-31 b(tersection)0 45134 y(of)338 b(a)f(ro)-31 b(w)338 b(and)g(a)f(column.)483 b(A)337 b(m)-31 b(ultiplication)343 b(table)338 b(is)f(a)h(go)31 b(o)g(d)338 b(example.)483 b(Let's)338 b(sa)-31 b(y)337 b(y)-31 b(ou)0 46489 y(w)g(an)g(t)371 b(to)f(prin)-31 b(t)370 b(a)f(m)-31 b(ultiplication)374 b(table)c(for)g(the)f(v)-61 b(alues)369 b(from)h(1)g(to)g(6.)0 48496 y(A)364 b(go)31 b(o)g(d)364 b(w)-31 b(a)g(y)366 b(to)e(start)h(is)e(to)i(write)g(a)f (lo)31 b(op)364 b(that)i(prin)-31 b(ts)364 b(the)g(m)-31 b(ultiples)365 b(of)g(2,)g(all)h(on)e(one)0 49851 y(line:)0 51938 y Fk(i)581 b(=)h(1)0 53293 y(while)g(i)f(<=)h(6:)1162 54648 y(print)g(2*i,)g(')1744 b(',)1162 56003 y(i)582 b(=)f(i)g(+)g(1)0 57358 y(print)p eop %%Page: 65 91 65 90 bop 0 -2070 a Fv(6.5)425 b(Encapsulation)g(and)f(generalization) 16438 b(65)p 0 -1627 38191 45 v 0 865 a Fn(The)460 b(\257rst)f(line)h (initializes)i(a)e(v)-61 b(ariable)460 b(named)h Fk(i)p Fn(,)482 b(whic)-31 b(h)461 b(acts)e(as)h(a)g(coun)-31 b(ter)460 b(or)f Fv(lo)35 b(op)0 2220 y(v)-71 b(ariable)p Fn(.)600 b(As)404 b(the)h(lo)31 b(op)406 b(executes,)415 b(the)405 b(v)-61 b(alue)405 b(of)h Fk(i)f Fn(increases)f(from)i(1)f (to)g(6.)601 b(When)404 b Fk(i)0 3575 y Fn(is)e(7,)410 b(the)402 b(lo)31 b(op)403 b(terminates.)592 b(Eac)-31 b(h)403 b(time)g(through)f(the)g(lo)31 b(op,)412 b(it)402 b(displa)-31 b(ys)403 b(the)f(v)-61 b(alue)402 b(of)0 4930 y Fk(2*i)p Fn(,)370 b(follo)-31 b(w)g(ed)372 b(b)-31 b(y)369 b(three)g(spaces.)0 7088 y(Again,)482 b(the)459 b(comma)g(in)g(the)f Fk(print)h Fn(statemen)-31 b(t)460 b(suppresses)c(the)i(newline.)760 b(After)459 b(the)0 8443 y(lo)31 b(op)370 b(completes,)h(the)f(second)f Fk(print)g Fn(statemen)-31 b(t)372 b(starts)d(a)g(new)h(line.)0 10601 y(The)f(output)i(of)f(the)f(program)h(is:)0 12841 y Fk(2)3487 b(4)g(6)g(8)g(10)2906 b(12)0 15080 y Fn(So)369 b(far,)h(so)f(go)31 b(o)g(d.)494 b(The)369 b(next)h(step)f(is)g(to)h Fv(encapsulate)g Fn(and)f Fv(generalize)p Fn(.)0 19581 y Fl(6.5)1793 b(Encapsulation)599 b(and)f(generalization)0 22073 y Fn(Encapsulation)344 b(is)e(the)f(pro)31 b(cess)341 b(of)h(wrapping)h(a)e(piece)h(of)g(co)31 b(de)342 b(in)g(a)g(function,) 349 b(allo)-31 b(wing)0 23428 y(y)g(ou)418 b(to)h(tak)-31 b(e)419 b(adv)-61 b(an)-31 b(tage)419 b(of)f(all)h(the)f(things)h (functions)f(are)g(go)31 b(o)g(d)418 b(for.)638 b(Y)-92 b(ou)418 b(ha)-31 b(v)g(e)419 b(seen)0 24783 y(t)-31 b(w)g(o)382 b(examples)f(of)g(encapsulation:)517 b Fk(printParity)382 b Fn(in)f(Section)g(4.5;)388 b(and)380 b Fk(isDivisible)0 26138 y Fn(in)369 b(Section)i(5.4.)0 28296 y(Generalization)389 b(means)f(taking)h(something)f(sp)31 b(eci\257c,)392 b(suc)-31 b(h)386 b(as)h(prin)-31 b(ting)389 b(the)e(m)-31 b(ultiples)0 29651 y(of)365 b(2,)i(and)d(making)j(it)e(more)g(general,) i(suc)-31 b(h)364 b(as)h(prin)-31 b(ting)366 b(the)f(m)-31 b(ultiples)367 b(of)e(an)-31 b(y)365 b(in)-31 b(teger.)0 31809 y(This)268 b(function)g(encapsulates)g(the)g(previous)f(lo)31 b(op)268 b(and)f(generalizes)h(it)g(to)g(prin)-31 b(t)268 b(m)-31 b(ultiples)0 33164 y(of)370 b Fk(n)p Fn(:)0 35403 y Fk(def)582 b(printMultiples\(n\):)1162 36758 y(i)g(=)f(1)1162 38113 y(while)h(i)f(<=)h(6:)2325 39468 y(print)f(n*i,)h('\\t',)2325 40823 y(i)f(=)g(i)g(+)h(1)1162 42178 y(print)0 44417 y Fn(T)-92 b(o)325 b(encapsulate,)336 b(all)326 b(w)-31 b(e)326 b(had)f(to)h(do)f(w)-31 b(as)325 b(add)h(the)f(\257rst)f(line,) 335 b(whic)-31 b(h)326 b(declares)f(the)g(name)0 45772 y(of)495 b(the)g(function)h(and)f(the)g(parameter)g(list.)870 b(T)-92 b(o)495 b(generalize,)528 b(all)496 b(w)-31 b(e)495 b(had)g(to)g(do)g(w)-31 b(as)0 47127 y(replace)369 b(the)h(v)-61 b(alue)370 b(2)f(with)h(the)g(parameter)g Fk(n)p Fn(.)0 49285 y(If)363 b(w)-31 b(e)364 b(call)h(this)e(function)i(with)g(the)e (argumen)-31 b(t)365 b(2,)g(w)-31 b(e)364 b(get)g(the)g(same)g(output)g (as)g(b)31 b(efore.)0 50640 y(With)370 b(the)f(argumen)-31 b(t)371 b(3,)f(the)f(output)i(is:)0 52880 y Fk(3)3487 b(6)g(9)g(12)2906 b(15)g(18)0 55119 y Fn(With)370 b(the)f(argumen)-31 b(t)371 b(4,)f(the)f(output)i(is:)0 57358 y Fk(4)3487 b(8)g(12)2906 b(16)g(20)g(24)p eop %%Page: 66 92 66 91 bop 0 -2070 a Fv(66)32021 b(Iteration)p 0 -1627 38191 45 v 0 865 a Fn(By)451 b(no)-31 b(w)452 b(y)-31 b(ou)452 b(can)f(probably)h(guess)e(ho)-31 b(w)452 b(to)g(prin)-31 b(t)451 b(a)g(m)-31 b(ultiplication)456 b(table|b)-31 b(y)453 b(call-)0 2220 y(ing)422 b Fk(printMultiples)h Fn(rep)31 b(eatedly)422 b(with)g(di\256eren)-31 b(t)422 b(argumen)-31 b(ts.)649 b(In)421 b(fact,)435 b(w)-31 b(e)422 b(can)g(use)0 3575 y(another)370 b(lo)31 b(op:)0 6175 y Fk(i)581 b(=)h(1)0 7530 y(while)g(i)f(<=)h(6:)1162 8885 y(printMultiples\(i\))1162 10240 y(i)g(=)f(i)g(+)g(1)0 12840 y Fn(Notice)419 b(ho)-31 b(w)418 b(similar)h(this)f(lo)31 b(op)418 b(is)f(to)h(the)g(one)g(inside)f Fk(printMultiples)p Fn(.)639 b(All)419 b(w)-31 b(e)418 b(did)0 14195 y(w)-31 b(as)370 b(replace)f(the)h Fk(print)f Fn(statemen)-31 b(t)372 b(with)e(a)g(function)g(call.)0 16713 y(The)f(output)i(of)f (this)f(program)h(is)f(a)h(m)-31 b(ultiplication)374 b(table:)0 19313 y Fk(1)3487 b(2)g(3)g(4)g(5)g(6)0 20668 y(2)g(4)g(6)g(8)g(10)2906 b(12)0 22023 y(3)3487 b(6)g(9)g(12)2906 b(15)g(18)0 23378 y(4)3487 b(8)g(12)2906 b(16)g(20)g(24)0 24733 y(5)3487 b(10)2906 b(15)g(20)g(25)g(30)0 26088 y(6)3487 b(12)2906 b(18)g(24)g(30)g(36)0 31741 y Fl(6.6)1793 b(More)598 b(encapsulation)0 34735 y Fn(T)-92 b(o)448 b(demonstrate)h(encapsulation)h(again,)469 b(let's)448 b(tak)-31 b(e)449 b(the)f(co)31 b(de)447 b(from)h(the)g(end)f(of)h (Sec-)0 36090 y(tion)370 b(6.5)h(and)e(wrap)h(it)g(up)f(in)g(a)h (function:)0 38690 y Fk(def)582 b(printMultTable\(\):)1162 40045 y(i)g(=)f(1)1162 41400 y(while)h(i)f(<=)h(6:)2325 42755 y(printMultiples\(i\))2325 44110 y(i)f(=)g(i)g(+)h(1)0 46710 y Fn(This)466 b(pro)31 b(cess)465 b(is)g(a)h(common)i Fv(dev)-35 b(elopmen)g(t)536 b(plan)p Fn(.)782 b(W)-92 b(e)465 b(dev)-31 b(elop)467 b(co)31 b(de)466 b(b)-31 b(y)466 b(writing)0 48065 y(lines)390 b(of)g(co)31 b(de)390 b(outside)h(an)-31 b(y)390 b(function,)397 b(or)390 b(t)-31 b(yping)391 b(them)f(in)g(to)h(the)f(in)-31 b(terpreter.)554 b(When)0 49420 y(w)-31 b(e)370 b(get)g(the)f(co)31 b(de)369 b(w)-31 b(orking,)372 b(w)-31 b(e)369 b(extract)i(it)e(and)h(wrap)f(it) h(up)f(in)h(a)f(function.)0 51938 y(This)j(dev)-31 b(elopmen)g(t)374 b(plan)e(is)f(particularly)j(useful)d(if)h(y)-31 b(ou)372 b(don't)h(kno)-31 b(w,)374 b(when)d(y)-31 b(ou)372 b(start)0 53293 y(writing,)291 b(ho)-31 b(w)271 b(to)f(divide)g(the)f(program)h (in)-31 b(to)271 b(functions.)460 b(This)270 b(approac)-31 b(h)270 b(lets)g(y)-31 b(ou)270 b(design)0 54648 y(as)369 b(y)-31 b(ou)370 b(go)g(along.)p eop %%Page: 67 93 67 92 bop 0 -2070 a Fv(6.7)425 b(Lo)35 b(cal)424 b(v)-71 b(ariables)26603 b(67)p 0 -1627 38191 45 v 0 865 a Fl(6.7)1793 b(Lo)50 b(cal)597 b(v)-100 b(ariables)0 4195 y Fn(Y)-92 b(ou)673 b(migh)-31 b(t)676 b(b)31 b(e)672 b(w)-31 b(ondering)675 b(ho)-31 b(w)674 b(w)-31 b(e)674 b(can)g(use)e(the)i(same)f(v)-61 b(ariable,)751 b Fk(i)p Fn(,)f(in)673 b(b)31 b(oth)0 5549 y Fk(printMultiples)487 b Fn(and)e Fk(printMultTable)p Fn(.)841 b(Do)31 b(esn't)485 b(it)h(cause)e(problems)i(when)f(one)0 6904 y(of)370 b(the)f(functions)h(c)-31 b(hanges)370 b(the)g(v)-61 b(alue)369 b(of)h(the)f(v)-61 b(ariable?)0 9663 y(The)909 b(answ)-31 b(er)909 b(is)f(no,)1044 b(b)31 b(ecause)909 b(the)f Fk(i)h Fn(in)g Fk(printMultiples)h Fn(and)f(the)g Fk(i)g Fn(in)0 11018 y Fk(printMultTable)371 b Fn(are)e Fm(not)g Fn(the)g(same)h(v)-61 b(ariable.)0 13776 y(V)-92 b(ariables)380 b(created)f(inside)g(a)g(function)h (de\257nition)g(are)f(lo)31 b(cal;)386 b(y)-31 b(ou)379 b(can't)h(access)e(a)h(lo)31 b(cal)0 15131 y(v)-61 b(ariable)476 b(from)f(outside)g(its)g(\\home")h(function.)811 b(That)476 b(means)f(y)-31 b(ou)475 b(are)f(free)h(to)g(ha)-31 b(v)g(e)0 16486 y(m)g(ultiple)521 b(v)-61 b(ariables)518 b(with)i(the)e(same)g (name)h(as)f(long)i(as)e(they)g(are)g(not)h(in)f(the)h(same)0 17841 y(function.)0 20599 y(The)394 b(stac)-31 b(k)395 b(diagram)h(for)e(this)g(program)h(sho)-31 b(ws)395 b(that)g(the)f(t) -31 b(w)g(o)396 b(v)-61 b(ariables)394 b(named)h Fk(i)f Fn(are)0 21954 y(not)307 b(the)f(same)g(v)-61 b(ariable.)472 b(They)307 b(can)f(refer)f(to)h(di\256eren)-31 b(t)306 b(v)-61 b(alues,)319 b(and)306 b(c)-31 b(hanging)308 b(one)e(do)31 b(es)0 23309 y(not)370 b(a\256ect)g(the)f(other.)6762 24473 y 14603550 6643957 0 0 14603550 6643957 startTexFig 6762 24473 a %%BeginDocument: illustrations/stack4.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: stack4.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Fri Dec 14 14:02:13 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 222 101 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 101 moveto 0 0 lineto 222 0 lineto 222 101 lineto closepath clip newpath -40.0 145.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 1800 1725 m 4350 1725 l 4350 2400 l 1800 2400 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1800 750 m 4350 750 l 4350 1575 l 1800 1575 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline [15 45] 45 sd n 2175 1125 m 2550 1125 l gs col0 s gr [] 0 sd % Polyline [15 45] 45 sd n 2175 1125 m 2550 900 l gs col0 s gr [] 0 sd % Polyline gs clippath 2547 1383 m 2578 1331 l 2448 1253 l 2536 1341 l 2417 1304 l cp eoclip n 2175 1125 m 2550 1350 l gs col0 s gr gr % arrowhead n 2417 1304 m 2536 1341 l 2448 1253 l col0 s /Helvetica ff 165.00 scf sf 2100 1200 m gs 1 -1 sc (i) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2625 1200 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 2625 975 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 2625 1425 m gs 1 -1 sc (3) col0 sh gr % Polyline gs clippath 2565 2130 m 2565 2070 l 2413 2070 l 2533 2100 l 2413 2130 l cp eoclip n 2175 2100 m 2550 2100 l gs col0 s gr gr % arrowhead n 2413 2130 m 2533 2100 l 2413 2070 l col0 s % Polyline [15 45] 45 sd n 3300 2100 m 3675 1875 l gs col0 s gr [] 0 sd % Polyline gs clippath 3690 2130 m 3690 2070 l 3538 2070 l 3658 2100 l 3538 2130 l cp eoclip n 3300 2100 m 3675 2100 l gs col0 s gr gr % arrowhead n 3538 2130 m 3658 2100 l 3538 2070 l col0 s /Helvetica ff 165.00 scf sf 2100 2175 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2625 2175 m gs 1 -1 sc (3) col0 sh gr /Helvetica ff 165.00 scf sf 3225 2175 m gs 1 -1 sc (i) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3750 2175 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 3750 1950 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 675 975 m gs 1 -1 sc (printMultTable) col0 sh gr /Helvetica ff 165.00 scf sf 750 1950 m gs 1 -1 sc (printMultiples) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 38292 a Fn(The)348 b(v)-61 b(alue)348 b(of)g Fk(i)f Fn(in)h Fk(printMultTable)h Fn(go)31 b(es)348 b(from)g(1)g(to)g(6.)486 b(In)347 b(the)h(diagram)h(it)f(happ)31 b(ens)0 39647 y(to)426 b(b)31 b(e)424 b(3.)661 b(The)425 b(next)g(time)i(through)e (the)h(lo)31 b(op)426 b(it)f(will)i(b)31 b(e)425 b(4.)660 b(Eac)-31 b(h)426 b(time)g(through)g(the)0 41002 y(lo)31 b(op,)382 b Fk(printMultTable)e Fn(calls)f Fk(printMultiples)h Fn(with)g(the)e(curren)-31 b(t)378 b(v)-61 b(alue)379 b(of)f Fk(i)h Fn(as)f(an)0 42357 y(argumen)-31 b(t.)494 b(That)371 b(v)-61 b(alue)369 b(gets)h(assigned)f(to)h(the)g(parameter) g Fk(n)p Fn(.)0 45115 y(Inside)480 b Fk(printMultiples)p Fn(,)512 b(the)481 b(v)-61 b(alue)481 b(of)g Fk(i)g Fn(go)31 b(es)481 b(from)g(1)g(to)h(6.)828 b(In)480 b(the)h(diagram,)511 b(it)0 46470 y(happ)31 b(ens)514 b(to)i(b)31 b(e)514 b(2.)929 b(Changing)517 b(this)e(v)-61 b(ariable)515 b(has)g(no)g(e\256ect)f(on)h(the)g(v)-61 b(alue)515 b(of)g Fk(i)g Fn(in)0 47825 y Fk(printMultTable)p Fn(.)0 50584 y(It)355 b(is)g(common)i(and)f(p)31 b(erfectly)355 b(legal)i(to)f(ha) -31 b(v)g(e)357 b(di\256eren)-31 b(t)355 b(lo)31 b(cal)357 b(v)-61 b(ariables)356 b(with)g(the)g(same)0 51938 y(name.)614 b(In)409 b(particular,)421 b(names)409 b(lik)-31 b(e)411 b Fk(i)e Fn(and)h Fk(j)f Fn(are)g(used)g(frequen)-31 b(tly)410 b(as)g(lo)31 b(op)410 b(v)-61 b(ariables.)0 53293 y(If)347 b(y)-31 b(ou)349 b(a)-31 b(v)g(oid)349 b(using)f(them)h(in)f(one)g(function)h(just)f(b)31 b(ecause)347 b(y)-31 b(ou)348 b(used)f(them)i(somewhere)0 54648 y(else,)370 b(y)-31 b(ou)369 b(will)i(probably)g(mak)-31 b(e)370 b(the)f(program)h(harder)f(to)h(read.)p eop %%Page: 68 94 68 93 bop 0 -2070 a Fv(68)32021 b(Iteration)p 0 -1627 38191 45 v 0 865 a Fl(6.8)1793 b(More)598 b(generalization)0 3246 y Fn(As)265 b(another)g(example)i(of)e(generalization,)290 b(imagine)267 b(y)-31 b(ou)266 b(w)-31 b(an)g(ted)266 b(a)f(program)h(that)g(w)-31 b(ould)0 4601 y(prin)g(t)357 b(a)g(m)-31 b(ultiplication)362 b(table)c(of)f(an)-31 b(y)358 b(size,)h(not)f(just)f(the)g(six-b)-31 b(y-six)357 b(table.)490 b(Y)-92 b(ou)357 b(could)0 5956 y(add)369 b(a)h(parameter)g(to)g Fk(printMultTable)p Fn(:)0 8085 y Fk(def)582 b(printMultTable\(high\):)1162 9440 y(i)g(=)f(1)1162 10795 y(while)h(i)f(<=)h(high:)2325 12150 y(printMultiples\(i\))2325 13504 y(i)f(=)g(i)g(+)h(1)0 15633 y Fn(W)-92 b(e)402 b(replaced)i(the)f(v)-61 b(alue)404 b(6)g(with)g(the)g(parameter)g Fk(high)p Fn(.)595 b(If)403 b(w)-31 b(e)404 b(call)g Fk(printMultTable)0 16988 y Fn(with)370 b(the)g(argumen)-31 b(t)371 b(7,)e(it)h(displa)-31 b(ys:)0 19117 y Fk(1)3487 b(2)g(3)g(4)g(5)g(6)0 20471 y(2)g(4)g(6)g(8)g(10)2906 b(12)0 21826 y(3)3487 b(6)g(9)g(12)2906 b(15)g(18)0 23181 y(4)3487 b(8)g(12)2906 b(16)g(20)g(24)0 24536 y(5)3487 b(10)2906 b(15)g(20)g(25)g(30)0 25891 y(6)3487 b(12)2906 b(18)g(24)g(30)g(36)0 27246 y(7)3487 b(14)2906 b(21)g(28)g(35)g(42)0 29375 y Fn(This)481 b(is)g(\257ne,)510 b(except)481 b(that)h(w)-31 b(e)482 b(probably)g(w)-31 b(an)g(t)483 b(the)e(table)h(to)g(b)31 b(e)481 b(square|with)h(the)0 30730 y(same)414 b(n)-31 b(um)g(b)31 b(er)413 b(of)h(ro)-31 b(ws)413 b(and)h(columns.)626 b(T)-92 b(o)414 b(do)f(that,)427 b(w)-31 b(e)413 b(add)h(another)g (parameter)g(to)0 32084 y Fk(printMultiples)371 b Fn(to)f(sp)31 b(ecify)369 b(ho)-31 b(w)370 b(man)-31 b(y)371 b(columns)f(the)f(table) i(should)e(ha)-31 b(v)g(e.)0 34132 y(Just)371 b(to)i(b)31 b(e)371 b(anno)-31 b(ying,)375 b(w)-31 b(e)372 b(call)h(this)f (parameter)g Fk(high)p Fn(,)h(demonstrating)h(that)f(di\256eren)-31 b(t)0 35487 y(functions)436 b(can)g(ha)-31 b(v)g(e)437 b(parameters)e(with)i(the)f(same)g(name)g(\(just)g(lik)-31 b(e)436 b(lo)31 b(cal)437 b(v)-61 b(ariables\).)0 36842 y(Here's)369 b(the)g(whole)i(program:)0 38970 y Fk(def)582 b(printMultiples\(n,)h(high\):)1162 40325 y(i)f(=)f(1)1162 41680 y(while)h(i)f(<=)h(high:)2325 43035 y(print)f(n*i,)h('\\t',)2325 44390 y(i)f(=)g(i)g(+)h(1)1162 45745 y(print)0 48455 y(def)g(printMultTable\(high\):)1162 49810 y(i)g(=)f(1)1162 51165 y(while)h(i)f(<=)h(high:)2325 52520 y(printMultiples\(i,)h (high\))2325 53875 y(i)e(=)g(i)g(+)h(1)0 56003 y Fn(Notice)355 b(that)g(when)f(w)-31 b(e)354 b(added)g(a)f(new)h(parameter,)k(w)-31 b(e)354 b(had)g(to)h(c)-31 b(hange)354 b(the)g(\257rst)f(line)h(of)0 57358 y(the)345 b(function)h(\(the)f(function)h(heading\),)351 b(and)345 b(w)-31 b(e)345 b(also)g(had)g(to)g(c)-31 b(hange)345 b(the)g(place)g(where)p eop %%Page: 69 95 69 94 bop 0 -2070 a Fv(6.9)425 b(F)-106 b(unctions)29497 b(69)p 0 -1627 38191 45 v 0 865 a Fn(the)369 b(function)i(is)e(called)i (in)e Fk(printMultTable)p Fn(.)0 2976 y(As)g(exp)31 b(ected,)370 b(this)f(program)h(generates)g(a)f(square)g(sev)-31 b(en-b)g(y-sev)g (en)370 b(table:)0 5168 y Fk(1)3487 b(2)g(3)g(4)g(5)g(6)g(7)0 6523 y(2)g(4)g(6)g(8)g(10)2906 b(12)g(14)0 7878 y(3)3487 b(6)g(9)g(12)2906 b(15)g(18)g(21)0 9233 y(4)3487 b(8)g(12)2906 b(16)g(20)g(24)g(28)0 10587 y(5)3487 b(10)2906 b(15)g(20)g(25)g(30)g (35)0 11942 y(6)3487 b(12)2906 b(18)g(24)g(30)g(36)g(42)0 13297 y(7)3487 b(14)2906 b(21)g(28)g(35)g(42)g(49)0 15489 y Fn(When)474 b(y)-31 b(ou)475 b(generalize)h(a)e(function)i (appropriately)-92 b(,)503 b(y)-31 b(ou)475 b(often)h(get)f(a)f (program)i(with)0 16844 y(capabilities)370 b(y)-31 b(ou)369 b(didn't)g(plan.)493 b(F)-92 b(or)367 b(example,)i(y)-31 b(ou)369 b(migh)-31 b(t)370 b(notice)e(that,)i(b)31 b(ecause)367 b Fg(ab)308 b Fn(=)0 18199 y Fg(ba)p Fn(,)328 b(all)317 b(the)g(en)-31 b(tries)317 b(in)g(the)g(table)g(app)31 b(ear)317 b(t)-31 b(wice.)477 b(Y)-92 b(ou)316 b(could)i(sa)-31 b(v)g(e)317 b(ink)g(b)-31 b(y)317 b(prin)-31 b(ting)318 b(only)0 19554 y(half)303 b(the)g(table.)471 b(T)-92 b(o)303 b(do)f(that,)318 b(y)-31 b(ou)303 b(only)g(ha)-31 b(v)g(e)303 b(to)g(c)-31 b(hange)303 b(one)g(line)g(of)g Fk(printMultTable)p Fn(.)0 20909 y(Change)2325 23101 y Fk(printMultiples\(i,)583 b(high\))0 25293 y Fn(to)2325 27484 y Fk(printMultiples\(i,)g(i\))0 29676 y Fn(and)369 b(y)-31 b(ou)370 b(get)0 31868 y Fk(1)0 33223 y(2)3487 b(4)0 34578 y(3)g(6)g(9)0 35933 y(4)g(8)g(12)2906 b(16)0 37288 y(5)3487 b(10)2906 b(15)g(20)g(25)0 38643 y(6)3487 b(12)2906 b(18)g(24)g(30)g(36)0 39998 y(7)3487 b(14)2906 b(21)g(28)g(35)g(42)g(49)2767 42569 y Fm(As)1186 b(an)h(exer)-57 b(cise,)1385 b(tr)-57 b(ac)g(e)1187 b(the)f(exe)-57 b(cution)1188 b(of)e(this)h(version)f(of)2767 43924 y Fk(printMultTable)399 b Fm(and)c(\257gur)-57 b(e)398 b(out)d(how)g(it)i(works.)0 48359 y Fl(6.9)1793 b(F)-149 b(unctions)0 50803 y Fn(A)446 b(few)h(times)g(no)-31 b(w,)467 b(w)-31 b(e)447 b(ha)-31 b(v)g(e)447 b(men)-31 b(tioned)448 b(\\all)g(the)e(things)i(functions)f (are)f(go)31 b(o)g(d)447 b(for.")0 52158 y(By)353 b(no)-31 b(w,)357 b(y)-31 b(ou)354 b(migh)-31 b(t)354 b(b)31 b(e)353 b(w)-31 b(ondering)354 b(what)g(exactly)g(those)f(things)h(are.)487 b(Here)352 b(are)h(some)0 53513 y(of)370 b(them:)1660 56003 y Fj(\262)554 b Fn(Giving)361 b(a)f(name)h(to)g(a)f(sequence)f (of)h(statemen)-31 b(ts)362 b(mak)-31 b(es)361 b(y)-31 b(our)360 b(program)g(easier)g(to)2767 57358 y(read)369 b(and)h(debug.)p eop %%Page: 70 96 70 95 bop 0 -2070 a Fv(70)32021 b(Iteration)p 0 -1627 38191 45 v 1660 865 a Fj(\262)554 b Fn(Dividing)321 b(a)e(long)h (program)f(in)-31 b(to)320 b(functions)g(allo)-31 b(ws)321 b(y)-31 b(ou)319 b(to)h(separate)f(parts)f(of)i(the)2767 2220 y(program,)371 b(debug)e(them)h(in)g(isolation,)i(and)e(then)f (comp)31 b(ose)370 b(them)g(in)-31 b(to)370 b(a)g(whole.)1660 4249 y Fj(\262)554 b Fn(F)-92 b(unctions)370 b(facilitate)i(b)31 b(oth)370 b(recursion)f(and)g(iteration.)1660 6279 y Fj(\262)554 b Fn(W)-92 b(ell-designed)484 b(functions)h(are)e(often)h (useful)f(for)h(man)-31 b(y)484 b(programs.)835 b(Once)483 b(y)-31 b(ou)2767 7634 y(write)370 b(and)g(debug)f(one,)h(y)-31 b(ou)370 b(can)f(reuse)g(it.)0 11826 y Fl(6.10)1792 b(Glossary)0 13764 y Fv(m)-35 b(ultiple)424 b(assignmen)-35 b(t:)553 b Fn(Making)277 b(more)e(than)h(one)g(assignmen)-31 b(t)277 b(to)f(the)f(same)h(v)-61 b(ariable)2767 15119 y(during)370 b(the)f(execution)i(of)f(a)f(program.)0 17148 y Fv(iteration:)554 b Fn(Rep)31 b(eated)439 b(execution)h(of)f(a)g(set)g(of)h(statemen)-31 b(ts)440 b(using)f(either)g(a)g(recursiv)-31 b(e)2767 18503 y(function)371 b(call)f(or)f(a)h(lo)31 b(op.)0 20532 y Fv(lo)k(op:)554 b Fn(A)387 b(statemen)-31 b(t)390 b(or)d(group)g(of)h(statemen)-31 b(ts)389 b(that)f(execute)g(rep)31 b(eatedly)388 b(un)-31 b(til)389 b(a)e(ter-)2767 21887 y(minating)372 b(condition)g(is)d(satis\257ed.)0 23917 y Fv(in\257nite)425 b(lo)35 b(op:)554 b Fn(A)369 b(lo)31 b(op)370 b(in)g(whic)-31 b(h)370 b(the)f(terminating)j(condition)g(is)d (nev)-31 b(er)369 b(satis\257ed.)0 25946 y Fv(b)35 b(o)g(dy:)555 b Fn(The)369 b(statemen)-31 b(ts)371 b(inside)e(a)h(lo)31 b(op.)0 27975 y Fv(lo)k(op)426 b(v)-71 b(ariable:)553 b Fn(A)358 b(v)-61 b(ariable)359 b(used)f(as)g(part)h(of)g(the)f (terminating)j(condition)g(of)e(a)f(lo)31 b(op.)0 30005 y Fv(tab:)553 b Fn(A)433 b(sp)31 b(ecial)433 b(c)-31 b(haracter)434 b(that)g(causes)e(the)h(cursor)f(to)h(mo)-31 b(v)g(e)434 b(to)g(the)f(next)g(tab)h(stop)2767 31360 y(on)370 b(the)f(curren)-31 b(t)369 b(line.)0 33389 y Fv(newline:)554 b Fn(A)390 b(sp)31 b(ecial)391 b(c)-31 b(haracter)390 b(that)h(causes)f(the)g(cursor)f(to)i(mo)-31 b(v)g(e)391 b(to)g(the)g(b)31 b(eginning)2767 34744 y(of)370 b(the)g(next)f(line.)0 36773 y Fv(cursor:)554 b Fn(An)400 b(in)-31 b(visible)402 b(mark)-31 b(er)400 b(that)h(k)-31 b(eeps)400 b(trac)-31 b(k)400 b(of)h(where)e(the)h(next)h(c)-31 b(haracter)400 b(will)2767 38128 y(b)31 b(e)369 b(prin)-31 b(ted.)0 40157 y Fv(escap)35 b(e)426 b(sequence:)554 b Fn(An)385 b(escap)31 b(e)384 b(c)-31 b(haracter)385 b(\()p Fj(n)p Fn(\))h(follo)-31 b(w)g(ed)388 b(b)-31 b(y)385 b(one)g(or)f(more)h(prin)-31 b(table)2767 41512 y(c)g(haracters)370 b(used)e(to)i(designate)h(a)e(nonprin)-31 b(table)371 b(c)-31 b(haracter.)0 43542 y Fv(encapsulate:)554 b Fn(T)-92 b(o)402 b(divide)g(a)g(large)h(complex)g(program)f(in)-31 b(to)403 b(comp)31 b(onen)-31 b(ts)403 b(\(lik)-31 b(e)403 b(func-)2767 44897 y(tions\))250 b(and)e(isolate)i(the)f(comp)31 b(onen)-31 b(ts)249 b(from)g(eac)-31 b(h)248 b(other)h(\(b)-31 b(y)249 b(using)f(lo)31 b(cal)250 b(v)-61 b(ariables,)2767 46252 y(for)370 b(example\).)0 48281 y Fv(generalize:)554 b Fn(T)-92 b(o)336 b(replace)f(something)i(unnecessarily)e(sp)31 b(eci\257c)334 b(\(lik)-31 b(e)337 b(a)e(constan)-31 b(t)337 b(v)-61 b(alue\))2767 49636 y(with)315 b(something)g (appropriately)g(general)f(\(lik)-31 b(e)315 b(a)f(v)-61 b(ariable)314 b(or)f(parameter\).)476 b(Gen-)2767 50991 y(eralization)319 b(mak)-31 b(es)317 b(co)31 b(de)316 b(more)h(v)-31 b(ersatile,)328 b(more)317 b(lik)-31 b(ely)318 b(to)f(b)31 b(e)315 b(reused,)326 b(and)317 b(some-)2767 52346 y(times)370 b(ev)-31 b(en)370 b(easier)f(to)h(write.)0 54375 y Fv(dev)-35 b(elopmen)g(t)426 b(plan:)552 b Fn(A)402 b(pro)31 b(cess)400 b(for)h(dev)-31 b(eloping)403 b(a)f(program.)589 b(In)401 b(this)g(c)-31 b(hapter,)410 b(w)-31 b(e)2767 55730 y(demonstrated)343 b(a)f(st)-31 b(yle)342 b(of)g(dev)-31 b(elopmen)g(t)344 b(based)e(on)f(dev)-31 b(eloping)344 b(co)31 b(de)341 b(to)i(do)f(sim-)2767 57085 y(ple,)370 b(sp)31 b(eci\257c)369 b(things)h(and)g(then)f(encapsulating)i(and)f (generalizing.)p eop %%Page: 71 97 71 96 bop 0 9915 a Fi(Chapter)861 b(7)0 16209 y Fo(Strings)0 23361 y Fl(7.1)1793 b(A)598 b(comp)50 b(ound)598 b(data)g(t)-50 b(yp)50 b(e)0 25742 y Fn(So)394 b(far)h(w)-31 b(e)394 b(ha)-31 b(v)g(e)395 b(seen)f(three)g(t)-31 b(yp)31 b(es:)543 b Fk(int)p Fn(,)401 b Fk(float)p Fn(,)g(and)395 b Fk(string)p Fn(.)568 b(Strings)395 b(are)e(qualita-)0 27097 y(tiv)-31 b(ely)314 b(di\256eren)-31 b(t)313 b(from)f(the)h(other)f(t)-31 b(w)g(o)314 b(b)31 b(ecause)312 b(they)g(are)g(made)h(up)f(of)h (smaller)g(pieces|)0 28452 y(c)-31 b(haracters.)0 30499 y(T)g(yp)31 b(es)479 b(that)g(comprise)g(smaller)h(pieces)e(are)h (called)g Fv(comp)35 b(ound)552 b(data)e(t)-35 b(yp)35 b(es)p Fn(.)822 b(De-)0 31854 y(p)31 b(ending)354 b(on)g(what)h(w)-31 b(e)355 b(are)e(doing,)359 b(w)-31 b(e)354 b(ma)-31 b(y)355 b(w)-31 b(an)g(t)356 b(to)e(treat)h(a)f(comp)31 b(ound)355 b(data)g(t)-31 b(yp)31 b(e)354 b(as)0 33209 y(a)369 b(single)i(thing,)f (or)f(w)-31 b(e)370 b(ma)-31 b(y)371 b(w)-31 b(an)g(t)370 b(to)g(access)f(its)h(parts.)492 b(This)370 b(am)-31 b(biguit)g(y)372 b(is)e(useful.)0 35257 y(The)f(brac)-31 b(k)g(et)371 b(op)31 b(erator)369 b(selects)h(a)f(single)h(c)-31 b(haracter)370 b(from)g(a)f(string.)0 37385 y Fk(>>>)582 b(fruit)f(=)h("banana")0 38740 y(>>>)g(letter)g(=)f(fruit[1])0 40095 y(>>>)h(print)f(letter)0 42223 y Fn(The)363 b(expression)f Fk(fruit[1])h Fn(selects)f(c)-31 b(haracter)363 b(n)-31 b(um)g(b)31 b(er)362 b(1)h(from)g Fk(fruit)p Fn(.)490 b(The)363 b(v)-61 b(ariable)0 43578 y Fk(letter)370 b Fn(refers)e(to)i(the)f(result.)493 b(When)368 b(w)-31 b(e)370 b(displa)-31 b(y)371 b Fk(letter)p Fn(,)f(w)-31 b(e)370 b(get)g(a)f(surprise:)0 45706 y Fk(a)0 47835 y Fn(The)421 b(\257rst)g(letter)g(of)h Fk("banana")g Fn(is)f(not)g Fk(a)p Fn(.)648 b(Unless)421 b(y)-31 b(ou)422 b(are)e(a)i(computer)f(scien)-31 b(tist.)649 b(In)0 49190 y(that)428 b(case)f(y)-31 b(ou)428 b(should)f(think)h(of)f(the)h (expression)e(in)h(brac)-31 b(k)g(ets)428 b(as)f(an)g(o\256set)g(from)h (the)0 50545 y(b)31 b(eginning)376 b(of)g(the)f(string,)j(and)d(the)h (o\256set)f(of)g(the)h(\257rst)e(letter)i(is)f(zero.)510 b(So)376 b Fk(b)f Fn(is)g(the)g(0th)0 51900 y(letter)341 b(\(\\zero-eth"\))i(of)e Fk("banana")p Fn(,)348 b Fk(a)340 b Fn(is)g(the)h(1th)g(letter)h(\(\\one-eth"\),)349 b(and)341 b Fk(n)f Fn(is)g(the)h(2th)0 53255 y(\(\\t)-31 b(w)g(o-eth"\))373 b(letter.)0 55302 y(T)-92 b(o)464 b(get)g(the)f(\257rst)g(letter)h(of)g (a)g(string,)487 b(y)-31 b(ou)464 b(just)g(put)f(0,)488 b(or)463 b(an)-31 b(y)464 b(expression)f(with)i(the)0 56657 y(v)-61 b(alue)370 b(0,)g(in)f(the)g(brac)-31 b(k)g(ets:)p eop %%Page: 72 98 72 97 bop 0 -2070 a Fv(72)32992 b(Strings)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(letter)g(=)f(fruit[0])0 2220 y(>>>)h(print)f(letter)0 3575 y(b)0 5724 y Fn(The)268 b(expression)g(in)h(brac)-31 b(k)g(ets)268 b(is)g(called)i(an)e Fv(index)p Fn(.)459 b(An)268 b(index)h(sp)31 b(eci\257es)267 b(a)i(mem)-31 b(b)31 b(er)268 b(of)h(an)0 7079 y(ordered)364 b(set,)j(in)e(this)g(case)g(the)g(set)g(of)h(c)-31 b(haracters)365 b(in)g(the)h(string.)491 b(The)366 b(index)f Fm(indic)-57 b(ates)0 8434 y Fn(whic)-31 b(h)370 b(one)g(y)-31 b(ou)369 b(w)-31 b(an)g(t,)372 b(hence)d(the)g(name.)494 b(It)369 b(can)g(b)31 b(e)369 b(an)-31 b(y)370 b(in)-31 b(teger)370 b(expression.)0 12809 y Fl(7.2)1793 b(Length)0 15211 y Fn(The)369 b Fk(len)h Fn(function)g(returns)f(the)g(n)-31 b(um)g(b)31 b(er)369 b(of)h(c)-31 b(haracters)369 b(in)h(a)f(string:)0 17361 y Fk(>>>)582 b(fruit)f(=)h("banana")0 18716 y(>>>)g(len\(fruit\)) 0 20071 y(6)0 22220 y Fn(T)-92 b(o)426 b(get)h(the)f(last)h(letter)f (of)h(a)f(string,)441 b(y)-31 b(ou)426 b(migh)-31 b(t)428 b(b)31 b(e)426 b(tempted)h(to)f(try)g(something)i(lik)-31 b(e)0 23575 y(this:)0 25724 y Fk(length)582 b(=)f(len\(fruit\))0 27079 y(last)h(=)f(fruit[length])4070 b(#)581 b(ERROR!)0 29229 y Fn(That)504 b(w)-31 b(on't)506 b(w)-31 b(ork.)895 b(It)504 b(causes)e(the)i(run)-31 b(time)504 b(error)e Fk(IndexError:)1164 b(string)582 b(index)0 30584 y(out)g(of)f(range)p Fn(.)490 b(The)359 b(reason)g(is)g(that)h(there)e(is)h(no)h(6th)f (letter)h(in)f Fk("banana")p Fn(.)490 b(Since)359 b(w)-31 b(e)0 31938 y(started)439 b(coun)-31 b(ting)440 b(at)f(zero,)455 b(the)439 b(six)f(letters)h(are)f(n)-31 b(um)g(b)31 b(ered)438 b(0)g(to)h(5.)700 b(T)-92 b(o)439 b(get)g(the)f(last)0 33293 y(c)-31 b(haracter,)370 b(w)-31 b(e)370 b(ha)-31 b(v)g(e)370 b(to)g(subtract)g(1)f(from)h Fk(length)p Fn(:)0 35443 y Fk(length)582 b(=)f(len\(fruit\))0 36798 y(last)h(=)f(fruit[length-1])0 38947 y Fn(Alternativ)-31 b(ely)-92 b(,)371 b(w)-31 b(e)368 b(can)f(use)g(negativ)-31 b(e)369 b(indices,)f(whic)-31 b(h)368 b(coun)-31 b(t)368 b(bac)-31 b(kw)g(ard)369 b(from)f(the)f(end)0 40302 y(of)322 b(the)g(string.)477 b(The)322 b(expression)f Fk(fruit[-1])i Fn(yields)f(the)g(last)g(letter,)333 b Fk(fruit[-2])322 b Fn(yields)0 41657 y(the)369 b(second)g(to)h(last,)h(and)e(so)h(on.)0 46032 y Fl(7.3)1793 b(T)-149 b(ra)-50 b(v)g(ersal)599 b(and)f(the)h Fe(for)f Fl(lo)50 b(op)0 48434 y Fn(A)306 b(lot)i(of)f(computations)i(in)-31 b(v)g(olv)g(e)309 b(pro)31 b(cessing)306 b(a)g(string)h(one)g(c)-31 b(haracter)307 b(at)g(a)f(time.)473 b(Often)0 49789 y(they)427 b(start)f(at)h(the)f(b) 31 b(eginning,)443 b(select)426 b(eac)-31 b(h)427 b(c)-31 b(haracter)426 b(in)h(turn,)440 b(do)427 b(something)h(to)f(it,)0 51144 y(and)456 b(con)-31 b(tin)g(ue)456 b(un)-31 b(til)457 b(the)f(end.)750 b(This)456 b(pattern)g(of)g(pro)31 b(cessing)455 b(is)g(called)i(a)e Fv(tra)-35 b(v)g(ersal)p Fn(.)0 52499 y(One)369 b(w)-31 b(a)g(y)371 b(to)f(enco)31 b(de)369 b(a)g(tra)-31 b(v)g(ersal)371 b(is)e(with)h(a)g Fk(while)f Fn(statemen)-31 b(t:)0 54648 y Fk(index)582 b(=)f(0)0 56003 y(while)h(index)g(<)f(len\(fruit\):)1162 57358 y(letter)h(=)g(fruit[index])1162 58713 y(print)g(letter)1162 60068 y(index)g(=)f(index)h(+)g(1)p eop %%Page: 73 99 73 98 bop 0 -2070 a Fv(7.3)425 b(T)-106 b(ra)-35 b(v)g(ersal)423 b(and)i(the)g Fk(for)g Fv(lo)35 b(op)20132 b(73)p 0 -1627 38191 45 v 0 865 a Fn(This)412 b(lo)31 b(op)413 b(tra)-31 b(v)g(erses)412 b(the)g(string)g(and)g(displa)-31 b(ys)413 b(eac)-31 b(h)412 b(letter)h(on)f(a)g(line)h(b)-31 b(y)412 b(itself.)622 b(The)0 2220 y(lo)31 b(op)443 b(condition)h(is)f Fk(index)581 b(<)h(len\(fruit\))p Fn(,)462 b(so)442 b(when)g Fk(index)h Fn(is)f(equal)h(to)g(the)g(length)0 3575 y(of)423 b(the)h(string,)437 b(the)423 b(condition)i(is)e(false,)438 b(and)423 b(the)g(b)31 b(o)g(dy)423 b(of)g(the)h(lo)31 b(op)423 b(is)g(not)h(executed.)0 4930 y(The)417 b(last)h(c)-31 b(haracter)417 b(accessed)g(is)f(the)i(one)f(with)h(the)f(index)g Fk(len\(fruit\)-1)p Fn(,)431 b(whic)-31 b(h)418 b(is)0 6285 y(the)369 b(last)i(c)-31 b(haracter)369 b(in)h(the)f(string.)2767 9162 y Fm(As)405 b(an)h(exer)-57 b(cise,)409 b(write)c(a)h(function)h (that)d(takes)h(a)h(string)f(as)g(an)h(ar)-57 b(gument)2767 10517 y(and)396 b(outputs)f(the)h(letters)f(b)-57 b(ackwar)g(d,)397 b(one)f(p)-57 b(er)396 b(line.)0 13394 y Fn(Using)413 b(an)g(index)g(to)h(tra)-31 b(v)g(erse)413 b(a)g(set)f(of)h(v)-61 b(alues)413 b(is)g(so)f(common)j(that)f(Python)g(pro)-31 b(vides)0 14749 y(an)369 b(alternativ)-31 b(e,)373 b(simpler)c(syn)-31 b(tax|the)371 b Fk(for)f Fn(lo)31 b(op:)0 17115 y Fk(for)582 b(char)f(in)h(fruit:)1162 18470 y(print)g(char)0 20837 y Fn(Eac)-31 b(h)379 b(time)h(through)f(the)g(lo)31 b(op,)382 b(the)d(next)g(c)-31 b(haracter)379 b(in)g(the)f(string)h(is)g (assigned)f(to)i(the)0 22192 y(v)-61 b(ariable)370 b Fk(char)p Fn(.)493 b(The)370 b(lo)31 b(op)370 b(con)-31 b(tin)g(ues)370 b(un)-31 b(til)371 b(no)e(c)-31 b(haracters)370 b(are)f(left.)0 24477 y(The)376 b(follo)-31 b(wing)379 b(example)e(sho)-31 b(ws)376 b(ho)-31 b(w)376 b(to)h(use)e (concatenation)j(and)e(a)g Fk(for)g Fn(lo)31 b(op)376 b(to)h(gen-)0 25832 y(erate)464 b(an)g(ab)31 b(ecedarian)464 b(series.)775 b(\\Ab)31 b(ecedarian")466 b(refers)c(to)i(a)g(series)f (or)h(list)g(in)g(whic)-31 b(h)0 27187 y(the)325 b(elemen)-31 b(ts)326 b(app)31 b(ear)326 b(in)f(alphab)31 b(etical)328 b(order.)477 b(F)-92 b(or)324 b(example,)336 b(in)326 b(Rob)31 b(ert)325 b(McClosk)-31 b(ey's)0 28542 y(b)31 b(o)g(ok)289 b Fm(Make)322 b(Way)g(for)g(Ducklings)p Fn(,)306 b(the)289 b(names)h(of)f(the)g(duc)-31 b(klings)290 b(are)f(Jac)-31 b(k,)306 b(Kac)-31 b(k,)306 b(Lac)-31 b(k,)0 29896 y(Mac)g(k,)343 b(Nac)-31 b(k,)344 b(Ouac)-31 b(k,)344 b(P)-31 b(ac)g(k,)344 b(and)336 b(Quac)-31 b(k.)482 b(This)336 b(lo)31 b(op)336 b(outputs)h(these)e(names)h(in)g(order:)0 32263 y Fk(prefixes)582 b(=)g("JKLMNOPQ")0 33618 y(suffix)g(=)f("ack")0 36327 y(for)h(letter)g(in)f(prefixes:)1162 37682 y(print)h(letter)g(+)g (suffix)0 40049 y Fn(The)369 b(output)i(of)f(this)f(program)h(is:)0 42415 y Fk(Jack)0 43770 y(Kack)0 45125 y(Lack)0 46480 y(Mack)0 47835 y(Nack)0 49190 y(Oack)0 50544 y(Pack)0 51899 y(Qack)0 54266 y Fn(Of)357 b(course,)i(that's)g(not)e(quite)h (righ)-31 b(t)358 b(b)31 b(ecause)357 b(\\Ouac)-31 b(k")358 b(and)f(\\Quac)-31 b(k")359 b(are)e(missp)31 b(elled.)2767 57143 y Fm(As)396 b(an)g(exer)-57 b(cise,)397 b(mo)-57 b(dify)398 b(the)e(pr)-57 b(o)g(gr)g(am)396 b(to)g(\257x)g(this)f(err) -57 b(or.)p eop %%Page: 74 100 74 99 bop 0 -2070 a Fv(74)32992 b(Strings)p 0 -1627 38191 45 v 0 865 a Fl(7.4)1793 b(String)599 b(slices)0 3439 y Fn(A)363 b(segmen)-31 b(t)363 b(of)g(a)g(string)g(is)g(called)g(a)g Fv(slice)p Fn(.)490 b(Selecting)364 b(a)f(slice)g(is)f(similar)i(to)g (selecting)g(a)0 4794 y(c)-31 b(haracter:)0 7094 y Fk(>>>)582 b(s)f(=)g("Peter,)h(Paul,)g(and)g(Mary")0 8449 y(>>>)g(print)f(s[0:5])0 9804 y(Peter)0 11159 y(>>>)h(print)f(s[7:11])0 12514 y(Paul)0 13869 y(>>>)h(print)f(s[17:21])0 15224 y(Mary)0 17523 y Fn(The)323 b(op)31 b(erator)322 b Fk([n:m])h Fn(returns)f(the)g(part)h(of)g(the)f(string)h(from)g(the)g(\\n-eth")g (c)-31 b(haracter)323 b(to)0 18878 y(the)345 b(\\m-eth")i(c)-31 b(haracter,)351 b(including)346 b(the)f(\257rst)g(but)g(excluding)h (the)f(last.)486 b(This)345 b(b)31 b(eha)-31 b(vior)0 20233 y(is)540 b(coun)-31 b(terin)g(tuitiv)g(e;)629 b(it)540 b(mak)-31 b(es)541 b(more)f(sense)f(if)h(y)-31 b(ou)541 b(imagine)h(the)e(indices)g(p)31 b(oin)-31 b(ting)0 21588 y Fm(b)-57 b(etwe)g(en)370 b Fn(the)g(c)-31 b(haracters,)370 b(as)f(in)g(the)h(follo)-31 b(wing)372 b(diagram:)8206 22967 y 12893224 3354869 0 0 12893224 3354869 startTexFig 8206 22967 a %%BeginDocument: illustrations/banana.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: banana.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Fri Dec 7 16:48:33 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 196 51 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 51 moveto 0 0 lineto 196 0 lineto 196 51 lineto closepath clip newpath -93.0 99.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 1575 825 m 4800 825 l 4800 1350 l 1575 1350 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 2490 1110 m 2490 1050 l 2338 1050 l 2458 1080 l 2338 1110 l cp eoclip n 2100 1080 m 2475 1080 l gs col0 s gr gr % arrowhead n 2338 1110 m 2458 1080 l 2338 1050 l col0 s % Polyline [15 45] 45 sd n 2700 825 m 2700 1500 l gs col0 s gr [] 0 sd % Polyline [15 45] 45 sd n 3000 825 m 3000 1500 l gs col0 s gr [] 0 sd % Polyline [15 45] 45 sd n 3300 825 m 3300 1500 l gs col0 s gr [] 0 sd % Polyline [15 45] 45 sd n 3600 825 m 3600 1500 l gs col0 s gr [] 0 sd % Polyline [15 45] 45 sd n 3900 825 m 3900 1500 l gs col0 s gr [] 0 sd % Polyline [15 45] 45 sd n 4200 825 m 4200 1500 l gs col0 s gr [] 0 sd % Polyline [15 45] 45 sd n 4500 825 m 4500 1500 l gs col0 s gr [] 0 sd /Helvetica ff 165.00 scf sf 2025 1125 m gs 1 -1 sc (fruit) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 330.00 scf sf 2550 1200 m gs 1 -1 sc (") col0 sh gr /Helvetica ff 330.00 scf sf 2775 1200 m gs 1 -1 sc (b) col0 sh gr /Helvetica ff 330.00 scf sf 3075 1200 m gs 1 -1 sc (a) col0 sh gr /Helvetica ff 330.00 scf sf 3375 1200 m gs 1 -1 sc (n) col0 sh gr /Helvetica ff 330.00 scf sf 3975 1200 m gs 1 -1 sc (n) col0 sh gr /Helvetica ff 330.00 scf sf 3675 1200 m gs 1 -1 sc (a) col0 sh gr /Helvetica ff 330.00 scf sf 4275 1200 m gs 1 -1 sc (a) col0 sh gr /Helvetica ff 330.00 scf sf 4575 1200 m gs 1 -1 sc (") col0 sh gr /Helvetica ff 165.00 scf sf 2625 1650 m gs 1 -1 sc (0) col0 sh gr /Helvetica ff 165.00 scf sf 2925 1650 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 3225 1650 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 3525 1650 m gs 1 -1 sc (3) col0 sh gr /Helvetica ff 165.00 scf sf 3825 1650 m gs 1 -1 sc (4) col0 sh gr /Helvetica ff 165.00 scf sf 4125 1650 m gs 1 -1 sc (5) col0 sh gr /Helvetica ff 165.00 scf sf 4425 1650 m gs 1 -1 sc (6) col0 sh gr /Helvetica ff 165.00 scf sf 2025 1650 m gs 1 -1 sc (index) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 30691 a Fn(If)323 b(y)-31 b(ou)324 b(omit)h(the)f(\257rst)e(index)i (\(b)31 b(efore)324 b(the)f(colon\),)335 b(the)323 b(slice)h(starts)f (at)h(the)g(b)31 b(eginning)324 b(of)0 32046 y(the)357 b(string.)489 b(If)356 b(y)-31 b(ou)357 b(omit)i(the)e(second)f(index,) k(the)d(slice)g(go)31 b(es)357 b(to)g(the)g(end)f(of)h(the)g(string.)0 33401 y(Th)-31 b(us:)0 35701 y Fk(>>>)582 b(fruit)f(=)h("banana")0 37056 y(>>>)g(fruit[:3])0 38411 y('ban')0 39766 y(>>>)g(fruit[3:])0 41120 y('ana')0 43420 y Fn(What)370 b(do)f(y)-31 b(ou)370 b(think)g Fk(s[:])493 b Fn(means?)0 48092 y Fl(7.5)1793 b(String)599 b(comparison)0 50666 y Fn(The)369 b(comparison)i(op)31 b(erators)369 b(w)-31 b(ork)370 b(on)g(strings.)492 b(T)-92 b(o)370 b(see)f(if)g(t)-31 b(w)g(o)371 b(strings)f(are)f(equal:)0 52966 y Fk(if)581 b(word)h(==)g("banana":)1162 54321 y(print)1163 b("Yes,)582 b(we)g(have)f(no)h(bananas!")p eop %%Page: 75 101 75 100 bop 0 -2070 a Fv(7.6)425 b(Strings)g(are)g(imm)-35 b(utable)22459 b(75)p 0 -1627 38191 45 v 0 865 a Fn(Other)324 b(comparison)i(op)31 b(erations)325 b(are)f(useful)h(for)f(putting)i(w) -31 b(ords)324 b(in)h(alphab)31 b(etical)327 b(order:)0 3380 y Fk(if)581 b(word)h(<)f("banana":)1162 4735 y(print)h("Your)g (word,")g(+)f(word)h(+)f(",)h(comes)g(before)g(banana.")0 6090 y(elif)g(word)f(>)h("banana":)1162 7445 y(print)g("Your)g(word,")g (+)f(word)h(+)f(",)h(comes)g(after)g(banana.")0 8800 y(else:)1162 10155 y(print)g("Yes,)g(we)g(have)f(no)h(bananas!")0 12670 y Fn(Y)-92 b(ou)270 b(should)h(b)31 b(e)269 b(a)-31 b(w)g(are,)292 b(though,)f(that)272 b(Python)f(do)31 b(es)270 b(not)g(handle)h(upp)31 b(er-)269 b(and)i(lo)-31 b(w)g(ercase)0 14025 y(letters)400 b(the)g(same)g(w)-31 b(a)g(y)401 b(that)f(p)31 b(eople)400 b(do.)584 b(All)401 b(the)f(upp)31 b(ercase)398 b(letters)i(come)g(b)31 b(efore)400 b(all)0 15380 y(the)369 b(lo)-31 b(w)g(ercase)371 b(letters.)493 b(As)369 b(a)g(result:)0 17895 y Fk(Your)582 b(word,)g(Zebra,)g(comes)g (before)g(banana.)0 20411 y Fn(A)528 b(common)h(w)-31 b(a)g(y)530 b(to)e(address)f(this)i(problem)f(is)g(to)h(con)-31 b(v)g(ert)529 b(strings)f(to)g(a)h(standard)0 21765 y(format,)281 b(suc)-31 b(h)256 b(as)g(all)h(lo)-31 b(w)g(ercase,)281 b(b)31 b(efore)256 b(p)31 b(erforming)257 b(the)f(comparison.)457 b(A)256 b(more)g(di\261cult)0 23120 y(problem)370 b(is)f(making)i(the)f (program)g(realize)g(that)g(zebras)f(are)g(not)h(fruit.)0 28438 y Fl(7.6)1793 b(Strings)599 b(are)f(imm)-50 b(utable)0 31314 y Fn(It)338 b(is)g(tempting)i(to)f(use)e(the)i Fk([])f Fn(op)31 b(erator)339 b(on)f(the)g(left)h(side)f(of)h(an)f (assignmen)-31 b(t,)346 b(with)340 b(the)0 32669 y(in)-31 b(ten)g(tion)372 b(of)e(c)-31 b(hanging)371 b(a)e(c)-31 b(haracter)370 b(in)f(a)h(string.)493 b(F)-92 b(or)368 b(example:)0 35184 y Fk(greeting)582 b(=)g("Hello,)g(world!")0 36539 y(greeting[0])h(=)e('J')6974 b(#)582 b(ERROR!)0 37894 y(print)g(greeting)0 40409 y Fn(Instead)267 b(of)g(pro)31 b(ducing)268 b(the)f(output)h Fk(Jello,)582 b(world!)p Fn(,)289 b(this)267 b(co)31 b(de)267 b(pro)31 b(duces)266 b(the)h(run)-31 b(time)0 41764 y(error)368 b Fk(TypeError:)1164 b(object)582 b(doesn't)g(support)g(item)g(assignment)p Fn(.)0 44198 y(Strings)351 b(are)f Fv(imm)-35 b(utable)p Fn(,)354 b(whic)-31 b(h)352 b(means)e(y)-31 b(ou)352 b(can't)f(c)-31 b(hange)352 b(an)f(existing)h(string.)487 b(The)0 45553 y(b)31 b(est)369 b(y)-31 b(ou)370 b(can)f(do)h(is)f (create)g(a)h(new)f(string)h(that)g(is)f(a)h(v)-61 b(ariation)371 b(on)e(the)h(original:)0 48068 y Fk(greeting)582 b(=)g("Hello,)g (world!")0 49423 y(newGreeting)h(=)e('J')h(+)f(greeting[1:])0 50778 y(print)h(newGreeting)0 53293 y Fn(The)391 b(solution)h(here)e (is)g(to)i(concatenate)g(a)f(new)g(\257rst)f(letter)h(on)-31 b(to)392 b(a)f(slice)f(of)h Fk(greeting)p Fn(.)0 54648 y(This)370 b(op)31 b(eration)370 b(has)f(no)h(e\256ect)f(on)g(the)h (original)h(string.)p eop %%Page: 76 102 76 101 bop 0 -2070 a Fv(76)32992 b(Strings)p 0 -1627 38191 45 v 0 865 a Fl(7.7)1793 b(A)598 b Fe(find)g Fl(function)0 3402 y Fn(What)370 b(do)31 b(es)368 b(the)i(follo)-31 b(wing)373 b(function)d(do?)0 5676 y Fk(def)582 b(find\(str,)g(ch\):) 1162 7031 y(index)g(=)f(0)1162 8386 y(while)h(index)g(<)f(len\(str\):) 2325 9741 y(if)g(str[index])i(==)e(ch:)3487 11096 y(return)h(index)2325 12451 y(index)f(=)h(index)g(+)f(1)1162 13806 y(return)h(-1)0 16079 y Fn(In)385 b(a)i(sense,)i Fk(find)e Fn(is)f(the)g(opp)31 b(osite)387 b(of)f(the)g Fk([])g Fn(op)31 b(erator.)544 b(Instead)386 b(of)g(taking)i(an)e(index)0 17434 y(and)421 b(extracting)h(the)e(corresp)31 b(onding)421 b(c)-31 b(haracter,)434 b(it)421 b(tak)-31 b(es)421 b(a)g(c)-31 b(haracter)420 b(and)h(\257nds)f(the)0 18789 y(index)372 b(where)f(that)h(c)-31 b(haracter)372 b(app)31 b(ears.)499 b(If)371 b(the)h(c)-31 b(haracter)372 b(is)f(not)h(found,)h(the)f (function)0 20144 y(returns)c Fk(-1)p Fn(.)0 22337 y(This)404 b(is)g(the)h(\257rst)e(example)j(w)-31 b(e)404 b(ha)-31 b(v)g(e)406 b(seen)d(of)i(a)f Fk(return)h Fn(statemen)-31 b(t)406 b(inside)e(a)h(lo)31 b(op.)598 b(If)0 23692 y Fk(str[index])583 b(==)e(ch)p Fn(,)362 b(the)d(function)h(returns)e (immediately)-92 b(,)364 b(breaking)c(out)g(of)f(the)g(lo)31 b(op)0 25047 y(prematurely)-92 b(.)0 27239 y(If)424 b(the)h(c)-31 b(haracter)425 b(do)31 b(esn't)425 b(app)31 b(ear)424 b(in)h(the)g(string,)439 b(then)424 b(the)h(program)g(exits)g(the)g(lo) 31 b(op)0 28594 y(normally)371 b(and)f(returns)e Fk(-1)p Fn(.)0 30787 y(This)303 b(pattern)g(of)h(computation)h(is)e(sometimes)h (called)g(a)f(\\eurek)-61 b(a")303 b(tra)-31 b(v)g(ersal)304 b(b)31 b(ecause)302 b(as)0 32142 y(so)31 b(on)307 b(as)g(w)-31 b(e)308 b(\257nd)f(what)h(w)-31 b(e)308 b(are)f(lo)31 b(oking)309 b(for,)321 b(w)-31 b(e)307 b(can)h(cry)e(\\Eurek)-61 b(a!")473 b(and)308 b(stop)f(lo)31 b(oking.)2767 34841 y Fm(As)527 b(an)h(exer)-57 b(cise,)562 b(mo)-57 b(dify)529 b(the)e Fk(find)h Fm(function)h(so)e(that)g(it)g(takes)g(a)h(thir)-57 b(d)2767 36196 y(p)g(ar)g(ameter,)397 b(the)f(index)g(in)h(the)f (string)g(wher)-57 b(e)396 b(it)g(should)f(start)g(lo)-57 b(oking.)0 40789 y Fl(7.8)1793 b(Lo)50 b(oping)597 b(and)h(coun)-50 b(ting)0 43326 y Fn(The)478 b(follo)-31 b(wing)482 b(program)d(coun)-31 b(ts)478 b(the)g(n)-31 b(um)g(b)31 b(er)478 b(of)h(times)g(the)f (letter)h Fk(a)f Fn(app)31 b(ears)477 b(in)i(a)0 44681 y(string:)0 46955 y Fk(fruit)582 b(=)f("banana")0 48310 y(count)h(=)f(0)0 49665 y(for)h(char)f(in)h(fruit:)1162 51020 y(if)g(char)f(==)h('a':)2325 52375 y(count)f(=)h(count)g(+)f(1)0 53730 y(print)h(count)0 56003 y Fn(This)389 b(program)h(demonstrates)g (another)g(pattern)g(of)g(computation)i(called)e(a)f Fv(coun)-35 b(ter)p Fn(.)0 57358 y(The)429 b(v)-61 b(ariable)429 b Fk(count)g Fn(is)g(initialized)i(to)f(0)e(and)h(then)g(incremen)-31 b(ted)429 b(eac)-31 b(h)429 b(time)h(an)f Fk(a)f Fn(is)p eop %%Page: 77 103 77 102 bop 0 -2070 a Fv(7.9)425 b(The)g Fk(string)g Fv(mo)35 b(dule)24271 b(77)p 0 -1627 38191 45 v 0 865 a Fn(found.)546 b(\(T)-92 b(o)388 b Fv(incremen)-35 b(t)387 b Fn(is)g(to)h(increase)f (b)-31 b(y)387 b(one;)396 b(it)388 b(is)f(the)g(opp)31 b(osite)388 b(of)f Fv(decremen)-35 b(t)p Fn(,)0 2220 y(and)426 b(unrelated)h(to)g(\\excremen)-31 b(t,")443 b(whic)-31 b(h)427 b(is)f(a)h(noun.\))664 b(When)426 b(the)h(lo)31 b(op)427 b(exits,)441 b Fk(count)0 3575 y Fn(con)-31 b(tains)371 b(the)e(result|the)h(total)h(n)-31 b(um)g(b)31 b(er)369 b(of)h Fk(a)p Fn('s.)2767 6257 y Fm(As)902 b(an)h(exer)-57 b(cise,)1030 b(enc)-57 b(apsulate)903 b(this)f(c)-57 b(o)g(de)903 b(in)h(a)e(function)i(name)-57 b(d)2767 7612 y Fk(countLetters)p Fm(,)557 b(and)522 b(gener)-57 b(alize)524 b(it)f(so)f(that)f(it)i(ac)-57 b(c)g(epts)523 b(the)f(string)h(and)2767 8966 y(the)396 b(letter)g(as)f(p)-57 b(ar)g(ameters.)2767 11648 y(As)340 b(a)g(se)-57 b(c)g(ond)341 b(exer)-57 b(cise,)352 b(r)-57 b(ewrite)340 b(this)g(function)h(so)e(that)h(inste)-57 b(ad)340 b(of)g(tr)-57 b(avers-)2767 13003 y(ing)421 b(the)d(string,)426 b(it)419 b(uses)g(the)g(thr)-57 b(e)g(e-p)g(ar)g (ameter)420 b(version)f(of)g Fk(find)h Fm(fr)-57 b(om)420 b(the)2767 14358 y(pr)-57 b(evious.)0 18925 y Fl(7.9)1793 b(The)598 b Fe(string)h Fl(mo)50 b(dule)0 21450 y Fn(The)284 b Fk(string)h Fn(mo)31 b(dule)284 b(con)-31 b(tains)286 b(useful)e(functions)h(that)g(manipulate)h(strings.)465 b(As)283 b(usual,)0 22805 y(w)-31 b(e)370 b(ha)-31 b(v)g(e)370 b(to)g(imp)31 b(ort)370 b(the)f(mo)31 b(dule)371 b(b)31 b(efore)369 b(w)-31 b(e)369 b(can)h(use)e(it:)0 25070 y Fk(>>>)582 b(import)g(string)0 27334 y Fn(The)394 b Fk(string)f Fn(mo)31 b(dule)395 b(includes)e(a)h(function)h(named)e Fk(find)h Fn(that)h(do)31 b(es)393 b(the)g(same)h(thing)0 28689 y(as)364 b(the)h(function)g(w)-31 b(e)365 b(wrote.)492 b(T)-92 b(o)364 b(call)i(it)f(w)-31 b(e)364 b(ha)-31 b(v)g(e)365 b(to)g(sp)31 b(ecify)365 b(the)f(name)h(of)g(the)f(mo)31 b(dule)0 30044 y(and)369 b(the)h(name)g(of)f(the)h(function)h(using)e (dot)h(notation.)0 32309 y Fk(>>>)582 b(fruit)f(=)h("banana")0 33664 y(>>>)g(index)f(=)h(string.find\(fruit,)i("a"\))0 35019 y(>>>)e(print)f(index)0 36374 y(1)0 38639 y Fn(This)517 b(example)h(demonstrates)f(one)g(of)g(the)g(b)31 b(ene\257ts)516 b(of)h(mo)31 b(dules|they)517 b(help)g(a)-31 b(v)g(oid)0 39994 y(collisions)476 b(b)31 b(et)-31 b(w)g(een)475 b(the)f(names)h(of)f(built-in)i(functions)f(and)f(user-de\257ned)f (functions.)0 41349 y(By)369 b(using)h(dot)g(notation)i(w)-31 b(e)369 b(can)h(sp)31 b(ecify)369 b(whic)-31 b(h)370 b(v)-31 b(ersion)370 b(of)f Fk(find)h Fn(w)-31 b(e)370 b(w)-31 b(an)g(t.)0 43533 y(Actually)-92 b(,)584 b Fk(string.find)540 b Fn(is)f(more)g(general)h(than)f(our)g(v)-31 b(ersion.)1002 b(First,)581 b(it)540 b(can)f(\257nd)0 44887 y(substrings,)369 b(not)h(just)g(c)-31 b(haracters:)0 47152 y Fk(>>>)582 b(string.find\("banana",)i("na"\))0 48507 y(2)0 50772 y Fn(Also,)345 b(it)337 b(tak)-31 b(es)338 b(an)f(additional)k(argumen) -31 b(t)338 b(that)g(sp)31 b(eci\257es)336 b(the)i(index)f(it)h(should) f(start)h(at:)0 53037 y Fk(>>>)582 b(string.find\("banana",)i("na",)e (3\))0 54392 y(4)0 56657 y Fn(Or)369 b(it)g(can)h(tak)-31 b(e)370 b(t)-31 b(w)g(o)371 b(additional)i(argumen)-31 b(ts)370 b(that)g(sp)31 b(ecify)370 b(a)f(range)h(of)f(indices:)p eop %%Page: 78 104 78 103 bop 0 -2070 a Fv(78)32992 b(Strings)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(string.find\("bob",)h("b",)f(1,)g(2\))0 2220 y(-1)0 4435 y Fn(In)483 b(this)i(example,)514 b(the)484 b(searc)-31 b(h)484 b(fails)h(b)31 b(ecause)483 b(the)h(letter)h Fm(b)f Fn(do)31 b(es)483 b(not)i(app)31 b(ear)484 b(in)g(the)0 5790 y(index)370 b(range)f(from)h Fk(1)f Fn(to)h Fk(2)f Fn(\(not)h(including)h Fk(2)p Fn(\).)0 10257 y Fl(7.10)1792 b(Character)599 b(classi\257cation)0 12724 y Fn(It)389 b(is)h(often)g(helpful)h(to)f(examine)h(a)f(c)-31 b(haracter)390 b(and)f(test)h(whether)g(it)g(is)g(upp)31 b(er-)388 b(or)h(lo)-31 b(w-)0 14079 y(ercase,)508 b(or)481 b(whether)g(it)g(is)g(a)g(c)-31 b(haracter)481 b(or)g(a)g(digit.)829 b(The)481 b Fk(string)g Fn(mo)31 b(dule)482 b(pro)-31 b(vides)0 15434 y(sev)g(eral)370 b(constan)-31 b(ts)370 b(that)g(are)f(useful)h(for)f(these)g(purp)31 b(oses.)0 17568 y(The)306 b(string)g Fk(string.lowercase)h Fn(con)-31 b(tains)307 b(all)g(of)f(the)g(letters)g(that)g(the)g (system)g(consid-)0 18922 y(ers)356 b(to)i(b)31 b(e)356 b(lo)-31 b(w)g(ercase.)490 b(Similarly)-92 b(,)363 b Fk(string.uppercase)c Fn(con)-31 b(tains)359 b(all)f(of)f(the)h(upp)31 b(ercase)0 20277 y(letters.)493 b(T)-92 b(ry)369 b(the)h(follo)-31 b(wing)372 b(and)e(see)e(what)j(y)-31 b(ou)370 b(get:)0 22492 y Fk(>>>)582 b(print)f(string.lowercase)0 23847 y(>>>)h(print)f(string.uppercase)0 25202 y(>>>)h(print)f(string.digits) 0 27417 y Fn(W)-92 b(e)481 b(can)h(use)f(these)h(constan)-31 b(ts)483 b(and)f Fk(find)g Fn(to)h(classify)g(c)-31 b(haracters.)830 b(F)-92 b(or)482 b(example,)511 b(if)0 28772 y Fk(find\(lowercase,)583 b(ch\))254 b Fn(returns)e(a)i(v)-61 b(alue)254 b(other)f(than)h Fk(-1)p Fn(,)277 b(then)254 b Fk(ch)f Fn(m)-31 b(ust)254 b(b)31 b(e)253 b(lo)-31 b(w)g(ercase:)0 30987 y Fk(def)582 b(isLower\(ch\):)1162 32341 y(return)g(string.find\(string.lowercase,)k (ch\))581 b(!=)h(-1)0 34556 y Fn(Alternativ)-31 b(ely)-92 b(,)624 b(w)-31 b(e)570 b(can)h(tak)-31 b(e)571 b(adv)-61 b(an)-31 b(tage)572 b(of)f(the)f Fk(in)g Fn(op)31 b(erator,)622 b(whic)-31 b(h)571 b(determines)0 35911 y(whether)369 b(a)h(c)-31 b(haracter)370 b(app)31 b(ears)368 b(in)i(a)f(string:)0 38126 y Fk(def)582 b(isLower\(ch\):)1162 39481 y(return)g(ch)g(in)f (string.lowercase)0 41696 y Fn(As)369 b(y)-31 b(et)370 b(another)g(alternativ)-31 b(e,)372 b(w)-31 b(e)370 b(can)f(use)g(the)g (comparison)i(op)31 b(erator:)0 43910 y Fk(def)582 b(isLower\(ch\):) 1162 45265 y(return)g('a')g(<=)f(ch)h(<=)f('z')0 47480 y Fn(If)369 b Fk(ch)g Fn(is)g(b)31 b(et)-31 b(w)g(een)370 b Fm(a)f Fn(and)h Fm(z)p Fn(,)f(it)h(m)-31 b(ust)370 b(b)31 b(e)368 b(a)i(lo)-31 b(w)g(ercase)370 b(letter.)2767 50036 y Fm(As)437 b(an)g(exer)-57 b(cise,)448 b(discuss)437 b(which)g(version)g(of)g Fk(isLower)i Fm(you)e(think)h(wil)57 b(l)436 b(b)-57 b(e)2767 51391 y(fastest.)662 b(Can)447 b(you)g(think)g(of)h(other)e(r)-57 b(e)g(asons)446 b(b)-57 b(esides)448 b(sp)-57 b(e)g(e)g(d)448 b(to)e(pr)-57 b(efer)447 b(one)2767 52746 y(or)396 b(the)g(other?)0 55302 y Fn(Another)495 b(constan)-31 b(t)495 b(de\257ned)f(in)h(the)f Fk(string)h Fn(mo)31 b(dule)495 b(ma)-31 b(y)495 b(surprise)e(y)-31 b(ou)495 b(when)f(y)-31 b(ou)0 56657 y(prin)g(t)370 b(it:)p eop %%Page: 79 105 79 104 bop 0 -2070 a Fv(7.11)425 b(Glossary)29420 b(79)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(print)f(string.whitespace)0 3111 y Fv(Whitespace)369 b Fn(c)-31 b(haracters)369 b(mo)-31 b(v)g(e)370 b(the)e(cursor)g(without)i(prin)-31 b(ting)370 b(an)-31 b(ything.)495 b(They)369 b(cre-)0 4466 y(ate)420 b(the)g(white)h(space)e(b)31 b(et)-31 b(w)g(een)420 b(visible)h(c)-31 b(haracters)420 b(\(at)g(least)h(on)e(white)i(pap)31 b(er\).)644 b(The)0 5821 y(constan)-31 b(t)382 b Fk(string.whitespace)h Fn(con)-31 b(tains)382 b(all)g(the)f(whitespace)h(c)-31 b(haracters,)384 b(including)0 7176 y(space,)370 b(tab)f(\()p Fk(\\t)p Fn(\),)i(and)f(newline)g(\()p Fk(\\n)p Fn(\).)0 9341 y(There)533 b(are)h(other)g(useful)f(functions)i(in)f(the)g Fk(string)g Fn(mo)31 b(dule,)576 b(but)534 b(this)g(b)31 b(o)g(ok)534 b(isn't)0 10696 y(in)-31 b(tended)508 b(to)f(b)31 b(e)506 b(a)h(reference)f(man)-31 b(ual.)907 b(On)506 b(the)h(other)g(hand,)542 b(the)506 b Fm(Python)523 b(Libr)-57 b(ary)0 12051 y(R)g(efer)g(enc)g(e)431 b Fn(is.)670 b(Along)429 b(with)h(a)e(w)-31 b(ealth)430 b(of)f(other)f(do)31 b(cumen)-31 b(tation,)447 b(it's)429 b(a)-31 b(v)-61 b(ailable)430 b(from)0 13406 y(the)369 b(Python)i(w)-31 b(ebsite,)371 b Fk(www.python.org)p Fn(.)0 17917 y Fl(7.11)1792 b(Glossary)0 20082 y Fv(comp)35 b(ound)426 b(data)e(t)-35 b(yp)35 b(e:)554 b Fn(A)361 b(data)g(t)-31 b(yp)31 b(e)361 b(in)g(whic)-31 b(h)361 b(the)g(v)-61 b(alues)361 b(are)f(made)h(up)f(of)h(com-)2767 21437 y(p)31 b(onen)-31 b(ts,)370 b(or)f(elemen)-31 b(ts,)371 b(that)g(are)e(themselv)-31 b(es)370 b(v)-61 b(alues.)0 23677 y Fv(tra)-35 b(v)g(erse:)554 b Fn(T)-92 b(o)383 b(iterate)i(through)f(the)f(elemen)-31 b(ts)385 b(of)e(a)h(set,)j(p)31 b(erforming)384 b(a)g(similar)g(op)31 b(er-)2767 25032 y(ation)371 b(on)f(eac)-31 b(h.)0 27273 y Fv(index:)553 b Fn(A)391 b(v)-61 b(ariable)391 b(or)e(v)-61 b(alue)391 b(used)e(to)i(select)g(a)f(mem)-31 b(b)31 b(er)390 b(of)h(an)f(ordered) g(set,)395 b(suc)-31 b(h)390 b(as)2767 28628 y(a)370 b(c)-31 b(haracter)370 b(from)f(a)h(string.)0 30868 y Fv(slice:)553 b Fn(A)369 b(part)g(of)h(a)g(string)f(sp)31 b(eci\257ed)369 b(b)-31 b(y)369 b(a)h(range)f(of)h(indices.)0 33109 y Fv(m)-35 b(utable:)553 b Fn(A)324 b(comp)31 b(ound)324 b(data)i(t)-31 b(yp)31 b(es)323 b(whose)i(elemen)-31 b(ts)325 b(can)f(b)31 b(e)323 b(assigned)h(new)g(v)-61 b(alues.)0 35349 y Fv(coun)-35 b(ter:)554 b Fn(A)452 b(v)-61 b(ariable)453 b(used)f(to)h(coun)-31 b(t)453 b(something,)475 b(usually)453 b(initialized)i(to)e(zero)f(and)2767 36704 y(then)370 b(incremen)-31 b(ted.)0 38945 y Fv(incremen)c(t:)554 b Fn(T)-92 b(o)369 b(increase)g(the)h(v)-61 b(alue)369 b(of)h(a)g(v)-61 b(ariable)370 b(b)-31 b(y)369 b(one.)0 41185 y Fv(decremen)-35 b(t:)554 b Fn(T)-92 b(o)370 b(decrease)f(the)g (v)-61 b(alue)370 b(of)g(a)f(v)-61 b(ariable)370 b(b)-31 b(y)370 b(one.)0 43426 y Fv(whitespace:)554 b Fn(An)-31 b(y)361 b(of)g(the)f(c)-31 b(haracters)361 b(that)g(mo)-31 b(v)g(e)362 b(the)e(cursor)g(without)i(prin)-31 b(ting)362 b(vis-)2767 44780 y(ible)349 b(c)-31 b(haracters.)486 b(The)348 b(constan)-31 b(t)349 b Fk(string.whitespace)h Fn(con)-31 b(tains)350 b(all)f(the)f(white-)2767 46135 y(space)369 b(c)-31 b(haracters.)p eop %%Page: 80 106 80 105 bop 0 -2070 a Fv(80)32992 b(Strings)p 0 -1627 38191 45 v eop %%Page: 81 107 81 106 bop 0 10060 a Fi(Chapter)861 b(8)0 16499 y Fo(Lists)0 23119 y Fn(A)447 b Fv(list)f Fn(is)g(an)h(ordered)f(set)h(of)g(v)-61 b(alues,)467 b(where)447 b(eac)-31 b(h)447 b(v)-61 b(alue)447 b(is)g(iden)-31 b(ti\257ed)448 b(b)-31 b(y)447 b(an)g(index.)0 24474 y(The)473 b(v)-61 b(alues)472 b(that)i(mak)-31 b(e)474 b(up)e(a)h(list)h(are)e(called)i(its)f Fv(elemen)-35 b(ts)p Fn(.)803 b(Lists)473 b(are)f(similar)i(to)0 25829 y(strings,)398 b(whic)-31 b(h)393 b(are)f(ordered)f(sets)h(of)g(c)-31 b(haracters,)398 b(except)393 b(that)g(the)f(elemen)-31 b(ts)393 b(of)g(a)f(list)0 27184 y(can)310 b(ha)-31 b(v)g(e)311 b(an)-31 b(y)310 b(t)-31 b(yp)31 b(e.)474 b(Lists)309 b(and)h(strings|and)g(other)h(things)f(that)h(b)31 b(eha)-31 b(v)g(e)311 b(lik)-31 b(e)311 b(ordered)0 28539 y(sets|are)369 b(called)h Fv(sequences)p Fn(.)0 33132 y Fl(8.1)1793 b(List)599 b(v)-100 b(alues)0 35669 y Fn(There)256 b(are)g(sev)-31 b(eral)256 b(w)-31 b(a)g(ys)257 b(to)g(create)f(a)g(new)g(list;)296 b(the)256 b(simplest)h(is)f(to)g(enclose)h(the)f(elemen)-31 b(ts)0 37024 y(in)369 b(square)g(brac)-31 b(k)g(ets)370 b(\()p Fk([)g Fn(and)f Fk(])p Fn(\):)0 39297 y Fk([10,)582 b(20,)f(30,)h(40])0 40652 y(["spam",)g("bungee",)h("swallow"])0 42926 y Fn(The)367 b(\257rst)f(example)i(is)e(a)h(list)h(of)f(four)f (in)-31 b(tegers.)493 b(The)367 b(second)f(is)h(a)f(list)i(of)f(three)f (strings.)0 44280 y(The)277 b(elemen)-31 b(ts)278 b(of)g(a)f(list)h (don't)g(ha)-31 b(v)g(e)278 b(to)f(b)31 b(e)277 b(the)g(same)g(t)-31 b(yp)31 b(e.)463 b(The)277 b(follo)-31 b(wing)281 b(list)c(con)-31 b(tains)0 45635 y(a)369 b(string,)i(a)e(\260oat,)i(an)e(in)-31 b(teger,)371 b(and)f(\(mirabile)h(dictu\))f(another)g(list:)0 47909 y Fk(["hello",)582 b(2.0,)g(5,)g([10,)f(20]])0 50182 y Fn(A)369 b(list)h(within)h(another)f(list)g(is)f(said)h(to)g(b) 31 b(e)369 b Fv(nested)p Fn(.)0 52375 y(Lists)279 b(that)h(con)-31 b(tain)281 b(consecutiv)-31 b(e)280 b(in)-31 b(tegers)280 b(are)e(common,)299 b(so)279 b(Python)i(pro)-31 b(vides)279 b(a)g(simple)0 53730 y(w)-31 b(a)g(y)371 b(to)f(create)f(them:)0 56003 y Fk(>>>)582 b(range\(1,5\))0 57358 y([1,)g(2,)f(3,)g(4])p eop %%Page: 82 108 82 107 bop 0 -2070 a Fv(82)34300 b(Lists)p 0 -1627 38191 45 v 0 865 a Fn(The)325 b Fk(range)g Fn(function)h(tak)-31 b(es)326 b(t)-31 b(w)g(o)326 b(argumen)-31 b(ts)326 b(and)f(returns)f (a)h(list)g(that)h(con)-31 b(tains)327 b(all)f(the)0 2220 y(in)-31 b(tegers)432 b(from)g(the)g(\257rst)e(to)j(the)e(second,) 447 b(including)433 b(the)f(\257rst)f(but)h(not)g(including)h(the)0 3575 y(second!)0 5579 y(There)418 b(are)h(t)-31 b(w)g(o)420 b(other)f(forms)g(of)g Fk(range)p Fn(.)641 b(With)419 b(a)g(single)g(argumen)-31 b(t,)433 b(it)420 b(creates)e(a)h(list)0 6934 y(that)370 b(starts)g(at)g(0:)0 9019 y Fk(>>>)582 b(range\(10\))0 10374 y([0,)g(1,)f(2,)g(3,)h(4,)f(5,)h(6,)f(7,)h(8,)f (9])0 12459 y Fn(If)475 b(there)f(is)h(a)g(third)g(argumen)-31 b(t,)504 b(it)475 b(sp)31 b(eci\257es)474 b(the)h(space)g(b)31 b(et)-31 b(w)g(een)476 b(successiv)-31 b(e)474 b(v)-61 b(alues,)0 13813 y(whic)-31 b(h)370 b(is)f(called)i(the)e Fv(step)425 b(size)p Fn(.)493 b(This)369 b(example)i(coun)-31 b(ts)370 b(from)f(1)h(to)g(10)g(b)-31 b(y)369 b(steps)g(of)h(2:)0 15898 y Fk(>>>)582 b(range\(1,)g(10,)g(2\))0 17253 y([1,)g(3,)f(5,)g (7,)h(9])0 19338 y Fn(Finally)-92 b(,)393 b(there)386 b(is)h(a)g(sp)31 b(ecial)387 b(list)g(that)h(con)-31 b(tains)388 b(no)f(elemen)-31 b(ts.)546 b(It)387 b(is)f(called)i(the)f (empt)-31 b(y)0 20693 y(list,)371 b(and)e(it)h(is)f(denoted)h Fk([])p Fn(.)0 22697 y(With)502 b(all)g(these)f(w)-31 b(a)g(ys)503 b(to)f(create)f(lists,)535 b(it)502 b(w)-31 b(ould)503 b(b)31 b(e)501 b(disapp)31 b(oin)-31 b(ting)504 b(if)e(w)-31 b(e)501 b(couldn't)0 24052 y(assign)370 b(list)g(v)-61 b(alues)369 b(to)h(v)-61 b(ariables)370 b(or)f(pass)g(lists)g(as)g(parameters)h(to)g(functions.)494 b(W)-92 b(e)368 b(can.)0 26137 y Fk(vocabulary)583 b(=)e (["ameliorate",)i("castigate",)g("defenestrate"])0 27492 y(numbers)f(=)f([17,)h(123])0 28847 y(empty)g(=)f([])0 30202 y(print)h(vocabulary,)h(numbers,)f(empty)0 31557 y(['ameliorate',)h('castigate',)g('defenestrate'])h([17,)d(123])h([])0 35923 y Fl(8.2)1793 b(Accessing)599 b(elemen)-50 b(ts)0 38260 y Fn(The)472 b(syn)-31 b(tax)473 b(for)e(accessing)i(the)e (elemen)-31 b(ts)473 b(of)f(a)g(list)h(is)f(the)f(same)i(as)e(the)h (syn)-31 b(tax)473 b(for)0 39615 y(accessing)354 b(the)g(c)-31 b(haracters)354 b(of)g(a)g(string|the)h(brac)-31 b(k)g(et)354 b(op)31 b(erator)355 b(\()p Fk([])p Fn(\).)488 b(The)354 b(expression)0 40970 y(inside)370 b(the)f(brac)-31 b(k)g(ets)370 b(sp)31 b(eci\257es)368 b(the)i(index.)493 b(Remem)-31 b(b)31 b(er)369 b(that)h(the)g(indices)f(start)h(at)g(0:)0 43055 y Fk(print)582 b(numbers[0])0 44410 y(numbers[1])h(=)e(5)0 46495 y Fn(The)390 b(brac)-31 b(k)g(et)391 b(op)31 b(erator)390 b(can)g(app)31 b(ear)390 b(an)-31 b(ywhere)390 b(in)g(an)g(expression.) 555 b(When)389 b(it)h(app)31 b(ears)0 47850 y(on)400 b(the)h(left)g(side)f(of)h(an)f(assignmen)-31 b(t,)410 b(it)401 b(c)-31 b(hanges)400 b(one)h(of)f(the)h(elemen)-31 b(ts)401 b(in)f(the)h(list,)409 b(so)0 49205 y(the)369 b(one-eth)h(elemen)-31 b(t)371 b(of)f Fk(numbers)p Fn(,)g(whic)-31 b(h)370 b(used)f(to)h(b)31 b(e)368 b(123,)j(is)f(no)-31 b(w)370 b(5.)0 51208 y(An)-31 b(y)370 b(in)-31 b(teger)370 b(expression)f(can)g(b)31 b(e)369 b(used)f(as)i(an)f(index:)0 53293 y Fk(>>>)582 b(numbers[3-2])0 54648 y(5)0 56003 y(>>>)g(numbers[1.0])0 57358 y(TypeError:)h(sequence)f(index)g(must)g (be)f(integer)p eop %%Page: 83 109 83 108 bop 0 -2070 a Fv(8.3)425 b(List)f(length)28843 b(83)p 0 -1627 38191 45 v 0 865 a Fn(If)437 b(y)-31 b(ou)439 b(try)e(to)h(read)g(or)f(write)h(an)g(elemen)-31 b(t)439 b(that)g(do)31 b(es)437 b(not)h(exist,)456 b(y)-31 b(ou)438 b(get)g(a)g(run)-31 b(time)0 2220 y(error:)0 4617 y Fk(>>>)582 b(numbers[2])g(=)g(5)0 5972 y(IndexError:)h(list)f(assignment)g(index)g (out)g(of)f(range)0 8369 y Fn(If)369 b(an)g(index)h(has)f(a)h(negativ) -31 b(e)371 b(v)-61 b(alue,)370 b(it)g(coun)-31 b(ts)370 b(bac)-31 b(kw)g(ard)370 b(from)g(the)g(end)f(of)g(the)h(list:)0 10765 y Fk(>>>)582 b(numbers[-1])0 12120 y(5)0 13475 y(>>>)g(numbers[-2])0 14830 y(17)0 16185 y(>>>)g(numbers[-3])0 17540 y(IndexError:)h(list)f(index)f(out)h(of)f(range)0 19937 y(numbers[-1])382 b Fn(is)f(the)g(last)h(elemen)-31 b(t)382 b(of)f(the)g(list,)k Fk(numbers[-2])e Fn(is)d(the)h(second)g (to)h(last,)0 21292 y(and)369 b Fk(numbers[-3])i Fn(do)31 b(esn't)370 b(exist.)0 23608 y(It)f(is)g(common)i(to)f(use)f(a)g(lo)31 b(op)370 b(v)-61 b(ariable)371 b(as)e(a)g(list)h(index.)0 26004 y Fk(horsemen)582 b(=)g(["war",)g("famine",)g("pestilence",)h ("death"])0 28714 y(i)e(=)h(0)0 30069 y(while)g(i)f(<)g(4:)1162 31424 y(print)h(horsemen[i])1162 32779 y(i)g(=)f(i)g(+)g(1)0 35176 y Fn(This)292 b Fk(while)g Fn(lo)31 b(op)293 b(coun)-31 b(ts)292 b(from)g(0)g(to)g(4.)467 b(When)291 b(the)h(lo)31 b(op)293 b(v)-61 b(ariable)292 b Fk(i)g Fn(is)f(4,)308 b(the)292 b(condition)0 36531 y(fails)373 b(and)f(the)g(lo)31 b(op)372 b(terminates.)502 b(So)372 b(the)g(b)31 b(o)g(dy)372 b(of)g(the)g(lo)31 b(op)373 b(is)e(only)i(executed)f(when)g Fk(i)0 37886 y Fn(is)d(0,)h(1,)g(2,)g(and)f(3.)0 40201 y(Eac)-31 b(h)476 b(time)h(through)f(the)f(lo)31 b(op,)503 b(the)476 b(v)-61 b(ariable)476 b Fk(i)f Fn(is)g(used)g(as)g(an)h (index)f(in)-31 b(to)477 b(the)f(list,)0 41556 y(prin)-31 b(ting)321 b(the)g Fk(i)p Fn(-eth)f(elemen)-31 b(t.)478 b(This)320 b(pattern)h(of)f(computation)j(is)d(called)h(a)g Fv(list)367 b(tra)-35 b(v)g(er-)0 42911 y(sal)p Fn(.)0 47874 y Fl(8.3)1793 b(List)599 b(length)0 50584 y Fn(The)351 b(function)h Fk(len)f Fn(returns)e(the)i(length)h(of)f(a)f(list.)488 b(It)350 b(is)h(a)g(go)31 b(o)g(d)351 b(idea)g(to)h(use)e(this)g(v)-61 b(alue)0 51938 y(as)356 b(the)g(upp)31 b(er)355 b(b)31 b(ound)356 b(of)h(a)f(lo)31 b(op)357 b(instead)g(of)g(a)f(constan)-31 b(t.)490 b(That)357 b(w)-31 b(a)g(y)-92 b(,)360 b(if)d(the)f(size)g(of) h(the)0 53293 y(list)370 b(c)-31 b(hanges,)371 b(y)-31 b(ou)370 b(w)-31 b(on't)371 b(ha)-31 b(v)g(e)371 b(to)f(go)g(through)g (the)g(program)g(c)-31 b(hanging)371 b(all)g(the)f(lo)31 b(ops;)0 54648 y(they)370 b(will)h(w)-31 b(ork)370 b(correctly)f(for)h (an)-31 b(y)370 b(size)f(list:)p eop %%Page: 84 110 84 109 bop 0 -2070 a Fv(84)34300 b(Lists)p 0 -1627 38191 45 v 0 865 a Fk(horsemen)582 b(=)g(["war",)g("famine",)g("pestilence",) h("death"])0 3575 y(i)e(=)h(0)0 4930 y(while)g(i)f(<)g (len\(horsemen\):)1162 6285 y(print)h(horsemen[i])1162 7640 y(i)g(=)f(i)g(+)g(1)0 9682 y Fn(The)336 b(last)g(time)h(the)f(b)31 b(o)g(dy)335 b(of)h(the)g(lo)31 b(op)336 b(is)g(executed,)343 b Fk(i)335 b Fn(is)h Fk(len\(horsemen\))583 b(-)e(1)p Fn(,)343 b(whic)-31 b(h)0 11037 y(is)570 b(the)h(index)g(of)g(the)f (last)i(elemen)-31 b(t.)1098 b(When)569 b Fk(i)i Fn(is)f(equal)i(to)f Fk(len\(horsemen\))p Fn(,)623 b(the)0 12392 y(condition)472 b(fails)f(and)f(the)g(b)31 b(o)g(dy)470 b(is)g(not)g(executed,)496 b(whic)-31 b(h)471 b(is)f(a)g(go)31 b(o)g(d)471 b(thing,)496 b(b)31 b(ecause)0 13746 y Fk(len\(horsemen\))371 b Fn(is)e(not)h(a)f (legal)i(index.)0 15707 y(Although)408 b(a)f(list)h(can)e(con)-31 b(tain)409 b(another)e(list,)417 b(the)407 b(nested)f(list)i(still)g (coun)-31 b(ts)407 b(as)f(a)h(single)0 17062 y(elemen)-31 b(t.)494 b(The)370 b(length)g(of)g(this)f(list)h(is)f(four:)0 19104 y Fk(['spam!',)582 b(1,)g(['Brie',)g('Roquefort',)h('Pol)f(le)f (Veq'],)h([1,)g(2,)f(3]])2767 21247 y Fm(As)305 b(an)g(exer)-57 b(cise,)325 b(write)305 b(a)g(lo)-57 b(op)305 b(that)f(tr)-57 b(averses)304 b(the)h(pr)-57 b(evious)306 b(list)f(and)g(prints)2767 22602 y(the)406 b(length)g(of)g(e)-57 b(ach)406 b(element.)539 b(What)405 b(happ)-57 b(ens)405 b(if)i(you)f(send)f(an)h(inte)-57 b(ger)407 b(to)2767 23957 y Fk(len)p Fm(?)0 28182 y Fl(8.4)1793 b(List)599 b(mem)-50 b(b)50 b(ership)0 30477 y Fk(in)440 b Fn(is)f(a)h(b)31 b(o)g(olean)441 b(op)31 b(erator)441 b(that)g(tests)e(mem)-31 b(b)31 b(ership)440 b(in)g(a)g(sequence.)704 b(W)-92 b(e)439 b(used)g(it)i(in)0 31831 y(Section)370 b(7.10)h(with)g(strings,)e(but)h(it)g(also)g(w)-31 b(orks)370 b(with)g(lists)g(and)f(other)h(sequences:)0 33873 y Fk(>>>)582 b(horsemen)g(=)f(['war',)h('famine',)h('pestilence',)g('death'])0 35228 y(>>>)f('pestilence')h(in)e(horsemen)0 36583 y(1)0 37938 y(>>>)h('debauchery')h(in)e(horsemen)0 39293 y(0)0 41335 y Fn(Since)462 b(\\p)31 b(estilence")462 b(is)g(a)f(mem)-31 b(b)31 b(er)462 b(of)g(the)f Fk(horsemen)h Fn(list,)486 b(the)462 b Fk(in)f Fn(op)31 b(erator)462 b(returns)0 42690 y(true.)492 b(Since)370 b(\\debauc)-31 b(hery")370 b(is)f(not)h(in)g(the)f(list,)i Fk(in)e Fn(returns)f(false.)0 44651 y(W)-92 b(e)347 b(can)h(use)f(the)h Fk(not)g Fn(in)g(com)-31 b(bination)351 b(with)e Fk(in)e Fn(to)i(test)f(whether)g(an)g(elemen) -31 b(t)349 b(is)e(not)i(a)0 46006 y(mem)-31 b(b)31 b(er)369 b(of)h(a)g(list:)0 48048 y Fk(>>>)582 b('debauchery')h(not)e(in)h (horsemen)0 49403 y(1)0 53709 y Fl(8.5)1793 b(Lists)599 b(and)f Fe(for)h Fl(lo)50 b(ops)0 56003 y Fn(The)286 b Fk(for)g Fn(lo)31 b(op)287 b(w)-31 b(e)287 b(sa)-31 b(w)286 b(in)g(Section)i(7.3)f(also)g(w)-31 b(orks)286 b(with)h(lists.)466 b(The)286 b(generalized)h(syn)-31 b(tax)0 57358 y(of)370 b(a)f Fk(for)h Fn(lo)31 b(op)370 b(is:)p eop %%Page: 85 111 85 110 bop 0 -2070 a Fv(8.6)425 b(List)f(op)35 b(erations)26527 b(85)p 0 -1627 38191 45 v 0 865 a Fk(for)582 b(VARIABLE)g(in)f(LIST:) 1162 2220 y(BODY)0 4606 y Fn(This)370 b(statemen)-31 b(t)371 b(is)e(equiv)-61 b(alen)-31 b(t)371 b(to:)0 6992 y Fk(i)581 b(=)h(0)0 8347 y(while)g(i)f(<)g(len\(LIST\):)1162 9702 y(VARIABLE)i(=)e(LIST[i])1162 11057 y(BODY)1162 12412 y(i)h(=)f(i)g(+)g(1)0 14798 y Fn(The)482 b Fk(for)g Fn(lo)31 b(op)483 b(is)f(more)h(concise)f(b)31 b(ecause)481 b(w)-31 b(e)483 b(can)f(eliminate)j(the)d(lo)31 b(op)483 b(v)-61 b(ariable,)511 b Fk(i)p Fn(.)0 16153 y(Here)369 b(is)g(the)g(previous)h(lo)31 b(op)370 b(written)g(with)h(a)e Fk(for)h Fn(lo)31 b(op.)0 18538 y Fk(for)582 b(horseman)g(in)f (horsemen:)1162 19893 y(print)h(horseman)0 22279 y Fn(It)420 b(almost)i(reads)d(lik)-31 b(e)422 b(English:)595 b(\\F)-92 b(or)420 b(\(ev)-31 b(ery\))421 b(horseman)f(in)h(\(the)f(list)h(of)86 b(\))422 b(horsemen,)0 23634 y(prin)-31 b(t)370 b(\(the)g(name)g(of)f (the\))h(horseman.")0 25939 y(An)-31 b(y)370 b(list)g(expression)f(can) g(b)31 b(e)369 b(used)f(in)i(a)f Fk(for)h Fn(lo)31 b(op:)0 28325 y Fk(for)582 b(number)g(in)f(range\(20\):)1162 29680 y(if)h(number)g(\045)f(2)g(==)h(0:)2325 31035 y(print)1163 b(number)0 33745 y(for)582 b(fruit)f(in)h(["banana",)h("apple",)f ("quince"]:)1162 35100 y(print)g("I)g(like)f(to)h(eat)f(")h(+)f(fruit)h (+)f("s!")0 37486 y Fn(The)380 b(\257rst)g(example)i(prin)-31 b(ts)380 b(all)h(the)g(ev)-31 b(en)380 b(n)-31 b(um)g(b)31 b(ers)380 b(b)31 b(et)-31 b(w)g(een)381 b(zero)f(and)g(nineteen.)527 b(The)0 38841 y(second)369 b(example)i(expresses)c(en)-31 b(th)g(usiasm)371 b(for)e(v)-61 b(arious)369 b(fruits.)0 43771 y Fl(8.6)1793 b(List)599 b(op)50 b(erations)0 46465 y Fn(The)369 b Fk(+)h Fn(op)31 b(erator)369 b(concatenates)i(lists:)0 48851 y Fk(>>>)582 b(a)f(=)g([1,)h(2,)f(3])0 50206 y(>>>)h(b)f(=)g([4,) h(5,)f(6])0 51561 y(>>>)h(c)f(=)g(a)g(+)h(b)0 52916 y(>>>)g(print)f(c)0 54271 y([1,)h(2,)f(3,)g(4,)h(5,)f(6])0 56657 y Fn(Similarly)-92 b(,)372 b(the)d Fk(*)g Fn(op)31 b(erator)370 b(rep)31 b(eats)369 b(a)h(list)g(a)f(giv)-31 b(en)370 b(n)-31 b(um)g(b)31 b(er)370 b(of)f(times:)p eop %%Page: 86 112 86 111 bop 0 -2070 a Fv(86)34300 b(Lists)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b([0])f(*)g(4)0 2220 y([0,)h(0,)f(0,)g(0])0 3575 y(>>>)h([1,)f(2,)h(3])f(*)g(3)0 4930 y([1,)h(2,)f(3,)g(1,)h(2,)f (3,)h(1,)f(2,)h(3])0 7154 y Fn(The)384 b(\257rst)f(example)j(rep)31 b(eats)383 b Fk([0])i Fn(four)e(times.)538 b(The)384 b(second)g(example)h(rep)31 b(eats)384 b(the)g(list)0 8509 y Fk([1,)582 b(2,)f(3])369 b Fn(three)g(times.)0 12989 y Fl(8.7)1793 b(List)599 b(slices)0 15465 y Fn(The)369 b(slice)h(op)31 b(erations)370 b(w)-31 b(e)370 b(sa)-31 b(w)370 b(in)f(Section)i(7.4)f(also)g(w)-31 b(ork)370 b(on)g(lists:)0 17689 y Fk(>>>)582 b(list)f(=)h(['a',)g('b',)f('c',)h ('d',)g('e',)g('f'])0 19044 y(>>>)g(list[1:3])0 20399 y(['b',)g('c'])0 21754 y(>>>)g(list[:4])0 23109 y(['a',)g('b',)g('c',)f ('d'])0 24464 y(>>>)h(list[3:])0 25819 y(['d',)g('e',)g('f'])0 27174 y(>>>)g(list[:])0 28529 y(['a',)g('b',)g('c',)f('d',)h('e',)g ('f'])0 33090 y Fl(8.8)1793 b(Lists)599 b(are)f(m)-50 b(utable)0 35566 y Fn(Unlik)-31 b(e)468 b(strings,)492 b(lists)467 b(are)g(m)-31 b(utable,)493 b(whic)-31 b(h)468 b(means)f(w)-31 b(e)468 b(can)f(c)-31 b(hange)467 b(their)g(elemen)-31 b(ts.)0 36921 y(Using)323 b(the)f(brac)-31 b(k)g(et)323 b(op)31 b(erator)323 b(on)g(the)f(left)h(side)f(of)h(an)f(assignmen)-31 b(t,)334 b(w)-31 b(e)323 b(can)f(up)31 b(date)323 b(one)0 38276 y(of)370 b(the)f(elemen)-31 b(ts:)0 40500 y Fk(>>>)582 b(fruit)f(=)h(["banana",)g("apple",)h("quince"])0 41855 y(>>>)f(fruit[0])g(=)f("pear")0 43210 y(>>>)h(fruit[-1])g(=)f("orange") 0 44565 y(>>>)h(print)f(fruit)0 45920 y(['pear',)h('apple',)h ('orange'])0 48144 y Fn(With)370 b(the)f(slice)h(op)31 b(erator)369 b(w)-31 b(e)370 b(can)g(up)31 b(date)369 b(sev)-31 b(eral)370 b(elemen)-31 b(ts)370 b(at)g(once:)0 50368 y Fk(>>>)582 b(list)f(=)h(['a',)g('b',)f('c',)h('d',)g('e',)g ('f'])0 51723 y(>>>)g(list[1:3])g(=)f(['x',)h('y'])0 53078 y(>>>)g(print)f(list)0 54433 y(['a',)h('x',)g('y',)f('d',)h('e',) g('f'])0 56657 y Fn(W)-92 b(e)368 b(can)i(also)g(remo)-31 b(v)g(e)370 b(elemen)-31 b(ts)370 b(from)g(a)g(list)g(b)-31 b(y)369 b(assigning)i(the)e(empt)-31 b(y)371 b(list)f(to)g(them:)p eop %%Page: 87 113 87 112 bop 0 -2070 a Fv(8.9)425 b(List)f(deletion)27906 b(87)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(list)f(=)h(['a',)g('b',) f('c',)h('d',)g('e',)g('f'])0 2220 y(>>>)g(list[1:3])g(=)f([])0 3575 y(>>>)h(print)f(list)0 4930 y(['a',)h('d',)g('e',)f('f'])0 7539 y Fn(And)339 b(w)-31 b(e)339 b(can)g(add)g(elemen)-31 b(ts)340 b(to)g(a)f(list)h(b)-31 b(y)339 b(squeezing)g(them)g(in)-31 b(to)341 b(an)e(empt)-31 b(y)340 b(slice)f(at)h(the)0 8894 y(desired)369 b(lo)31 b(cation:)0 11502 y Fk(>>>)582 b(list)f(=)h(['a',)g('d',)f('f'])0 12857 y(>>>)h(list[1:1])g(=)f(['b',) h('c'])0 14212 y(>>>)g(print)f(list)0 15567 y(['a',)h('b',)g('c',)f ('d',)h('f'])0 16922 y(>>>)g(list[4:4])g(=)f(['e'])0 18277 y(>>>)h(print)f(list)0 19632 y(['a',)h('b',)g('c',)f('d',)h('e',) g('f'])0 25312 y Fl(8.9)1793 b(List)599 b(deletion)0 28318 y Fn(Using)395 b(slices)g(to)g(delete)g(list)h(elemen)-31 b(ts)396 b(can)e(b)31 b(e)395 b(a)-31 b(wkw)g(ard,)403 b(and)395 b(therefore)g(error-prone.)0 29673 y(Python)370 b(pro)-31 b(vides)370 b(an)g(alternativ)-31 b(e)371 b(that)g(is)e(more) g(readable.)0 32201 y Fk(del)g Fn(remo)-31 b(v)g(es)370 b(an)g(elemen)-31 b(t)370 b(from)g(a)g(list:)0 34810 y Fk(>>>)582 b(a)f(=)g(['one',)h('two',)g('three'])0 36165 y(>>>)g(del)f(a[1])0 37519 y(>>>)h(a)0 38874 y(['one',)g ('three'])0 41483 y Fn(As)401 b(y)-31 b(ou)403 b(migh)-31 b(t)403 b(exp)31 b(ect,)410 b Fk(del)402 b Fn(handles)g(negativ)-31 b(e)404 b(indices)e(and)g(causes)f(a)g(run)-31 b(time)403 b(error)0 42838 y(if)370 b(the)f(index)h(is)f(out)h(of)g(range.)0 45366 y(Y)-92 b(ou)369 b(can)h(use)e(a)i(slice)f(as)h(an)f(index)h(for) f Fk(del)p Fn(:)0 47975 y Fk(>>>)582 b(list)f(=)h(['a',)g('b',)f('c',)h ('d',)g('e',)g('f'])0 49330 y(>>>)g(del)f(list[1:5])0 50685 y(>>>)h(print)f(list)0 52039 y(['a',)h('f'])0 54648 y Fn(As)276 b(usual,)296 b(slices)276 b(select)h(all)h(the)f(elemen)-31 b(ts)277 b(up)g(to,)296 b(but)277 b(not)g(including,)297 b(the)277 b(second)f(index.)p eop %%Page: 88 114 88 113 bop 0 -2070 a Fv(88)34300 b(Lists)p 0 -1627 38191 45 v 0 865 a Fl(8.10)1792 b(Ob)100 b(jects)599 b(and)f(v)-100 b(alues)0 3145 y Fn(If)369 b(w)-31 b(e)370 b(execute)f(these)g (assignmen)-31 b(t)371 b(statemen)-31 b(ts,)0 5173 y Fk(a)581 b(=)h("banana")0 6528 y(b)f(=)h("banana")0 8556 y Fn(w)-31 b(e)393 b(kno)-31 b(w)394 b(that)g Fk(a)e Fn(and)h Fk(b)g Fn(will)h(refer)e(to)h(a)g(string)g(with)h(the)f (letters)g Fk("banana")p Fn(.)563 b(But)393 b(w)-31 b(e)0 9911 y(can't)370 b(tell)h(whether)e(they)h(p)31 b(oin)-31 b(t)370 b(to)g(the)g Fm(same)f Fn(string.)0 11857 y(There)g(are)g(t)-31 b(w)g(o)371 b(p)31 b(ossible)369 b(states:)6984 13236 y 14340423 2828615 0 0 14340423 2828615 startTexFig 6984 13236 a %%BeginDocument: illustrations/list1.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: list1.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 09:34:48 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 218 43 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 43 moveto 0 0 lineto 218 0 lineto 218 43 lineto closepath clip newpath -107.0 100.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 1800 975 m 3375 975 l 3375 1650 l 1800 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 3825 975 m 5400 975 l 5400 1650 l 3825 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 2490 1477 m 2490 1417 l 2338 1417 l 2458 1447 l 2338 1477 l cp eoclip n 2100 1447 m 2475 1447 l gs col0 s gr gr % arrowhead n 2338 1477 m 2458 1447 l 2338 1417 l col0 s % Polyline gs clippath 2490 1177 m 2490 1117 l 2338 1117 l 2458 1147 l 2338 1177 l cp eoclip n 2100 1147 m 2475 1147 l gs col0 s gr gr % arrowhead n 2338 1177 m 2458 1147 l 2338 1117 l col0 s /Helvetica ff 165.00 scf sf 2025 1200 m gs 1 -1 sc (a) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1500 m gs 1 -1 sc (b) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1200 m gs 1 -1 sc ("banana") col0 sh gr /Helvetica ff 165.00 scf sf 2550 1500 m gs 1 -1 sc ("banana") col0 sh gr % Polyline gs clippath 4522 1375 m 4507 1317 l 4360 1355 l 4484 1354 l 4375 1413 l cp eoclip n 4125 1447 m 4500 1350 l gs col0 s gr gr % arrowhead n 4375 1413 m 4484 1354 l 4360 1355 l col0 s % Polyline gs clippath 4504 1308 m 4523 1251 l 4380 1202 l 4484 1270 l 4360 1259 l cp eoclip n 4125 1147 m 4500 1275 l gs col0 s gr gr % arrowhead n 4360 1259 m 4484 1270 l 4380 1202 l col0 s /Helvetica ff 165.00 scf sf 4050 1200 m gs 1 -1 sc (a) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4050 1500 m gs 1 -1 sc (b) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4575 1350 m gs 1 -1 sc ("banana") col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 19799 a Fn(In)393 b(one)g(case,)400 b Fk(a)393 b Fn(and)h Fk(b)f Fn(refer)f(to)i(t)-31 b(w)g(o)395 b(di\256eren)-31 b(t)394 b(things)g(that)h(ha)-31 b(v)g(e)394 b(the)f(same)h(v)-61 b(alue.)565 b(In)0 21154 y(the)299 b(second)g(case,)314 b(they)299 b(refer)f(to)i(the)f(same)h(thing.)470 b(These)299 b(\\things")i(ha)-31 b(v)g(e)300 b(names|they)0 22509 y(are)369 b(called)h Fv(ob)71 b(jects)p Fn(.)494 b(An)369 b(ob)61 b(ject)371 b(is)e(something)i(a)e(v)-61 b(ariable)370 b(can)g(refer)e(to.)0 24455 y(Ev)-31 b(ery)291 b(ob)61 b(ject)293 b(has)e(a)g(unique)g Fv(iden)-35 b(ti\257er)p Fn(,)308 b(whic)-31 b(h)292 b(w)-31 b(e)292 b(can)f(obtain)h(with)h (the)e Fk(id)g Fn(function.)0 25810 y(By)340 b(prin)-31 b(ting)342 b(the)e(iden)-31 b(ti\257er)341 b(of)f Fk(a)g Fn(and)h Fk(b)p Fn(,)346 b(w)-31 b(e)340 b(can)h(tell)g(whether)f(they) g(refer)g(to)g(the)h(same)0 27165 y(ob)61 b(ject.)0 29193 y Fk(>>>)582 b(id\(a\))0 30548 y(135044008)0 31903 y(>>>)g(id\(b\))0 33257 y(135044008)0 35285 y Fn(In)332 b(fact,)341 b(w)-31 b(e)333 b(get)g(the)g(same)f(iden)-31 b(ti\257er)334 b(t)-31 b(wice,)341 b(whic)-31 b(h)333 b(means)g(that)h(Python)f(only)h (created)0 36640 y(one)369 b(string,)i(and)e(b)31 b(oth)370 b Fk(a)f Fn(and)g Fk(b)g Fn(refer)g(to)h(it.)0 38587 y(In)-31 b(terestingly)-92 b(,)552 b(lists)515 b(b)31 b(eha)-31 b(v)g(e)515 b(di\256eren)-31 b(tly)-92 b(.)929 b(When)513 b(w)-31 b(e)515 b(create)g(t)-31 b(w)g(o)516 b(lists,)551 b(w)-31 b(e)515 b(get)g(t)-31 b(w)g(o)0 39942 y(ob)61 b(jects:)0 41969 y Fk(>>>)582 b(a)f(=)g([1,)h(2,)f(3])0 43324 y(>>>)h(b)f(=)g([1,)h(2,)f(3])0 44679 y(>>>)h(id\(a\))0 46034 y(135045528)0 47389 y(>>>)g(id\(b\))0 48744 y(135041704)0 50771 y Fn(So)369 b(the)h(state)g(diagram)h(lo)31 b(oks)370 b(lik)-31 b(e)370 b(this:)13706 52151 y 6380830 2828615 0 0 6380830 2828615 startTexFig 13706 52151 a %%BeginDocument: illustrations/list2.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: list2.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 09:32:48 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 97 43 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 43 moveto 0 0 lineto 97 0 lineto 97 43 lineto closepath clip newpath -107.0 100.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 1800 975 m 3375 975 l 3375 1650 l 1800 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 2490 1477 m 2490 1417 l 2338 1417 l 2458 1447 l 2338 1477 l cp eoclip n 2100 1447 m 2475 1447 l gs col0 s gr gr % arrowhead n 2338 1477 m 2458 1447 l 2338 1417 l col0 s % Polyline gs clippath 2490 1177 m 2490 1117 l 2338 1117 l 2458 1147 l 2338 1177 l cp eoclip n 2100 1147 m 2475 1147 l gs col0 s gr gr % arrowhead n 2338 1177 m 2458 1147 l 2338 1117 l col0 s /Helvetica ff 165.00 scf sf 2025 1200 m gs 1 -1 sc (a) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1500 m gs 1 -1 sc (b) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1200 m gs 1 -1 sc ([ 1, 2, 3 ]) col0 sh gr /Helvetica ff 165.00 scf sf 2550 1500 m gs 1 -1 sc ([ 1, 2, 3 ]) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 58713 a Fk(a)f Fn(and)h Fk(b)f Fn(ha)-31 b(v)g(e)370 b(the)f(same)h(v)-61 b(alue)369 b(but)h(do)f(not)h(refer)f(to)h(the)f (same)h(ob)61 b(ject.)p eop %%Page: 89 115 89 114 bop 0 -2070 a Fv(8.11)425 b(Aliasing)29742 b(89)p 0 -1627 38191 45 v 0 865 a Fl(8.11)1792 b(Aliasing)0 3491 y Fn(Since)375 b(v)-61 b(ariables)376 b(refer)e(to)i(ob)61 b(jects,)378 b(if)e(w)-31 b(e)376 b(assign)f(one)g(v)-61 b(ariable)377 b(to)e(another,)j(b)31 b(oth)376 b(v)-61 b(ari-)0 4846 y(ables)370 b(refer)e(to)i(the)f(same)h(ob)61 b(ject:)0 7183 y Fk(>>>)582 b(a)f(=)g([1,)h(2,)f(3])0 8538 y(>>>)h(b)f(=)g(a)0 10876 y Fn(In)369 b(this)g(case,)h(the)f (state)h(diagram)h(lo)31 b(oks)370 b(lik)-31 b(e)371 b(this:)13706 12255 y 6380830 2828615 0 0 6380830 2828615 startTexFig 13706 12255 a %%BeginDocument: illustrations/list3.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: list3.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 09:33:04 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 97 43 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 43 moveto 0 0 lineto 97 0 lineto 97 43 lineto closepath clip newpath -107.0 100.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 1800 975 m 3375 975 l 3375 1650 l 1800 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 2497 1375 m 2482 1317 l 2335 1355 l 2459 1354 l 2350 1413 l cp eoclip n 2100 1447 m 2475 1350 l gs col0 s gr gr % arrowhead n 2350 1413 m 2459 1354 l 2335 1355 l col0 s % Polyline gs clippath 2479 1308 m 2498 1251 l 2355 1202 l 2459 1270 l 2335 1259 l cp eoclip n 2100 1147 m 2475 1275 l gs col0 s gr gr % arrowhead n 2335 1259 m 2459 1270 l 2355 1202 l col0 s /Helvetica ff 165.00 scf sf 2025 1200 m gs 1 -1 sc (a) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1500 m gs 1 -1 sc (b) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1350 m gs 1 -1 sc ([ 1, 2, 3 ]) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 19127 a Fn(Because)288 b(the)g(same)g(list)g(has)g(t)-31 b(w)g(o)289 b(di\256eren)-31 b(t)288 b(names,)305 b Fk(a)287 b Fn(and)h Fk(b)p Fn(,)305 b(w)-31 b(e)288 b(sa)-31 b(y)288 b(that)h(it)f(is)g Fv(aliased)p Fn(.)0 20482 y(Changes)370 b(made)g(with)g(one)g(alias)g(a\256ect)g(the)f(other:)0 22819 y Fk(>>>)582 b(b[0])f(=)h(5)0 24174 y(>>>)g(print)f(a)0 25529 y([5,)h(2,)f(3])0 27866 y Fn(Although)281 b(this)f(b)31 b(eha)-31 b(vior)281 b(can)f(b)31 b(e)279 b(useful,)298 b(it)280 b(is)f(sometimes)i(unexp)31 b(ected)280 b(or)f(undesirable.)0 29221 y(In)529 b(general,)570 b(it)530 b(is)g(safer)f(to)h(a)-31 b(v)g(oid)531 b(aliasing)h(when)d(y)-31 b(ou)530 b(are)f(w)-31 b(orking)531 b(with)g(m)-31 b(utable)0 30576 y(ob)61 b(jects.)924 b(Of)512 b(course,)549 b(for)512 b(imm)-31 b(utable)516 b(ob)61 b(jects,)550 b(there's)512 b(no)h(problem.)923 b(That's)514 b(wh)-31 b(y)0 31931 y(Python)370 b(is)g(free)e(to)i (alias)h(strings)e(when)h(it)f(sees)g(an)g(opp)31 b(ortunit)-31 b(y)371 b(to)f(economize.)0 36714 y Fl(8.12)1792 b(Cloning)598 b(lists)0 39341 y Fn(If)475 b(w)-31 b(e)476 b(w)-31 b(an)g(t)477 b(to)f(mo)31 b(dify)476 b(a)g(list)g(and)g(also)g(k)-31 b(eep)475 b(a)h(cop)-31 b(y)476 b(of)f(the)h(original,)504 b(w)-31 b(e)476 b(need)f(to)0 40695 y(b)31 b(e)386 b(able)h(to)h(mak) -31 b(e)387 b(a)g(cop)-31 b(y)387 b(of)h(the)e(list)i(itself,)k(not)c (just)e(the)h(reference.)544 b(This)387 b(pro)31 b(cess)385 b(is)0 42050 y(sometimes)371 b(called)f Fv(cloning)p Fn(,)g(to)g(a)-31 b(v)g(oid)371 b(the)e(am)-31 b(biguit)g(y)373 b(of)d(the)f(w)-31 b(ord)370 b(\\cop)-31 b(y)-92 b(.")0 44307 y(The)369 b(easiest)h(w)-31 b(a)g(y)371 b(to)f(clone)g(a)f(list)h (is)f(to)h(use)f(the)g(slice)h(op)31 b(erator:)0 46644 y Fk(>>>)582 b(a)f(=)g([1,)h(2,)f(3])0 47999 y(>>>)h(b)f(=)g(a[:])0 49354 y(>>>)h(print)f(b)0 50708 y([1,)h(2,)f(3])0 53046 y Fn(T)-92 b(aking)335 b(an)-31 b(y)334 b(slice)g(of)g Fk(a)g Fn(creates)f(a)h(new)g(list.)481 b(In)333 b(this)h(case)g(the)f (slice)h(happ)31 b(ens)333 b(to)h(consist)0 54401 y(of)370 b(the)f(whole)i(list.)0 56657 y(No)-31 b(w)370 b(w)-31 b(e)370 b(are)f(free)g(to)h(mak)-31 b(e)370 b(c)-31 b(hanges)370 b(to)g Fk(b)f Fn(without)i(w)-31 b(orrying)371 b(ab)31 b(out)370 b Fk(a)p Fn(:)p eop %%Page: 90 116 90 115 bop 0 -2070 a Fv(90)34300 b(Lists)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(b[0])f(=)h(5)0 2220 y(>>>)g(print)f(a)0 3575 y([1,)h(2,)f(3])2767 6138 y Fm(As)464 b(an)h(exer)-57 b(cise,)482 b(dr)-57 b(aw)464 b(a)g(state)g(diagr)-57 b(am)465 b(for)f Fk(a)h Fm(and)f Fk(b)h Fm(b)-57 b(efor)g(e)465 b(and)g(after)2767 7493 y(this)396 b(change.)0 11924 y Fl(8.13)1792 b(List)599 b(parameters)0 14365 y Fn(P)-31 b(assing)286 b(a)f(list)g(as)g(an)g(argumen)-31 b(t)286 b(actually)h(passes)d(a)h(reference)f(to)i(the)e(list,)303 b(not)286 b(a)f(cop)-31 b(y)285 b(of)0 15720 y(the)342 b(list.)485 b(F)-92 b(or)341 b(example,)349 b(the)343 b(function)g Fk(head)g Fn(tak)-31 b(es)342 b(a)h(list)g(as)f(a)g (parameter)h(and)f(returns)0 17075 y(the)369 b(\257rst)g(elemen)-31 b(t:)0 19264 y Fk(def)582 b(head\(list\):)1162 20619 y(return)g(list[0])0 22808 y Fn(Here's)369 b(ho)-31 b(w)370 b(it)g(is)f(used:)0 24997 y Fk(>>>)582 b(numbers)g(=)f([1,)h(2,)f(3])0 26352 y(>>>)h(head\(numbers\))0 27706 y(1)0 29895 y Fn(The)395 b(parameter)h Fk(list)f Fn(and)g(the)g(v)-61 b(ariable)396 b Fk(numbers)f Fn(are)g(aliases)h(for)f(the)g(same)g(ob)61 b(ject.)0 31250 y(The)369 b(state)h(diagram)h(lo)31 b(oks)370 b(lik)-31 b(e)371 b(this:)10095 32630 y 10656645 4341596 0 0 10656645 4341596 startTexFig 10095 32630 a %%BeginDocument: illustrations/stack5.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: stack5.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Fri Dec 14 14:07:05 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 162 66 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 66 moveto 0 0 lineto 162 0 lineto 162 66 lineto closepath clip newpath -29.0 123.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 1275 975 m 2250 975 l 2250 1425 l 1275 1425 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1275 1575 m 2250 1575 l 2250 2025 l 1275 2025 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 2509 1601 m 2481 1548 l 2346 1619 l 2467 1590 l 2374 1672 l cp eoclip n 2082 1793 m 2482 1582 l gs col0 s gr gr % arrowhead n 2374 1672 m 2467 1590 l 2346 1619 l col0 s % Polyline gs clippath 2480 1458 m 2509 1406 l 2378 1331 l 2468 1417 l 2348 1383 l cp eoclip n 2085 1200 m 2482 1425 l gs col0 s gr gr % arrowhead n 2348 1383 m 2468 1417 l 2378 1331 l col0 s /Helvetica ff 165.00 scf sf 2025 1852 m gs 1 -1 sc (list) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2528 1553 m gs 1 -1 sc ([ 1, 2, 3 ]) col0 sh gr /Helvetica ff 165.00 scf sf 2040 1245 m gs 1 -1 sc (numbers) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 1192 1245 m gs 1 -1 sc (__main__) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 1207 1852 m gs 1 -1 sc (head) dup sw pop neg 0 rm col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 41909 a Fn(Since)e(the)h(list)g(ob)61 b(ject)371 b(is)e(shared)f(b) -31 b(y)370 b(t)-31 b(w)g(o)371 b(frames,)e(w)-31 b(e)370 b(drew)f(it)h(b)31 b(et)-31 b(w)g(een)370 b(them.)0 44017 y(If)349 b(a)h(function)h(mo)31 b(di\257es)351 b(a)f(list)g(parameter,) 355 b(the)350 b(caller)g(sees)f(the)h(c)-31 b(hange.)487 b(F)-92 b(or)349 b(example,)0 45372 y Fk(deleteHead)370 b Fn(remo)-31 b(v)g(es)370 b(the)g(\257rst)e(elemen)-31 b(t)371 b(from)f(a)f(list:)0 47561 y Fk(def)582 b(deleteHead\(list\):) 1162 48915 y(del)g(list[0])0 51104 y Fn(Here's)369 b(ho)-31 b(w)370 b Fk(deleteHead)h Fn(is)e(used:)0 53293 y Fk(>>>)582 b(numbers)g(=)f([1,)h(2,)f(3])0 54648 y(>>>)h(deleteHead\(numbers\))0 56003 y(>>>)g(print)f(numbers)0 57358 y([2,)h(3])p eop %%Page: 91 117 91 116 bop 0 -2070 a Fv(8.14)425 b(Nested)h(lists)27731 b(91)p 0 -1627 38191 45 v 0 865 a Fn(If)363 b(a)h(function)h(returns)d (a)i(list,)i(it)e(returns)f(a)g(reference)g(to)h(the)g(list.)491 b(F)-92 b(or)363 b(example,)k Fk(tail)0 2220 y Fn(returns)h(a)i(list)g (that)g(con)-31 b(tains)371 b(all)f(but)g(the)f(\257rst)g(elemen)-31 b(t)370 b(of)g(the)g(giv)-31 b(en)370 b(list:)0 4326 y Fk(def)582 b(tail\(list\):)1162 5681 y(return)g(list[1:])0 7788 y Fn(Here's)369 b(ho)-31 b(w)370 b Fk(tail)g Fn(is)f(used:)0 9894 y Fk(>>>)582 b(numbers)g(=)f([1,)h(2,)f(3])0 11249 y(>>>)h(rest)f(=)h(tail\(numbers\))0 12604 y(>>>)g(print)f(rest)0 13959 y([2,)h(3])0 16065 y Fn(Because)438 b(the)h(return)e(v)-61 b(alue)439 b(w)-31 b(as)439 b(created)f(with)i(the)e(slice)h(op)31 b(erator,)456 b(it)439 b(is)g(a)f(new)h(list.)0 17420 y(Creating)315 b Fk(rest)p Fn(,)325 b(and)313 b(an)-31 b(y)314 b(subsequen)-31 b(t)313 b(c)-31 b(hanges)313 b(to)h Fk(rest)p Fn(,)325 b(ha)-31 b(v)g(e)314 b(no)f(e\256ect)g(on)h Fk(numbers)p Fn(.)0 21735 y Fl(8.14)1792 b(Nested)600 b(lists)0 24094 y Fn(A)335 b(nested)g(list)g(is)g(a)g(list)h(that)g (app)31 b(ears)335 b(as)g(an)g(elemen)-31 b(t)336 b(in)f(another)h (list.)482 b(In)334 b(this)i(list,)343 b(the)0 25448 y(three-eth)369 b(elemen)-31 b(t)371 b(is)e(a)h(nested)f(list:)0 27555 y Fk(>>>)582 b(list)f(=)h(["hello",)g(2.0,)g(5,)f([10,)h(20]])0 29661 y Fn(If)395 b(w)-31 b(e)396 b(prin)-31 b(t)396 b Fk(list[3])p Fn(,)403 b(w)-31 b(e)396 b(get)g Fk([10,)582 b(20])p Fn(.)572 b(T)-92 b(o)396 b(extract)g(an)g(elemen)-31 b(t)396 b(from)g(the)g(nested)0 31016 y(list,)371 b(w)-31 b(e)369 b(can)h(pro)31 b(ceed)368 b(in)i(t)-31 b(w)g(o)371 b(steps:)0 33122 y Fk(>>>)582 b(elt)f(=)g(list[3])0 34477 y(>>>)h(elt[0])0 35832 y(10)0 37938 y Fn(Or)369 b(w)-31 b(e)369 b(can)h(com)-31 b(bine)370 b(them:)0 40045 y Fk(>>>)582 b(list[3][1])0 41400 y(20)0 43506 y Fn(Brac)-31 b(k)g(et)379 b(op)31 b(erators)379 b(ev)-61 b(aluate)379 b(from)g(left)g(to)g(righ)-31 b(t,)382 b(so)d(this)f(expression)g(gets) h(the)f(three-)0 44861 y(eth)369 b(elemen)-31 b(t)371 b(of)f Fk(list)f Fn(and)h(extracts)g(the)f(one-eth)h(elemen)-31 b(t)370 b(from)g(it.)0 49176 y Fl(8.15)1792 b(Matrixes)0 51534 y Fn(Nested)369 b(lists)h(are)f(often)h(used)f(to)h(represen)-31 b(t)368 b(matrices.)494 b(F)-92 b(or)368 b(example,)j(the)f(matrix:) 16151 52914 y 3486433 2631270 0 0 3486433 2631270 startTexFig 16151 52914 a %%BeginDocument: illustrations/matrix.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: matrix.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 10:02:32 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 53 40 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 40 moveto 0 0 lineto 53 0 lineto 53 40 lineto closepath clip newpath -61.0 102.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 1800 1050 m 1875 1050 l 1875 1687 l 1800 1687 l gs col0 s gr % Polyline n 1120 1050 m 1045 1050 l 1045 1687 l 1120 1687 l gs col0 s gr /Helvetica ff 165.00 scf sf 1200 1200 m gs 1 -1 sc (1 2 3) col0 sh gr /Helvetica ff 165.00 scf sf 1200 1650 m gs 1 -1 sc (7 8 9) col0 sh gr /Helvetica ff 165.00 scf sf 1200 1425 m gs 1 -1 sc (4 5 6) col0 sh gr $F2psEnd rs %%EndDocument endTexFig eop %%Page: 92 118 92 117 bop 0 -2070 a Fv(92)34300 b(Lists)p 0 -1627 38191 45 v 0 865 a Fn(migh)-31 b(t)371 b(b)31 b(e)369 b(represen)-31 b(ted)368 b(as:)0 3082 y Fk(>>>)582 b(matrix)g(=)f([[1,)h(2,)f(3],)h ([4,)f(5,)h(6],)f([7,)h(8,)f(9]])0 5299 y(matrix)344 b Fn(is)f(a)g(list)h(with)g(three)f(elemen)-31 b(ts,)350 b(where)342 b(eac)-31 b(h)344 b(elemen)-31 b(t)344 b(is)f(a)h(ro)-31 b(w)343 b(of)h(the)f(matrix.)0 6654 y(W)-92 b(e)368 b(can)i(select)f (an)h(en)-31 b(tire)370 b(ro)-31 b(w)369 b(from)h(the)f(matrix)i(in)f (the)f(usual)h(w)-31 b(a)g(y:)0 8870 y Fk(>>>)582 b(matrix[1])0 10225 y([4,)g(5,)f(6])0 12442 y Fn(Or)288 b(w)-31 b(e)290 b(can)f(extract)h(a)f(single)h(elemen)-31 b(t)291 b(from)e(the)g (matrix)i(using)e(the)h(double-index)g(form:)0 14659 y Fk(>>>)582 b(matrix[1][1])0 16014 y(5)0 18231 y Fn(The)439 b(\257rst)g(index)g(selects)g(the)g(ro)-31 b(w,)458 b(and)439 b(the)g(second)g(index)g(selects)g(the)g(column.)703 b(Al-)0 19586 y(though)261 b(this)e(w)-31 b(a)g(y)261 b(of)f(represen)-31 b(ting)260 b(matrices)g(is)f(common,)284 b(it)260 b(is)f(not)h(the)g(only)g(p)31 b(ossibilit)-31 b(y)-92 b(.)0 20940 y(A)390 b(small)h(v)-61 b(ariation)391 b(is)f(to)g(use)f(a)h(list)g(of)g(columns)h(instead)f(of)g(a)g(list)h (of)f(ro)-31 b(ws.)554 b(Later)389 b(w)-31 b(e)0 22295 y(will)371 b(see)e(a)g(more)g(radical)i(alternativ)-31 b(e)372 b(using)d(a)h(dictionary)-92 b(.)0 26765 y Fl(8.16)1792 b(Strings)600 b(and)e(lists)0 29234 y Fn(Tw)-31 b(o)380 b(of)g(the)f(most)h(useful)f(functions)h(in)f(the)g Fk(string)g Fn(mo)31 b(dule)380 b(in)-31 b(v)g(olv)g(e)382 b(lists)d(of)g(strings.) 0 30589 y(The)320 b Fk(split)g Fn(function)h(breaks)e(a)h(string)g(in) -31 b(to)321 b(a)f(list)g(of)g(w)-31 b(ords.)477 b(By)319 b(default,)332 b(an)-31 b(y)320 b(n)-31 b(um)g(b)31 b(er)0 31944 y(of)370 b(whitespace)g(c)-31 b(haracters)370 b(is)f(considered)g (a)g(w)-31 b(ord)370 b(b)31 b(oundary:)0 34161 y Fk(>>>)582 b(import)g(string)0 35516 y(>>>)g(song)f(=)h("The)f(rain)h(in)g (Spain...")0 36871 y(>>>)g(string.split\(song\))0 38226 y(['The',)g('rain',)g('in',)g('Spain...'])0 40443 y Fn(An)365 b(optional)i(argumen)-31 b(t)367 b(called)f(a)f Fv(delimiter)g Fn(can)g(b)31 b(e)364 b(used)g(to)i(sp)31 b(ecify)365 b(whic)-31 b(h)365 b(c)-31 b(harac-)0 41797 y(ters)330 b(to)h(use)f(as)g(w)-31 b(ord)331 b(b)31 b(oundaries.)480 b(The)331 b(follo)-31 b(wing)334 b(example)e(uses)d(the)i(string)g Fk(ai)f Fn(as)h(the)0 43152 y(delimiter:)0 45369 y Fk(>>>)582 b(string.split\(song,)h('ai'\))0 46724 y(['The)f(r',)f('n)h(in)f(Sp',)h ('n...'])0 48941 y Fn(Notice)371 b(that)f(the)f(delimiter)i(do)31 b(esn't)370 b(app)31 b(ear)369 b(in)h(the)f(list.)0 51077 y(The)330 b Fk(join)g Fn(function)h(is)e(the)h(in)-31 b(v)g(erse)329 b(of)h Fk(split)p Fn(.)480 b(It)330 b(tak)-31 b(es)330 b(a)g(list)g(of)g(strings)g(and)g(concate-)0 52432 y(nates)370 b(the)f(elemen)-31 b(ts)370 b(with)h(a)e(space)g(b)31 b(et)-31 b(w)g(een)370 b(eac)-31 b(h)370 b(pair:)0 54648 y Fk(>>>)582 b(list)f(=)h(['The',)g('rain',)g('in',)g('Spain...'])0 56003 y(>>>)g(string.join\(list\))0 57358 y('The)g(rain)f(in)h (Spain...')p eop %%Page: 93 119 93 118 bop 0 -2070 a Fv(8.17)425 b(Glossary)29420 b(93)p 0 -1627 38191 45 v 0 865 a Fn(Lik)-31 b(e)342 b Fk(split)p Fn(,)349 b Fk(join)342 b Fn(tak)-31 b(es)343 b(an)f(optional)i (delimiter)g(that)f(is)f(inserted)g(b)31 b(et)-31 b(w)g(een)342 b(elemen)-31 b(ts:)0 3111 y Fk(>>>)582 b(string.join\(list,)h('_'\))0 4466 y('The_rain_in_Spain...')5203 7193 y Fm(As)1094 b(an)h(exer)-57 b(cise,)1271 b(describ)-57 b(e)1096 b(the)f(r)-57 b(elationship)1095 b(b)-57 b(etwe)g(en)5203 8548 y Fk (string.join\(string.split\(song\)\))388 b Fm(and)c Fk(song)p Fm(.)506 b(A)-28 b(r)-57 b(e)384 b(they)5203 9903 y(the)395 b(same)h(for)g(al)57 b(l)396 b(strings?)508 b(When)396 b(would)f(they)i(b)-57 b(e)397 b(di\256er)-57 b(ent?)0 14413 y Fl(8.17)1792 b(Glossary)0 16579 y Fv(list:)552 b Fn(A)332 b(named)g(collection)j(of)d(ob)61 b(jects,)340 b(where)332 b(eac)-31 b(h)332 b(ob)61 b(ject)333 b(is)e(iden)-31 b(ti\257ed)333 b(b)-31 b(y)332 b(an)g(index.)0 18819 y Fv(index:)553 b Fn(An)370 b(in)-31 b(teger)370 b(v)-61 b(ariable)370 b(or)f(v)-61 b(alue)370 b(that)g(indicates)h(an)e(elemen) -31 b(t)371 b(of)e(a)h(list.)0 21060 y Fv(elemen)-35 b(t:)554 b Fn(One)340 b(of)i(the)f(v)-61 b(alues)340 b(in)i(a)f(list)g(\(or)g(other)g(sequence\).)484 b(The)341 b(brac)-31 b(k)g(et)341 b(op)31 b(erator)2767 22415 y(selects)370 b(elemen)-31 b(ts)370 b(of)g(a)f(list.)0 24655 y Fv(sequence:)555 b Fn(An)-31 b(y)461 b(of)g(the)h(data)g(t)-31 b(yp)31 b(es)461 b(that)h(consist)f(of)h(an)f(ordered)f(set)h(of)g(elemen)-31 b(ts,)2767 26010 y(with)371 b(eac)-31 b(h)369 b(elemen)-31 b(t)371 b(iden)-31 b(ti\257ed)371 b(b)-31 b(y)369 b(an)h(index.)0 28250 y Fv(nested)426 b(list:)552 b Fn(A)370 b(list)g(that)g(is)f(an)h (elemen)-31 b(t)370 b(of)g(another)g(list.)0 30491 y Fv(list)424 b(tra)-35 b(v)g(ersal:)552 b Fn(The)370 b(sequen)-31 b(tial)371 b(accessing)e(of)h(eac)-31 b(h)370 b(elemen)-31 b(t)370 b(in)g(a)f(list.)0 32731 y Fv(ob)71 b(ject:)554 b Fn(A)369 b(thing)h(to)g(whic)-31 b(h)370 b(a)g(v)-61 b(ariable)370 b(can)g(refer.)0 34972 y Fv(aliases:)553 b Fn(Multiple)370 b(v)-61 b(ariables)370 b(that)g(con)-31 b(tain)372 b(references)367 b(to)j(the)g(same)f(ob)61 b(ject.)0 37212 y Fv(clone:)554 b Fn(T)-92 b(o)431 b(create)g(a)g(new)g (ob)61 b(ject)432 b(that)g(has)f(the)g(same)g(v)-61 b(alue)431 b(as)g(an)g(existing)h(ob)61 b(ject.)2767 38567 y(Cop)-31 b(ying)475 b(a)d(reference)f(to)h(an)h(ob)61 b(ject)473 b(creates)f(an)g(alias)h(but)g(do)31 b(esn't)472 b(clone)h(the)2767 39922 y(ob)61 b(ject.)0 42163 y Fv(delimiter:)553 b Fn(A)284 b(c)-31 b(haracter)285 b(or)f(string)g(used)g(to)h(indicate)h(where)e (a)g(string)g(should)h(b)31 b(e)284 b(split.)p eop %%Page: 94 120 94 119 bop 0 -2070 a Fv(94)34300 b(Lists)p 0 -1627 38191 45 v eop %%Page: 95 121 95 120 bop 0 10119 a Fi(Chapter)861 b(9)0 16616 y Fo(T)-258 b(uples)0 23972 y Fl(9.1)1793 b(Mutabilit)-50 b(y)600 b(and)e(tuples)0 26590 y Fn(So)537 b(far,)579 b(y)-31 b(ou)537 b(ha)-31 b(v)g(e)537 b(seen)f(t)-31 b(w)g(o)538 b(comp)31 b(ound)538 b(t)-31 b(yp)31 b(es:)827 b(strings,)579 b(whic)-31 b(h)538 b(are)e(made)h(up)f(of)0 27945 y(c)-31 b(haracters;)469 b(and)435 b(lists,)453 b(whic)-31 b(h)436 b(are)f(made)g(up)g(of)h(elemen)-31 b(ts)436 b(of)g(an)-31 b(y)435 b(t)-31 b(yp)31 b(e.)691 b(One)435 b(of)h(the)0 29300 y(di\256erences)522 b(w)-31 b(e)523 b(noted)g(is)g(that)g(the)g (elemen)-31 b(ts)524 b(of)f(a)g(list)h(can)e(b)31 b(e)522 b(mo)31 b(di\257ed,)563 b(but)523 b(the)0 30655 y(c)-31 b(haracters)366 b(in)g(a)h(string)f(cannot.)493 b(In)366 b(other)g(w)-31 b(ords,)367 b(strings)f(are)g Fv(imm)-35 b(utable)365 b Fn(and)h(lists)0 32010 y(are)j Fv(m)-35 b(utable)p Fn(.)0 34261 y(There)399 b(is)h(another)g(t)-31 b(yp)31 b(e)400 b(in)g(Python)h(called)g(a)f Fv(tuple)g Fn(that)g(is)g(similar)h(to)f(a)g(list)g(except)0 35616 y(that)359 b(it)g(is)e(imm)-31 b(utable.)492 b(Syn)-31 b(tactically)-92 b(,)364 b(a)359 b(tuple)f(is)g(a)g(comma-separated)i (list)f(of)f(v)-61 b(alues:)0 37948 y Fk(>>>)582 b(tuple)f(=)h('a',)g ('b',)f('c',)h('d',)g('e')0 40279 y Fn(Although)356 b(it)f(is)f(not)h (necessary)-92 b(,)356 b(it)f(is)f(con)-31 b(v)g(en)g(tional)358 b(to)d(enclose)f(tuples)g(in)h(paren)-31 b(theses:)0 42611 y Fk(>>>)582 b(tuple)f(=)h(\('a',)g('b',)f('c',)h('d',)g('e'\))0 44943 y Fn(T)-92 b(o)370 b(create)f(a)h(tuple)g(with)g(a)f(single)h (elemen)-31 b(t,)372 b(w)-31 b(e)369 b(ha)-31 b(v)g(e)370 b(to)g(include)g(the)g(\257nal)g(comma:)0 47275 y Fk(>>>)582 b(t1)f(=)g(\('a',\))0 48630 y(>>>)h(type\(t1\))0 49985 y()0 52316 y Fn(Without)371 b(the)e(comma,)i(Python)g (treats)f Fk(\('a'\))f Fn(as)g(a)h(string)f(in)h(paren)-31 b(theses:)0 54648 y Fk(>>>)582 b(t2)f(=)g(\('a'\))0 56003 y(>>>)h(type\(t2\))0 57358 y()p eop %%Page: 96 122 96 121 bop 0 -2070 a Fv(96)33285 b(T)-106 b(uples)p 0 -1627 38191 45 v 0 865 a Fn(Syn)-31 b(tax)358 b(issues)e(aside,)361 b(the)c(op)31 b(erations)358 b(on)f(tuples)g(are)g(the)g(same)h(as)e (the)i(op)31 b(erations)358 b(on)0 2220 y(lists.)493 b(The)370 b(index)f(op)31 b(erator)370 b(selects)f(an)h(elemen)-31 b(t)370 b(from)g(a)f(tuple.)0 4383 y Fk(>>>)582 b(tuple)f(=)h(\('a',)g ('b',)f('c',)h('d',)g('e'\))0 5737 y(>>>)g(tuple[0])0 7092 y('a')0 9255 y Fn(And)369 b(the)h(slice)f(op)31 b(erator)370 b(selects)f(a)h(range)f(of)h(elemen)-31 b(ts.)0 11417 y Fk(>>>)582 b(tuple[1:3])0 12772 y(\('b',)g('c'\))0 14935 y Fn(But)370 b(if)f(w)-31 b(e)370 b(try)f(to)h(mo)31 b(dify)371 b(one)e(of)h(the)f(elemen)-31 b(ts)371 b(of)e(the)h(tuple,)g (w)-31 b(e)370 b(get)g(a)f(error:)0 17097 y Fk(>>>)582 b(tuple[0])g(=)f('A')0 18452 y(TypeError:)i(object)f(doesn't)g(support) g(item)g(assignment)0 20614 y Fn(Of)457 b(course,)479 b(ev)-31 b(en)458 b(if)g(w)-31 b(e)458 b(can't)g(mo)31 b(dify)459 b(the)e(elemen)-31 b(ts)459 b(of)e(a)h(tuple,)480 b(w)-31 b(e)458 b(can)g(replace)f(it)0 21969 y(with)370 b(a)g(di\256eren)-31 b(t)369 b(tuple:)0 24132 y Fk(>>>)582 b(tuple)f(=)h(\('A',\))g(+)f(tuple[1:])0 25487 y(>>>)h(tuple)0 26842 y(\('A',)g('b',)g('c',)f('d',)h('e'\))0 31316 y Fl(9.2)1793 b(T)-149 b(uple)598 b(assignmen)-50 b(t)0 33731 y Fn(Once)485 b(in)g(a)g(while,)515 b(it)486 b(is)f(useful)g(to)g (sw)-31 b(ap)486 b(the)f(v)-61 b(alues)485 b(of)g(t)-31 b(w)g(o)487 b(v)-61 b(ariables.)840 b(With)486 b(con-)0 35086 y(v)-31 b(en)g(tional)523 b(assignmen)-31 b(t)522 b(statemen)-31 b(ts,)560 b(w)-31 b(e)520 b(ha)-31 b(v)g(e)521 b(to)g(use)e(a)i(temp)31 b(orary)520 b(v)-61 b(ariable.)947 b(F)-92 b(or)0 36441 y(example,)371 b(to)f(sw)-31 b(ap)370 b Fk(a)f Fn(and)g Fk(b)p Fn(:)0 38604 y Fk(>>>)582 b(temp)f(=)h(a)0 39958 y(>>>)g(a)f(=)g(b)0 41313 y(>>>)h(b)f(=)g(temp)0 43476 y Fn(If)254 b(w)-31 b(e)254 b(ha)-31 b(v)g(e)254 b(to)h(do)f(this)g(often,)278 b(this)254 b(approac)-31 b(h)255 b(b)31 b(ecomes)254 b(cum)-31 b(b)31 b(ersome.)454 b(Python)256 b(pro)-31 b(vides)0 44831 y(a)369 b(form)h(of)g Fv(tuple)425 b(assignmen)-35 b(t)369 b Fn(that)i(solv)-31 b(es)370 b(this)f(problem)h(neatly:)0 46993 y Fk(>>>)582 b(a,)f(b)g(=)h(b,)f(a)0 49156 y Fn(The)297 b(left)g(side)f(is)g(a)h (tuple)g(of)g(v)-61 b(ariables;)322 b(the)296 b(righ)-31 b(t)298 b(side)e(is)g(a)h(tuple)g(of)g(v)-61 b(alues.)468 b(Eac)-31 b(h)297 b(v)-61 b(alue)0 50511 y(is)420 b(assigned)g(to)h (its)f(resp)31 b(ectiv)-31 b(e)420 b(v)-61 b(ariable.)645 b(All)421 b(the)f(expressions)f(on)h(the)h(righ)-31 b(t)420 b(side)g(are)0 51865 y(ev)-61 b(aluated)400 b(b)31 b(efore)398 b(an)-31 b(y)399 b(of)g(the)g(assignmen)-31 b(ts.)581 b(This)399 b(feature)g(mak)-31 b(es)399 b(tuple)g(assignmen)-31 b(t)0 53220 y(quite)370 b(v)-31 b(ersatile.)0 55302 y(Naturally)-92 b(,)380 b(the)d(n)-31 b(um)g(b)31 b(er)376 b(of)g(v)-61 b(ariables)377 b(on)f(the)h(left)g(and)f(the)g(n)-31 b(um)g(b)31 b(er)377 b(of)f(v)-61 b(alues)376 b(on)h(the)0 56657 y(righ)-31 b(t)370 b(ha)-31 b(v)g(e)370 b(to)g(b)31 b(e)369 b(the)g(same:)p eop %%Page: 97 123 97 122 bop 0 -2070 a Fv(9.3)425 b(T)-106 b(uples)424 b(as)h(return)g(v)-71 b(alues)21932 b(97)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(a,)f(b,)g(c,)h(d)f(=)h(1,)f(2,)g(3)0 2220 y(ValueError:)i(unpack)f(tuple)g(of)f(wrong)h(size)0 6910 y Fl(9.3)1793 b(T)-149 b(uples)598 b(as)g(return)i(v)-100 b(alues)0 9454 y Fn(F)-92 b(unctions)466 b(can)f(return)g(tuples)h(as)f (return)g(v)-61 b(alues.)781 b(F)-92 b(or)465 b(example,)491 b(w)-31 b(e)466 b(could)g(write)h(a)0 10809 y(function)371 b(that)f(sw)-31 b(aps)369 b(t)-31 b(w)g(o)371 b(parameters:)0 13088 y Fk(def)582 b(swap\(x,)g(y\):)1162 14443 y(return)g(y,)g(x)0 16722 y Fn(Then)369 b(w)-31 b(e)370 b(can)g(assign)f(the)h(return)e(v) -61 b(alue)370 b(to)g(a)f(tuple)h(with)h(t)-31 b(w)g(o)370 b(v)-61 b(ariables:)0 19000 y Fk(a,)581 b(b)h(=)f(swap\(a,)h(b\))0 21279 y Fn(In)453 b(this)h(case,)475 b(there)453 b(is)h(no)g(great)g (adv)-61 b(an)-31 b(tage)456 b(in)e(making)h Fk(swap)f Fn(a)g(function.)747 b(In)453 b(fact,)0 22634 y(there)334 b(is)g(a)h(danger)g(in)f(trying)i(to)f(encapsulate)g Fk(swap)p Fn(,)343 b(whic)-31 b(h)335 b(is)f(the)h(follo)-31 b(wing)338 b(tempting)0 23989 y(mistak)-31 b(e:)0 26268 y Fk(def)582 b(swap\(x,)g(y\):)3487 b(#)581 b(incorrect)i(version)1162 27623 y(x,)f(y)f(=)g(y,)h(x)0 29902 y Fn(If)369 b(w)-31 b(e)370 b(call)g(this)g(function)g(lik)-31 b(e)371 b(this:)0 32180 y Fk(swap\(a,)582 b(b\))0 34459 y Fn(then)490 b Fk(a)f Fn(and)g Fk(x)h Fn(are)f(aliases)h(for)f(the)h(same)g(v)-61 b(alue.)853 b(Changing)491 b Fk(x)f Fn(inside)f Fk(swap)h Fn(mak)-31 b(es)0 35814 y Fk(x)495 b Fn(refer)f(to)i(a)f(di\256eren)-31 b(t)495 b(v)-61 b(alue,)528 b(but)495 b(it)h(has)e(no)i(e\256ect)f(on)g Fk(a)g Fn(in)p 28531 35814 349 45 v 28949 35814 V 1332 w Fk(main)p 31692 35814 V 32111 35814 V 837 w Fn(.)870 b(Similarly)-92 b(,)0 37169 y(c)-31 b(hanging)371 b Fk(y)e Fn(has)g(no)h(e\256ect)f(on)g Fk(b)p Fn(.)0 39367 y(This)353 b(function)g(runs)e(without)k(pro)31 b(ducing)353 b(an)f(error)f (message,)357 b(but)352 b(it)h(do)31 b(esn't)353 b(do)g(what)0 40722 y(w)-31 b(e)370 b(in)-31 b(tended.)493 b(This)370 b(is)f(an)g(example)i(of)f(a)f(seman)-31 b(tic)371 b(error.)2767 43430 y Fm(As)456 b(an)h(exer)-57 b(cise,)472 b(dr)-57 b(aw)456 b(a)g(state)f(diagr)-57 b(am)457 b(for)f(this)g(function)i(so) e(that)f(you)2767 44785 y(c)-57 b(an)397 b(se)-57 b(e)397 b(why)e(it)i(do)-57 b(esn)-113 b('t)396 b(work.)0 49394 y Fl(9.4)1793 b(Random)597 b(n)-50 b(um)g(b)50 b(ers)0 51938 y Fn(Most)287 b(computer)g(programs)h(do)f(the)g(same)g(thing)h (ev)-31 b(ery)287 b(time)h(they)f(execute,)304 b(so)287 b(they)g(are)0 53293 y(said)296 b(to)h(b)31 b(e)295 b Fv(deterministic)p Fn(.)469 b(Determinism)297 b(is)e(usually)i(a)g(go) 31 b(o)g(d)296 b(thing,)313 b(since)295 b(w)-31 b(e)297 b(exp)31 b(ect)0 54648 y(the)428 b(same)g(calculation)j(to)e(yield)g (the)f(same)g(result.)669 b(F)-92 b(or)427 b(some)h(applications,)446 b(though,)0 56003 y(w)-31 b(e)320 b(w)-31 b(an)g(t)321 b(the)f(computer)h(to)f(b)31 b(e)319 b(unpredictable.)477 b(Games)320 b(are)f(an)h(ob)-31 b(vious)321 b(example,)332 b(but)0 57358 y(there)369 b(are)g(more.)p eop %%Page: 98 124 98 123 bop 0 -2070 a Fv(98)33285 b(T)-106 b(uples)p 0 -1627 38191 45 v 0 865 a Fn(Making)329 b(a)e(program)h(truly)g (nondeterministic)i(turns)d(out)h(to)g(b)31 b(e)327 b(not)h(so)f(easy) -92 b(,)337 b(but)327 b(there)0 2220 y(are)428 b(w)-31 b(a)g(ys)429 b(to)g(mak)-31 b(e)430 b(it)f(at)g(least)g(seem)f (nondeterministic.)672 b(One)427 b(of)i(them)g(is)f(to)h(gener-)0 3575 y(ate)414 b(random)f(n)-31 b(um)g(b)31 b(ers)413 b(and)g(use)g(them)g(to)h(determine)g(the)f(outcome)i(of)e(the)h (program.)0 4930 y(Python)441 b(pro)-31 b(vides)439 b(a)h(built-in)h (function)f(that)h(generates)e Fv(pseudorandom)j Fn(n)-31 b(um)g(b)31 b(ers,)0 6285 y(whic)-31 b(h)467 b(are)f(not)h(truly)f (random)h(in)g(the)f(mathematical)k(sense,)490 b(but)466 b(for)g(our)g(purp)31 b(oses)0 7640 y(they)370 b(will)h(do.)0 9947 y(The)407 b Fk(random)h Fn(mo)31 b(dule)408 b(con)-31 b(tains)409 b(a)f(function)g(called)h Fk(random)f Fn(that)g(returns)e (a)i(\260oating-)0 11302 y(p)31 b(oin)-31 b(t)319 b(n)-31 b(um)g(b)31 b(er)318 b(b)31 b(et)-31 b(w)g(een)318 b(0.0)h(and)f(1.0.) 477 b(Eac)-31 b(h)318 b(time)h(y)-31 b(ou)319 b(call)g Fk(random)p Fn(,)329 b(y)-31 b(ou)318 b(get)h(the)e(next)0 12656 y(n)-31 b(um)g(b)31 b(er)369 b(in)h(a)f(long)i(series.)491 b(T)-92 b(o)370 b(see)f(a)g(sample,)i(run)d(this)i(lo)31 b(op:)0 15044 y Fk(import)582 b(random)0 17754 y(for)g(i)f(in)g (range\(10\):)1162 19109 y(x)h(=)f(random.random\(\))1162 20464 y(print)h(x)0 22852 y Fn(T)-92 b(o)546 b(generate)h(a)f(random)h (n)-31 b(um)g(b)31 b(er)546 b(b)31 b(et)-31 b(w)g(een)547 b(0.0)g(and)g(an)f(upp)31 b(er)545 b(b)31 b(ound)546 b(lik)-31 b(e)547 b Fk(high)p Fn(,)0 24207 y(m)-31 b(ultiply)372 b Fk(x)d Fn(b)-31 b(y)369 b Fk(high)p Fn(.)2767 27126 y Fm(As)396 b(an)g(exer)-57 b(cise,)397 b(gener)-57 b(ate)397 b(a)f(r)-57 b(andom)396 b(numb)-57 b(er)397 b(b)-57 b(etwe)g(en)398 b Fk(low)e Fm(and)g Fk(high)p Fm(.)2767 30045 y(As)489 b(an)h(additional)f(exer)-57 b(cise,)514 b(gener)-57 b(ate)491 b(a)e(r)-57 b(andom)490 b Fn(in)-31 b(teger)490 b Fm(b)-57 b(etwe)g(en)491 b Fk(low)2767 31400 y Fm(and)396 b Fk(high)p Fm(,)h(including)h(b)-57 b(oth)396 b(end)h(p)-57 b(oints.)0 36336 y Fl(9.5)1793 b(List)599 b(of)e(random)i(n)-50 b(um)g(b)50 b(ers)0 39033 y Fn(The)273 b(\257rst)g(step)g(is)g(to)i (generate)e(a)h(list)g(of)g(random)g(v)-61 b(alues.)461 b Fk(randomList)274 b Fn(tak)-31 b(es)274 b(an)g(in)-31 b(teger)0 40388 y(parameter)313 b(and)g(returns)f(a)h(list)g(of)g (random)h(n)-31 b(um)g(b)31 b(ers)312 b(with)i(the)e(giv)-31 b(en)314 b(length.)475 b(It)313 b(starts)0 41743 y(with)286 b(a)f(list)h(of)f Fk(n)g Fn(zeros.)464 b(Eac)-31 b(h)286 b(time)g(through)g(the)f(lo)31 b(op,)303 b(it)286 b(replaces)e(one)h (of)h(the)f(elemen)-31 b(ts)0 43098 y(with)370 b(a)g(random)g(n)-31 b(um)g(b)31 b(er.)492 b(The)370 b(return)e(v)-61 b(alue)370 b(is)f(a)h(reference)e(to)i(the)f(complete)i(list:)0 45486 y Fk(def)582 b(randomList\(n\):)1162 46841 y(s)g(=)f([0])g(*)h(n) 1162 48196 y(for)g(i)f(in)h(range\(n\):)2325 49551 y(s[i])f(=)h (random.random\(\))1162 50905 y(return)g(s)0 53293 y Fn(W)-92 b(e'll)320 b(test)g(this)g(function)h(with)g(a)f(list)g(of)g (eigh)-31 b(t)321 b(elemen)-31 b(ts.)478 b(F)-92 b(or)318 b(purp)31 b(oses)319 b(of)h(debugging,)0 54648 y(it)370 b(is)f(a)h(go)31 b(o)g(d)369 b(idea)h(to)g(start)g(small.)p eop %%Page: 99 125 99 124 bop 0 -2070 a Fv(9.6)425 b(Coun)-35 b(ting)29740 b(99)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(randomList\(8\))0 2220 y(0.15156642489)0 3575 y(0.498048560109)0 4930 y(0.810894847068)0 6285 y(0.360371157682)0 7640 y(0.275119183077)0 8995 y(0.328578797631)0 10350 y(0.759199803101)0 11705 y(0.800367163582)0 13953 y Fn(The)466 b(n)-31 b(um)g(b)31 b(ers)465 b(generated)h(b)-31 b(y)466 b Fk(random)g Fn(are)f(supp)31 b(osed)465 b(to)h(b)31 b(e)465 b(distributed)h(uniformly)-92 b(,)0 15308 y(whic)-31 b(h)370 b(means)g(that)g(ev)-31 b(ery)369 b(v)-61 b(alue)370 b(is)f(equally)i(lik)-31 b(ely)-92 b(.)0 17475 y(If)404 b(w)-31 b(e)404 b(divide)h(the)g(range)f(of)h(p)31 b(ossible)404 b(v)-61 b(alues)404 b(in)-31 b(to)406 b(equal-sized)f(\\buc)-31 b(k)g(ets,")415 b(and)404 b(coun)-31 b(t)0 18830 y(the)341 b(n)-31 b(um)g(b)31 b(er)340 b(of)h(times)g(a)g(random)g(v)-61 b(alue)341 b(falls)h(in)e(eac)-31 b(h)341 b(buc)-31 b(k)g(et,)348 b(w)-31 b(e)341 b(should)g(get)g(roughly)0 20184 y(the)369 b(same)h(n)-31 b(um)g(b)31 b(er)369 b(in)h(eac)-31 b(h.)0 22352 y(W)-92 b(e)392 b(can)i(test)f(this)h(theory)f(b)-31 b(y)394 b(writing)h(a)e(program)h(to)g(divide)g(the)f(range)h(in)-31 b(to)394 b(buc)-31 b(k)g(ets)0 23706 y(and)369 b(coun)-31 b(t)371 b(the)e(n)-31 b(um)g(b)31 b(er)369 b(of)h(v)-61 b(alues)369 b(in)h(eac)-31 b(h.)0 28223 y Fl(9.6)1793 b(Coun)-50 b(ting)0 30724 y Fn(A)290 b(go)31 b(o)g(d)291 b(approac)-31 b(h)291 b(to)g(problems)g(lik)-31 b(e)291 b(this)g(is)f(to)h(divide)g(the)f(problem)h(in)-31 b(to)292 b(subproblems)0 32079 y(and)305 b(lo)31 b(ok)307 b(for)e(subproblems)g (that)h(\257t)g(a)f(computational)k(pattern)d(y)-31 b(ou)306 b(ha)-31 b(v)g(e)306 b(seen)f(b)31 b(efore.)0 34246 y(In)284 b(this)h(case,)301 b(w)-31 b(e)285 b(w)-31 b(an)g(t)286 b(to)f(tra)-31 b(v)g(erse)285 b(a)f(list)i(of)e(n)-31 b(um)g(b)31 b(ers)284 b(and)h(coun)-31 b(t)285 b(the)g(n)-31 b(um)g(b)31 b(er)284 b(of)h(times)0 35601 y(a)370 b(v)-61 b(alue)369 b(falls)i(in)f(a)f(giv)-31 b(en)371 b(range.)493 b(That)371 b(sounds)e(familiar.)495 b(In)369 b(Section)i(7.8,)g(w)-31 b(e)370 b(wrote)g(a)0 36956 y(program)343 b(that)h(tra)-31 b(v)g(ersed)343 b(a)f(string)h(and)g(coun)-31 b(ted)343 b(the)g(n)-31 b(um)g(b)31 b(er)342 b(of)h(times)h(a)e(giv)-31 b(en)344 b(letter)0 38311 y(app)31 b(eared.)0 40478 y(So,)362 b(w)-31 b(e)359 b(can)g(pro)31 b(ceed)359 b(b)-31 b(y)359 b(cop)-31 b(ying)361 b(the)e(old)g(program)h(and)f(adapting)i(it)f(for) f(the)g(curren)-31 b(t)0 41833 y(problem.)493 b(The)370 b(original)h(program)f(w)-31 b(as:)0 44081 y Fk(count)582 b(=)f(0)0 45436 y(for)h(char)f(in)h(fruit:)1162 46791 y(if)g(char)f(==)h('a':)2325 48146 y(count)f(=)h(count)g(+)f(1)0 49501 y(print)h(count)0 51749 y Fn(The)396 b(\257rst)e(step)i(is)f(to)h (replace)f Fk(fruit)h Fn(with)h Fk(list)f Fn(and)f Fk(char)h Fn(with)g Fk(num)p Fn(.)572 b(That)396 b(do)31 b(esn't)0 53104 y(c)-31 b(hange)370 b(the)g(program;)g(it)g(just)f(mak)-31 b(es)370 b(it)g(more)g(readable.)0 55271 y(The)428 b(second)f(step)h (is)f(to)i(c)-31 b(hange)428 b(the)g(test.)668 b(W)-92 b(e)427 b(aren't)i(in)-31 b(terested)428 b(in)g(\257nding)g(letters.)0 56626 y(W)-92 b(e)368 b(w)-31 b(an)g(t)371 b(to)f(see)f(if)h Fk(num)f Fn(is)g(b)31 b(et)-31 b(w)g(een)370 b(the)g(giv)-31 b(en)370 b(v)-61 b(alues)369 b Fk(low)h Fn(and)f Fk(high)p Fn(.)p eop %%Page: 100 126 100 125 bop 0 -2070 a Fv(100)32649 b(T)-106 b(uples)p 0 -1627 38191 45 v 0 865 a Fk(count)582 b(=)f(0)0 2220 y(for)h(num)f(in)h(list)1162 3575 y(if)g(low)f(<)h(num)f(<)h(high:)2325 4930 y(count)f(=)h(count)g(+)f(1)0 6285 y(print)h(count)0 8568 y Fn(The)455 b(last)h(step)f(is)f(to)i(encapsulate)g(this)f(co)31 b(de)455 b(in)g(a)h(function)g(called)g Fk(inBucket)p Fn(.)751 b(The)0 9923 y(parameters)370 b(are)f(the)g(list)h(and)g(the)f (v)-61 b(alues)369 b Fk(low)h Fn(and)f Fk(high)p Fn(.)0 12205 y Fk(def)582 b(inBucket\(list,)h(low,)f(high\):)1162 13560 y(count)g(=)f(0)1162 14915 y(for)h(num)f(in)h(list:)2325 16270 y(if)f(low)h(<)f(num)h(<)f(high:)3487 17625 y(count)h(=)f(count)h (+)f(1)1162 18980 y(return)h(count)0 21263 y Fn(By)547 b(cop)-31 b(ying)548 b(and)f(mo)31 b(difying)549 b(an)e(existing)h (program,)592 b(w)-31 b(e)548 b(w)-31 b(ere)546 b(able)i(to)f(write)h (this)0 22618 y(function)462 b(quic)-31 b(kly)461 b(and)g(sa)-31 b(v)g(e)460 b(a)h(lot)g(of)g(debugging)h(time.)766 b(This)461 b(dev)-31 b(elopmen)g(t)462 b(plan)f(is)0 23973 y(called)357 b Fv(pattern)411 b(matc)-35 b(hing)p Fn(.)488 b(If)356 b(y)-31 b(ou)357 b(\257nd)f(y)-31 b(ourself)357 b(w)-31 b(orking)358 b(on)e(a)h(problem)g(y)-31 b(ou)357 b(ha)-31 b(v)g(e)0 25327 y(solv)g(ed)370 b(b)31 b(efore,)369 b(reuse)g(the)g (solution.)0 29948 y Fl(9.7)1793 b(Man)-50 b(y)598 b(buc)-50 b(k)g(ets)0 32498 y Fn(As)368 b(the)g(n)-31 b(um)g(b)31 b(er)368 b(of)h(buc)-31 b(k)g(ets)368 b(increases,)h Fk(inBucket)g Fn(gets)f(a)h(little)h(un)-31 b(wieldy)-92 b(.)494 b(With)368 b(t)-31 b(w)g(o)0 33853 y(buc)g(k)g(ets,)370 b(it's)g(not)g(bad:)0 36136 y Fk(low)582 b(=)f(inBucket\(a,)i(0.0,)e (0.5\))0 37491 y(high)h(=)f(inBucket\(a,)i(0.5,)f(1\))0 39773 y Fn(But)370 b(with)g(four)f(buc)-31 b(k)g(ets)370 b(it)g(is)f(getting)i(cum)-31 b(b)31 b(ersome.)0 42056 y Fk(bucket1)582 b(=)f(inBucket\(a,)i(0.0,)f(0.25\))0 43411 y(bucket2)g(=)f(inBucket\(a,)i(0.25,)f(0.5\))0 44766 y(bucket3)g(=)f(inBucket\(a,)i(0.5,)f(0.75\))0 46121 y(bucket4)g(=)f(inBucket\(a,)i(0.75,)f(1.0\))0 48404 y Fn(There)404 b(are)f(t)-31 b(w)g(o)406 b(problems.)596 b(One)404 b(is)g(that)h(w)-31 b(e)404 b(ha)-31 b(v)g(e)405 b(to)f(mak)-31 b(e)405 b(up)f(new)g(v)-61 b(ariable)405 b(names)0 49759 y(for)314 b(eac)-31 b(h)314 b(result.)474 b(The)314 b(other)g(is)f(that)i(w)-31 b(e)314 b(ha)-31 b(v)g(e)315 b(to)f(compute)h(the)f(range)g(for)f(eac)-31 b(h)314 b(buc)-31 b(k)g(et.)0 51960 y(W)-92 b(e'll)415 b(solv)-31 b(e)416 b(the)f(second)f(problem)i(\257rst.)628 b(If)415 b(the)g(n)-31 b(um)g(b)31 b(er)414 b(of)h(buc)-31 b(k)g(ets)416 b(is)e Fk(numBuckets)p Fn(,)0 53315 y(then)369 b(the)h(width)g(of)g(eac)-31 b(h)370 b(buc)-31 b(k)g(et)370 b(is)f Fk(1.0)581 b(/)h(numBuckets)p Fn(.)0 55517 y(W)-92 b(e'll)466 b(use)e(a)i(lo)31 b(op)466 b(to)g(compute)g(the)f(range)h (of)f(eac)-31 b(h)466 b(buc)-31 b(k)g(et.)781 b(The)466 b(lo)31 b(op)466 b(v)-61 b(ariable,)490 b Fk(i)p Fn(,)0 56872 y(coun)-31 b(ts)370 b(from)g(0)f(to)h Fk(numBuckets-1)p Fn(:)p eop %%Page: 101 127 101 126 bop 0 -2070 a Fv(9.7)425 b(Man)-35 b(y)424 b(buc)-35 b(k)g(ets)26473 b(101)p 0 -1627 38191 45 v 0 865 a Fk(bucketWidth)583 b(=)e(1.0)h(/)f(numBuckets)0 2220 y(for)h(i)f(in)g (range\(numBuckets\):)1162 3575 y(low)h(=)f(i)g(*)h(bucketWidth)1162 4930 y(high)g(=)f(low)h(+)f(bucketWidth)1162 6285 y(print)h(low,)g ("to",)g(high)0 8340 y Fn(T)-92 b(o)430 b(compute)g(the)g(lo)-31 b(w)431 b(end)e(of)h(eac)-31 b(h)430 b(buc)-31 b(k)g(et,)446 b(w)-31 b(e)430 b(m)-31 b(ultiply)432 b(the)d(lo)31 b(op)431 b(v)-61 b(ariable)430 b(b)-31 b(y)430 b(the)0 9695 y(buc)-31 b(k)g(et)370 b(width.)494 b(The)369 b(high)h(end)f(is)g(just)h(a)f Fk(bucketWidth)i Fn(a)-31 b(w)g(a)g(y)-92 b(.)0 11668 y(With)370 b Fk(numBuckets)582 b(=)g(8)p Fn(,)369 b(the)h(output)g(is:) 0 13723 y Fk(0.0)582 b(to)f(0.125)0 15078 y(0.125)h(to)f(0.25)0 16433 y(0.25)h(to)f(0.375)0 17788 y(0.375)h(to)f(0.5)0 19143 y(0.5)h(to)f(0.625)0 20498 y(0.625)h(to)f(0.75)0 21853 y(0.75)h(to)f(0.875)0 23208 y(0.875)h(to)f(1.0)0 25263 y Fn(Y)-92 b(ou)419 b(can)g(con\257rm)g(that)h(eac)-31 b(h)420 b(buc)-31 b(k)g(et)419 b(is)g(the)g(same)h(width,)432 b(that)421 b(they)e(don't)h(o)-31 b(v)g(erlap,)0 26618 y(and)369 b(that)i(they)f(co)-31 b(v)g(er)369 b(the)h(en)-31 b(tire)369 b(range)h(from)g(0.0)g(to)g(1.0.)0 28592 y(No)-31 b(w)335 b(bac)-31 b(k)335 b(to)g(the)f(\257rst)f(problem.)482 b(W)-92 b(e)333 b(need)h(a)g(w)-31 b(a)g(y)335 b(to)g(store)f(eigh)-31 b(t)335 b(in)-31 b(tegers,)342 b(using)335 b(the)0 29946 y(lo)31 b(op)346 b(v)-61 b(ariable)345 b(to)h(indicate)g(one)f(at)g(a)g (time.)486 b(By)344 b(no)-31 b(w)346 b(y)-31 b(ou)345 b(should)g(b)31 b(e)344 b(thinking,)352 b(\\List!")0 31920 y(W)-92 b(e)367 b(ha)-31 b(v)g(e)369 b(to)f(create)g(the)g(buc) -31 b(k)g(et)369 b(list)f(outside)h(the)f(lo)31 b(op,)369 b(b)31 b(ecause)368 b(w)-31 b(e)368 b(only)h(w)-31 b(an)g(t)369 b(to)g(do)0 33275 y(it)438 b(once.)698 b(Inside)437 b(the)g(lo)31 b(op,)456 b(w)-31 b(e'll)439 b(call)g Fk(inBucket)f Fn(rep)31 b(eatedly)438 b(and)g(up)31 b(date)438 b(the)g Fk(i)p Fn(-eth)0 34630 y(elemen)-31 b(t)371 b(of)e(the)h(list:)0 36685 y Fk(numBuckets)583 b(=)e(8)0 38040 y(buckets)h(=)f([0])h(*)f (numBuckets)0 39395 y(bucketWidth)i(=)e(1.0)h(/)f(numBuckets)0 40750 y(for)h(i)f(in)g(range\(numBuckets\):)1162 42105 y(low)h(=)f(i)g(*)h(bucketWidth)1162 43460 y(high)g(=)f(low)h(+)f (bucketWidth)1162 44815 y(buckets[i])i(=)e(inBucket\(list,)i(low,)f (high\))0 46170 y(print)g(buckets)0 48224 y Fn(With)370 b(a)f(list)h(of)g(1000)h(v)-61 b(alues,)370 b(this)f(co)31 b(de)369 b(pro)31 b(duces)369 b(this)g(buc)-31 b(k)g(et)370 b(list:)0 50279 y Fk([138,)582 b(124,)g(128,)f(118,)h(130,)g(117,)g (114,)f(131])0 52334 y Fn(These)299 b(n)-31 b(um)g(b)31 b(ers)300 b(are)f(fairly)i(close)f(to)g(125,)315 b(whic)-31 b(h)301 b(is)e(what)i(w)-31 b(e)300 b(exp)31 b(ected.)469 b(A)-31 b(t)301 b(least,)314 b(they)0 53689 y(are)369 b(close)h(enough)f(that)i(w)-31 b(e)370 b(can)f(b)31 b(eliev)-31 b(e)370 b(the)f(random)h(n)-31 b(um)g(b)31 b(er)370 b(generator)g(is)f(w)-31 b(orking.)2767 55788 y Fm(As)435 b(an)g(exer)-57 b(cise,)445 b(test)434 b(this)h(function)h (with)e(some)h(longer)g(lists,)444 b(and)435 b(se)-57 b(e)435 b(if)2767 57143 y(the)396 b(numb)-57 b(er)397 b(of)g(values)f(in)g(e)-57 b(ach)397 b(bucket)f(tends)g(to)g(level)g (o\256.)p eop %%Page: 102 128 102 127 bop 0 -2070 a Fv(102)32649 b(T)-106 b(uples)p 0 -1627 38191 45 v 0 865 a Fl(9.8)1793 b(A)598 b(single-pass)h (solution)0 3903 y Fn(Although)358 b(this)f(program)g(w)-31 b(orks,)360 b(it)d(is)f(not)h(as)g(e\261cien)-31 b(t)357 b(as)g(it)g(could)g(b)31 b(e.)488 b(Ev)-31 b(ery)357 b(time)g(it)0 5257 y(calls)372 b Fk(inBucket)p Fn(,)g(it)g(tra)-31 b(v)g(erses)370 b(the)h(en)-31 b(tire)371 b(list.)498 b(As)371 b(the)g(n)-31 b(um)g(b)31 b(er)370 b(of)i(buc)-31 b(k)g(ets)371 b(increases,)0 6612 y(that)f(gets)g(to)g(b)31 b(e)369 b(a)g(lot)i(of)e(tra)-31 b(v)g(ersals.)0 9162 y(It)363 b(w)-31 b(ould)364 b(b)31 b(e)362 b(b)31 b(etter)363 b(to)h(mak)-31 b(e)364 b(a)f(single)h(pass)e(through)i(the)f(list)g (and)h(compute)g(for)e(eac)-31 b(h)0 10517 y(v)-61 b(alue)507 b(the)h(index)f(of)h(the)f(buc)-31 b(k)g(et)508 b(in)f(whic)-31 b(h)508 b(it)g(falls.)907 b(Then)507 b(w)-31 b(e)508 b(can)f(incremen)-31 b(t)508 b(the)0 11872 y(appropriate)370 b(coun)-31 b(ter.)0 14422 y(In)737 b(the)g(previous)h(section)g(w)-31 b(e)738 b(to)31 b(ok)738 b(an)g(index,)830 b Fk(i)p Fn(,)f(and)738 b(m)-31 b(ultiplied)740 b(it)e(b)-31 b(y)738 b(the)0 15777 y Fk(bucketWidth)394 b Fn(to)f(\257nd)f(the)g(lo)-31 b(w)g(er)394 b(b)31 b(ound)392 b(of)h(a)f(giv)-31 b(en)394 b(buc)-31 b(k)g(et.)562 b(No)-31 b(w)394 b(w)-31 b(e)393 b(w)-31 b(an)g(t)394 b(to)f(tak)-31 b(e)0 17132 y(a)369 b(v)-61 b(alue)370 b(in)g(the)f(range)g(0.0)i(to)f(1.0)g(and)g(\257nd)f (the)g(index)h(of)f(the)h(buc)-31 b(k)g(et)370 b(where)f(it)h(falls.)0 19682 y(Since)387 b(this)f(problem)h(is)g(the)f(in)-31 b(v)g(erse)387 b(of)g(the)f(previous)h(problem,)392 b(w)-31 b(e)387 b(migh)-31 b(t)388 b(guess)e(that)0 21037 y(w)-31 b(e)334 b(should)f(divide)h(b)-31 b(y)334 b Fk(bucketWidth)g Fn(instead)g(of)g(m)-31 b(ultiplying.)484 b(That)335 b(guess)d(is)i(correct.)0 23587 y(Since)250 b Fk(bucketWidth)583 b(=)f(1.0)f(/)g(numBuckets)p Fn(,)276 b(dividing)253 b(b)-31 b(y)250 b Fk(bucketWidth)i Fn(is)e(the)h(same)0 24942 y(as)361 b(m)-31 b(ultiplying)365 b(b)-31 b(y)362 b Fk(numBuckets)p Fn(.)491 b(If)361 b(w)-31 b(e)362 b(m)-31 b(ultiply)364 b(a)e(n)-31 b(um)g(b)31 b(er)361 b(in)h(the)f(range)h (0.0)h(to)f(1.0)0 26296 y(b)-31 b(y)418 b Fk(numBuckets)p Fn(,)432 b(w)-31 b(e)418 b(get)h(a)f(n)-31 b(um)g(b)31 b(er)418 b(in)g(the)g(range)g(from)g(0.0)h(to)g Fk(numBuckets)p Fn(.)640 b(If)417 b(w)-31 b(e)0 27651 y(round)290 b(that)h(n)-31 b(um)g(b)31 b(er)290 b(to)h(the)f(next)h(lo)-31 b(w)g(er)291 b(in)-31 b(teger,)308 b(w)-31 b(e)290 b(get)h(exactly)h(what)f(w)-31 b(e)291 b(are)f(lo)31 b(oking)0 29006 y(for|a)370 b(buc)-31 b(k)g(et)370 b(index:)0 31637 y Fk(numBuckets)583 b(=)e(8)0 32992 y(buckets)h(=)f([0])h(*)f(numBuckets)0 34347 y(for)h(i)f(in)g (list:)1162 35702 y(index)h(=)f(int\(i)h(*)g(numBuckets\))1162 37057 y(buckets[index])i(=)d(buckets[index])i(+)e(1)0 39688 y Fn(W)-92 b(e)368 b(used)h(the)g Fk(int)h Fn(function)g(to)g (con)-31 b(v)g(ert)371 b(a)e(\260oating-p)31 b(oin)-31 b(t)373 b(n)-31 b(um)g(b)31 b(er)369 b(to)h(an)f(in)-31 b(teger.)0 42238 y(Is)316 b(it)i(p)31 b(ossible)318 b(for)f(this)g (calculation)j(to)e(pro)31 b(duce)317 b(an)g(index)h(that)g(is)f(out)h (of)g(range)f(\(either)0 43593 y(negativ)-31 b(e)371 b(or)e(greater)h(than)g Fk(len\(buckets\)-1)p Fn(\)?)0 46143 y(A)388 b(list)h(lik)-31 b(e)390 b Fk(buckets)f Fn(that)h(con)-31 b(tains)390 b(coun)-31 b(ts)388 b(of)h(the)g(n)-31 b(um)g(b)31 b(er)388 b(of)h(v)-61 b(alues)388 b(in)h(eac)-31 b(h)389 b(range)0 47498 y(is)369 b(called)i(a)e Fv(histogram)p Fn(.)2767 50885 y Fm(As)452 b(an)g(exer)-57 b(cise,)467 b(write)451 b(a)h(function)h(c)-57 b(al)57 b(le)-57 b(d)453 b Fk(histogram)g Fm(that)e(takes)g(a)h(list)2767 52240 y(and)343 b(a)g(numb)-57 b(er)344 b(of)f(buckets)h(as)e(p)-57 b(ar)g(ameters)343 b(and)f(r)-57 b(eturns)343 b(a)g(histo)-57 b(gr)g(am)343 b(with)2767 53595 y(the)396 b(given)i(numb)-57 b(er)397 b(of)f(buckets.)p eop %%Page: 103 129 103 128 bop 0 -2070 a Fv(9.9)425 b(Glossary)29420 b(103)p 0 -1627 38191 45 v 0 865 a Fl(9.9)1793 b(Glossary)0 3030 y Fv(imm)-35 b(utable)424 b(t)-35 b(yp)35 b(e:)553 b Fn(A)395 b(t)-31 b(yp)31 b(e)395 b(in)g(whic)-31 b(h)396 b(the)f(elemen)-31 b(ts)395 b(cannot)h(b)31 b(e)395 b(mo)31 b(di\257ed.)570 b(Assign-)2767 4385 y(men)-31 b(ts)370 b(to)g(elemen)-31 b(ts)370 b(or)f(slices)h(of)f(imm)-31 b(utable)372 b(t)-31 b(yp)31 b(es)370 b(cause)f(an)g(error.)0 6626 y Fv(m)-35 b(utable)424 b(t)-35 b(yp)35 b(e:)554 b Fn(A)418 b(data)h(t)-31 b(yp)31 b(e)418 b(in)g(whic)-31 b(h)418 b(the)g(elemen)-31 b(ts)419 b(can)f(b)31 b(e)417 b(mo)31 b(di\257ed.)640 b(All)418 b(m)-31 b(u-)2767 7981 y(table)382 b(t)-31 b(yp)31 b(es)380 b(are)f(comp)31 b(ound)381 b(t)-31 b(yp)31 b(es.)525 b(Lists)380 b(and)g(dictionaries)i (are)e(m)-31 b(utable)382 b(data)2767 9336 y(t)-31 b(yp)31 b(es;)370 b(strings)f(and)h(tuples)f(are)g(not.)0 11576 y Fv(tuple:)554 b Fn(A)472 b(sequence)h(t)-31 b(yp)31 b(e)473 b(that)h(is)f(similar)h(to)g(a)f(list)h(except)f(that)h(it)g (is)f(imm)-31 b(utable.)2767 12931 y(T)-92 b(uples)325 b(can)h(b)31 b(e)324 b(used)h(wherev)-31 b(er)324 b(an)i(imm)-31 b(utable)327 b(t)-31 b(yp)31 b(e)326 b(is)f(required,)334 b(suc)-31 b(h)324 b(as)h(a)g(k)-31 b(ey)2767 14286 y(in)370 b(a)f(dictionary)-92 b(.)0 16526 y Fv(tuple)425 b(assignmen)-35 b(t:)554 b Fn(An)486 b(assignmen)-31 b(t)488 b(to)f(all)h(of)f(the)f (elemen)-31 b(ts)488 b(in)e(a)h(tuple)g(using)g(a)2767 17881 y(single)436 b(assignmen)-31 b(t)436 b(statemen)-31 b(t.)690 b(T)-92 b(uple)435 b(assignmen)-31 b(t)436 b(o)31 b(ccurs)433 b(in)i(parallel)h(rather)2767 19236 y(than)370 b(in)g(sequence,)f(making)i(it)f(useful)f(for)h(sw)-31 b(apping)370 b(v)-61 b(alues.)0 21477 y Fv(deterministic:)553 b Fn(A)370 b(program)g(that)g(do)31 b(es)369 b(the)g(same)h(thing)g (eac)-31 b(h)370 b(time)g(it)g(is)f(called.)0 23717 y Fv(pseudorandom:)556 b Fn(A)432 b(sequence)f(of)i(n)-31 b(um)g(b)31 b(ers)431 b(that)i(app)31 b(ear)432 b(to)h(b)31 b(e)432 b(random)g(but)h(that)2767 25072 y(are)369 b(actually)j(the)d (result)h(of)f(a)h(deterministic)h(computation.)0 27313 y Fv(histogram:)554 b Fn(A)288 b(list)i(of)f(in)-31 b(tegers)289 b(in)g(whic)-31 b(h)289 b(eac)-31 b(h)289 b(elemen)-31 b(t)290 b(coun)-31 b(ts)289 b(the)g(n)-31 b(um)g(b)31 b(er)288 b(of)h(times)2767 28668 y(something)371 b(happ)31 b(ens.)0 30908 y Fv(pattern)425 b(matc)-35 b(hing:)553 b Fn(A)439 b(program)g(dev)-31 b(elopmen)g(t)441 b(plan)e(that)h(in)-31 b(v)g(olv)g(es)440 b(iden)-31 b(tifying)442 b(a)2767 32263 y(familiar)299 b(computational)h(pattern)d(and)f(cop)-31 b(ying)298 b(the)e(solution)i(to)e(a)h(similar)g(prob-)2767 33618 y(lem.)p eop %%Page: 104 130 104 129 bop 0 -2070 a Fv(104)32649 b(T)-106 b(uples)p 0 -1627 38191 45 v eop %%Page: 105 131 105 130 bop 0 9950 a Fi(Chapter)861 b(10)0 16278 y Fo(Dictionaries)0 22788 y Fn(The)474 b(comp)31 b(ound)475 b(t)-31 b(yp)31 b(es)474 b(y)-31 b(ou)475 b(ha)-31 b(v)g(e)475 b(learned)f(ab)31 b(out|strings,)502 b(lists,)g(and)474 b(tuples|use)0 24143 y(in)-31 b(tegers)459 b(as)f(indices.)759 b(If)458 b(y)-31 b(ou)458 b(try)g(to)h(use)f(an)-31 b(y)458 b(other)h(t)-31 b(yp)31 b(e)458 b(as)g(an)g(index,)481 b(y)-31 b(ou)459 b(get)g(an)0 25498 y(error.)0 27580 y Fv(Dictionaries)476 b Fn(are)g(similar)h(to)g(other)f(comp)31 b(ound)477 b(t)-31 b(yp)31 b(es)476 b(except)g(that)h(they)f(can)h(use)0 28935 y(an)-31 b(y)447 b(imm)-31 b(utable)450 b(t)-31 b(yp)31 b(e)447 b(as)f(an)h(index.)726 b(As)446 b(an)h(example,)468 b(w)-31 b(e)447 b(will)h(create)f(a)g(dictionary)0 30290 y(to)494 b(translate)g(English)g(w)-31 b(ords)493 b(in)-31 b(to)494 b(Spanish.)864 b(F)-92 b(or)493 b(this)g(dictionary)-92 b(,)526 b(the)493 b(indices)g(are)0 31645 y Fk(strings)p Fn(.)0 33727 y(One)418 b(w)-31 b(a)g(y)419 b(to)g(create)f(a)g (dictionary)i(is)e(to)h(start)f(with)h(the)f(empt)-31 b(y)420 b(dictionary)f(and)g(add)0 35082 y(elemen)-31 b(ts.)494 b(The)369 b(empt)-31 b(y)371 b(dictionary)g(is)e(denoted)h Fk({})p Fn(:)0 37246 y Fk(>>>)582 b(eng2sp)g(=)f({})0 38600 y(>>>)h(eng2sp['one'])h(=)e('uno')0 39955 y(>>>)h(eng2sp['two'])h (=)e('dos')0 42119 y Fn(The)343 b(\257rst)g(assignmen)-31 b(t)345 b(creates)e(a)g(dictionary)i(named)f Fk(eng2sp)p Fn(;)353 b(the)343 b(other)h(assignmen)-31 b(ts)0 43474 y(add)522 b(new)g(elemen)-31 b(ts)523 b(to)f(the)g(dictionary)-92 b(.)952 b(W)-92 b(e)521 b(can)h(prin)-31 b(t)522 b(the)g(curren)-31 b(t)521 b(v)-61 b(alue)522 b(of)h(the)0 44828 y(dictionary)371 b(in)f(the)f(usual)h(w)-31 b(a)g(y:)0 46992 y Fk(>>>)582 b(print)f(eng2sp)0 48347 y({'one':)h('uno',)g('two':)g('dos'})0 50510 y Fn(The)501 b(elemen)-31 b(ts)501 b(of)g(a)g(dictionary)h(app)31 b(ear)501 b(in)g(a)f(comma-separated)j(list.)887 b(Eac)-31 b(h)502 b(en)-31 b(try)0 51865 y(con)g(tains)345 b(an)g(index)f(and)g (a)g(v)-61 b(alue)345 b(separated)f(b)-31 b(y)344 b(a)g(colon.)486 b(In)343 b(a)h(dictionary)-92 b(,)351 b(the)345 b(indices)0 53220 y(are)369 b(called)h Fv(k)-35 b(eys)p Fn(,)370 b(so)f(the)g(elemen)-31 b(ts)371 b(are)e(called)h Fv(k)-35 b(ey-v)-71 b(alue)425 b(pairs)p Fn(.)0 55302 y(Another)389 b(w)-31 b(a)g(y)390 b(to)f(create)f(a)h(dictionary)h(is)e(to)h(pro)-31 b(vide)389 b(a)g(list)g(of)g(k)-31 b(ey-v)-61 b(alue)389 b(pairs)g(using)0 56657 y(the)369 b(same)h(syn)-31 b(tax)370 b(as)f(the)h(previous)f(output:)p eop %%Page: 106 132 106 131 bop 0 -2070 a Fv(106)29612 b(Dictionaries)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(eng2sp)g(=)f({'one':)h('uno',)g ('two':)g('dos',)g('three':)h('tres'})0 3071 y Fn(If)369 b(w)-31 b(e)370 b(prin)-31 b(t)369 b(the)h(v)-61 b(alue)369 b(of)h Fk(eng2sp)g Fn(again,)h(w)-31 b(e)370 b(get)g(a)g(surprise:)0 5276 y Fk(>>>)582 b(print)f(eng2sp)0 6631 y({'one':)h('uno',)g ('three':)h('tres',)f('two':)g('dos'})0 8837 y Fn(The)462 b(k)-31 b(ey-v)-61 b(alue)464 b(pairs)e(are)g(not)h(in)f(order!)771 b(F)-92 b(ortunately)g(,)487 b(there)462 b(is)g(no)g(reason)g(to)h (care)0 10192 y(ab)31 b(out)262 b(the)f(order,)283 b(since)261 b(the)g(elemen)-31 b(ts)262 b(of)g(a)f(dictionary)i(are)e(nev)-31 b(er)261 b(indexed)h(with)g(in)-31 b(teger)0 11546 y(indices.)493 b(Instead,)370 b(w)-31 b(e)369 b(use)g(the)g(k)-31 b(eys)370 b(to)g(lo)31 b(ok)370 b(up)f(the)h(corresp)31 b(onding)369 b(v)-61 b(alues:)0 13752 y Fk(>>>)582 b(print)f(eng2sp['two'])0 15107 y('dos')0 17312 y Fn(The)372 b(k)-31 b(ey)373 b Fk('two')g Fn(yields)g(the)f(v)-61 b(alue)373 b Fk('dos')g Fn(ev)-31 b(en)372 b(though)i(it)f(app)31 b(ears)372 b(in)g(the)h(third)f(k)-31 b(ey-)0 18667 y(v)-61 b(alue)370 b(pair.)0 23121 y Fl(10.1)1792 b(Dictionary)600 b(op)50 b(erations)0 25579 y Fn(The)445 b Fk(del)g Fn(statemen)-31 b(t)446 b(remo)-31 b(v)g(es)446 b(a)f(k)-31 b(ey-v)-61 b(alue)445 b(pair)g(from)h(a)e(dictionary)-92 b(.)721 b(F)-92 b(or)444 b(example,)0 26934 y(the)348 b(follo)-31 b(wing)352 b(dictionary)e(con)-31 b(tains)350 b(the)f(names)f(of)h(v) -61 b(arious)348 b(fruits)g(and)h(the)f(n)-31 b(um)g(b)31 b(er)348 b(of)0 28289 y(eac)-31 b(h)370 b(fruit)f(in)h(sto)31 b(c)-31 b(k:)0 30495 y Fk(>>>)582 b(inventory)g(=)f({'apples':)i(430,)f ('bananas':)g(312,)g('oranges':)h(525,)0 31850 y('pears':)f(217})0 33205 y(>>>)g(print)f(inventory)0 34559 y({'oranges':)i(525,)f ('apples':)g(430,)g('pears':)g(217,)g('bananas':)g(312})0 36765 y Fn(If)369 b(someone)h(buys)f(all)h(of)g(the)f(p)31 b(ears,)369 b(w)-31 b(e)370 b(can)f(remo)-31 b(v)g(e)371 b(the)e(en)-31 b(try)369 b(from)h(the)g(dictionary:)0 38971 y Fk(>>>)582 b(del)f(inventory['pears'])0 40325 y(>>>)h(print)f(inventory)0 41680 y({'oranges':)i(525,)f('apples':)g (430,)g('bananas':)g(312})0 43886 y Fn(Or)274 b(if)h(w)-31 b(e're)275 b(exp)31 b(ecting)276 b(more)e(p)31 b(ears)274 b(so)31 b(on,)294 b(w)-31 b(e)275 b(migh)-31 b(t)277 b(just)d(c)-31 b(hange)276 b(the)f(v)-61 b(alue)275 b(asso)31 b(ciated)0 45241 y(with)370 b(p)31 b(ears:)0 47446 y Fk(>>>)582 b(inventory['pears'])h(=)f(0)0 48801 y(>>>)g(print)f (inventory)0 50156 y({'oranges':)i(525,)f('apples':)g(430,)g('pears':)g (0,)g('bananas':)g(312})0 52362 y Fn(The)346 b Fk(len)f Fn(function)i(also)g(w)-31 b(orks)346 b(on)f(dictionaries;)356 b(it)346 b(returns)f(the)g(n)-31 b(um)g(b)31 b(er)346 b(of)g(k)-31 b(ey-v)-61 b(alue)0 53717 y(pairs:)0 55922 y Fk(>>>)582 b(len\(inventory\))0 57277 y(4)p eop %%Page: 107 133 107 132 bop 0 -2070 a Fv(10.2)425 b(Dictionary)g(metho)35 b(ds)22540 b(107)p 0 -1627 38191 45 v 0 865 a Fl(10.2)1792 b(Dictionary)600 b(metho)50 b(ds)0 3632 y Fn(A)380 b Fv(metho)35 b(d)381 b Fn(is)e(similar)i(to)g(a)f(function|it)i(tak)-31 b(es)380 b(parameters)g(and)g(returns)f(a)g(v)-61 b(alue|)0 4987 y(but)432 b(the)g(syn)-31 b(tax)433 b(is)f(di\256eren)-31 b(t.)680 b(F)-92 b(or)431 b(example,)449 b(the)432 b Fk(keys)h Fn(metho)31 b(d)432 b(tak)-31 b(es)433 b(a)f(dictionary)0 6342 y(and)k(returns)e(a)i(list)g(of)g(the)g(k)-31 b(eys)435 b(that)i(app)31 b(ear,)452 b(but)436 b(instead)g(of)g(the)g(function)h (syn)-31 b(tax)0 7697 y Fk(keys\(eng2sp\))p Fn(,)371 b(w)-31 b(e)370 b(use)f(the)g(metho)31 b(d)370 b(syn)-31 b(tax)370 b Fk(eng2sp.keys\(\))p Fn(.)0 10135 y Fk(>>>)582 b(eng2sp.keys\(\))0 11490 y(['one',)g('three',)h('two'])0 13927 y Fn(This)499 b(form)g(of)f(dot)i(notation)h(sp)31 b(eci\257es)497 b(the)i(name)g(of)g(the)f(function,)533 b Fk(keys)p Fn(,)e(and)499 b(the)0 15282 y(name)377 b(of)f(the)g(ob)61 b(ject)377 b(to)g(apply)g(the)f(function)h(to,)i Fk(eng2sp)p Fn(.)514 b(The)376 b(paren)-31 b(theses)375 b(indicate)0 16637 y(that)370 b(this)g(metho)31 b(d)370 b(tak)-31 b(es)370 b(no)g(parameters.)0 18994 y(A)393 b(metho)31 b(d)395 b(call)f(is)f(called)i(an)f Fv(in)-35 b(v)g(o)35 b(cation)p Fn(;)405 b(in)394 b(this)g(case,)399 b(w)-31 b(e)394 b(w)-31 b(ould)395 b(sa)-31 b(y)394 b(that)g(w)-31 b(e)394 b(are)0 20349 y(in)-31 b(v)g(oking)372 b Fk(keys)d Fn(on)h(the)f(ob)61 b(ject)371 b Fk(eng2sp)p Fn(.)0 22706 y(The)e Fk(values)h Fn(metho)31 b(d)370 b(is)g(similar;)h(it)f(returns) e(a)h(list)h(of)g(the)f(v)-61 b(alues)370 b(in)f(the)h(dictionary:)0 25143 y Fk(>>>)582 b(eng2sp.values\(\))0 26498 y(['uno',)g('tres',)g ('dos'])0 28936 y Fn(The)433 b Fk(items)g Fn(metho)31 b(d)434 b(returns)e(b)31 b(oth,)450 b(in)433 b(the)g(form)g(of)h(a)f (list)h(of)f(tuples|one)h(for)e(eac)-31 b(h)0 30291 y(k)g(ey-v)-61 b(alue)370 b(pair:)0 32729 y Fk(>>>)582 b(eng2sp.items\(\))0 34084 y([\('one','uno'\),)h(\('three',)g('tres'\),)f(\('two',)g ('dos'\)])0 36522 y Fn(The)325 b(syn)-31 b(tax)326 b(pro)-31 b(vides)326 b(useful)f(t)-31 b(yp)31 b(e)325 b(information.)481 b(The)326 b(square)e(brac)-31 b(k)g(ets)326 b(indicate)h(that)0 37877 y(this)370 b(is)f(a)g(list.)494 b(The)369 b(paren)-31 b(theses)369 b(indicate)i(that)f(the)g(elemen)-31 b(ts)370 b(of)g(the)f(list)h(are)f(tuples.)0 40233 y(If)376 b(a)h(metho)31 b(d)377 b(tak)-31 b(es)378 b(an)f(argumen)-31 b(t,)380 b(it)d(uses)f(the)g(same)h(syn)-31 b(tax)378 b(as)e(a)h(function)h (call.)516 b(F)-92 b(or)0 41588 y(example,)303 b(the)285 b(metho)31 b(d)286 b Fk(has)p 12154 41588 349 45 v 418 w(key)f Fn(tak)-31 b(es)285 b(a)g(k)-31 b(ey)285 b(and)g(returns)e (true)i(\(1\))h(if)f(the)f(k)-31 b(ey)285 b(app)31 b(ears)0 42943 y(in)369 b(the)h(dictionary:)0 45381 y Fk(>>>)582 b(eng2sp.has_key\('one'\))0 46736 y(1)0 48091 y(>>>)g (eng2sp.has_key\('deux'\))0 49446 y(0)0 51883 y Fn(If)412 b(y)-31 b(ou)414 b(try)f(to)g(call)h(a)f(metho)31 b(d)414 b(without)g(sp)31 b(ecifying)414 b(an)f(ob)61 b(ject,)426 b(y)-31 b(ou)413 b(get)g(an)g(error.)622 b(In)0 53238 y(this)370 b(case,)f(the)h(error)e(message)h(is)g(not)h(v)-31 b(ery)370 b(helpful:)0 55676 y Fk(>>>)582 b(has_key\('one'\))0 57031 y(NameError:)h(has_key)p eop %%Page: 108 134 108 133 bop 0 -2070 a Fv(108)29612 b(Dictionaries)p 0 -1627 38191 45 v 0 865 a Fl(10.3)1792 b(Aliasing)599 b(and)f(cop)-50 b(ying)0 3264 y Fn(Because)400 b(dictionaries)j(are)d (m)-31 b(utable,)411 b(y)-31 b(ou)401 b(need)f(to)i(b)31 b(e)400 b(a)-31 b(w)g(are)401 b(of)g(aliasing.)589 b(Whenev)-31 b(er)0 4619 y(t)g(w)g(o)371 b(v)-61 b(ariables)370 b(refer)e(to)i(the)f (same)h(ob)61 b(ject,)371 b(c)-31 b(hanges)370 b(to)g(one)f(a\256ect)h (the)f(other.)0 6684 y(If)495 b(y)-31 b(ou)496 b(w)-31 b(an)g(t)497 b(to)g(mo)31 b(dify)496 b(a)g(dictionary)i(and)d(k)-31 b(eep)496 b(a)f(cop)-31 b(y)497 b(of)f(the)f(original,)530 b(use)495 b(the)0 8039 y Fk(copy)458 b Fn(metho)31 b(d.)757 b(F)-92 b(or)456 b(example,)481 b Fk(opposites)459 b Fn(is)e(a)g(dictionary)i(that)g(con)-31 b(tains)458 b(pairs)f(of)0 9394 y(opp)31 b(osites:)0 11540 y Fk(>>>)582 b(opposites)g(=)f({'up':)h ('down',)h('right':)f('wrong',)g('true':)g('false'})0 12895 y(>>>)g(alias)f(=)h(opposites)0 14250 y(>>>)g(copy)f(=)h (opposites.copy\(\))0 16396 y(alias)424 b Fn(and)g Fk(opposites)h Fn(refer)e(to)h(the)g(same)g(ob)61 b(ject;)453 b Fk(copy)424 b Fn(refers)f(to)h(a)g(fresh)f(cop)-31 b(y)424 b(of)0 17751 y(the)369 b(same)h(dictionary)-92 b(.)494 b(If)369 b(w)-31 b(e)370 b(mo)31 b(dify)371 b Fk(alias)p Fn(,)f Fk(opposites)g Fn(is)f(also)h(c)-31 b(hanged:)0 19897 y Fk(>>>)582 b(alias['right'])h(=)e('left')0 21252 y(>>>)h (opposites['right'])0 22607 y('left')0 24753 y Fn(If)369 b(w)-31 b(e)370 b(mo)31 b(dify)370 b Fk(copy)p Fn(,)g Fk(opposites)h Fn(is)e(unc)-31 b(hanged:)0 26899 y Fk(>>>)582 b(copy['right'])h(=)e('privilege')0 28254 y(>>>)h(opposites['right'])0 29609 y('left')0 34061 y Fl(10.4)1792 b(Sparse)599 b(matrices)0 36460 y Fn(In)455 b(Section)j(8.14,)479 b(w)-31 b(e)457 b(used)e(a)i(list)f(of)h(lists)f(to)h(represen)-31 b(t)455 b(a)h(matrix.)755 b(That)457 b(is)f(a)g(go)31 b(o)g(d)0 37815 y(c)-31 b(hoice)451 b(for)g(a)g(matrix)h(with)g(mostly)g(nonzero) e(v)-61 b(alues,)472 b(but)451 b(consider)f(a)h(sparse)e(matrix)0 39170 y(lik)-31 b(e)370 b(this)g(one:)14706 40334 y 5196759 4473159 0 0 5196759 4473159 startTexFig 14706 40334 a %%BeginDocument: illustrations/sparse.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: sparse.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 10:05:55 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 79 68 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 68 moveto 0 0 lineto 79 0 lineto 79 68 lineto closepath clip newpath -62.0 130.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 1127 1050 m 1052 1050 l 1052 2145 l 1127 2145 l gs col0 s gr % Polyline n 2250 1050 m 2325 1050 l 2325 2145 l 2250 2145 l gs col0 s gr /Helvetica ff 165.00 scf sf 1200 1650 m gs 1 -1 sc (0 2 0 0 0) col0 sh gr /Helvetica ff 165.00 scf sf 1200 1200 m gs 1 -1 sc (0 0 0 1 0) col0 sh gr /Helvetica ff 165.00 scf sf 1200 1425 m gs 1 -1 sc (0 0 0 0 0) col0 sh gr /Helvetica ff 165.00 scf sf 1200 2100 m gs 1 -1 sc (0 0 0 3 0) col0 sh gr /Helvetica ff 165.00 scf sf 1200 1875 m gs 1 -1 sc (0 0 0 0 0) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 49792 a Fn(The)f(list)i(represen)-31 b(tation)370 b(con)-31 b(tains)371 b(a)e(lot)h(of)g(zero)31 b(es:)0 51938 y Fk(matrix)582 b(=)f([)h([0,0,0,1,0],)6393 53293 y([0,0,0,0,0],)6393 54648 y([0,2,0,0,0],)6393 56003 y([0,0,0,0,0],)6393 57358 y([0,0,0,3,0])g(])p eop %%Page: 109 135 109 134 bop 0 -2070 a Fv(10.5)425 b(Hin)-35 b(ts)30575 b(109)p 0 -1627 38191 45 v 0 865 a Fn(An)519 b(alternativ)-31 b(e)522 b(is)d(to)h(use)e(a)h(dictionary)-92 b(.)944 b(F)-92 b(or)519 b(the)g(k)-31 b(eys,)557 b(w)-31 b(e)520 b(can)f(use)f(tuples)i(that)0 2220 y(con)-31 b(tain)394 b(the)f(ro)-31 b(w)393 b(and)f(column)i(n)-31 b(um)g(b)31 b(ers.)562 b(Here)392 b(is)g(the)h(dictionary)h(represen)-31 b(tation)393 b(of)0 3575 y(the)369 b(same)h(matrix:)0 5883 y Fk(matrix)582 b(=)f({\(0,3\):)i(1,)e(\(2,)h(1\):)f(2,)h(\(4,)f (3\):)h(3})0 8191 y Fn(W)-92 b(e)324 b(only)h(need)f(three)g(k)-31 b(ey-v)-61 b(alue)325 b(pairs,)334 b(one)324 b(for)h(eac)-31 b(h)324 b(nonzero)h(elemen)-31 b(t)326 b(of)e(the)h(matrix.)0 9546 y(Eac)-31 b(h)370 b(k)-31 b(ey)370 b(is)f(a)g(tuple,)i(and)e(eac) -31 b(h)370 b(v)-61 b(alue)369 b(is)h(an)f(in)-31 b(teger.)0 11773 y(T)-92 b(o)370 b(access)e(an)i(elemen)-31 b(t)370 b(of)g(the)g(matrix,)h(w)-31 b(e)369 b(could)h(use)f(the)g Fk([])h Fn(op)31 b(erator:)0 14081 y Fk(matrix[0,3])0 15436 y(1)0 17743 y Fn(Notice)379 b(that)g(the)f(syn)-31 b(tax)379 b(for)f(the)g(dictionary)h(represen)-31 b(tation)379 b(is)f(not)g(the)g(same)g(as)g(the)0 19098 y(syn)-31 b(tax)373 b(for)f(the)g(nested)f(list)i(represen)-31 b(tation.)502 b(Instead)371 b(of)i(t)-31 b(w)g(o)373 b(in)-31 b(teger)373 b(indices,)g(w)-31 b(e)373 b(use)0 20453 y(one)c(index,)i(whic)-31 b(h)370 b(is)f(a)g(tuple)h(of)g(in)-31 b(tegers.)0 22680 y(There)442 b(is)g(one)g(problem.)711 b(If)442 b(w)-31 b(e)442 b(sp)31 b(ecify)442 b(an)h(elemen)-31 b(t)443 b(that)g(is)f(zero,)460 b(w)-31 b(e)443 b(get)f(an)g(error,)0 24035 y(b)31 b(ecause)369 b(there)g(is)g(no)g(en)-31 b(try)370 b(in)f(the)h(dictionary)h(with)f(that)h(k)-31 b(ey:)0 26343 y Fk(>>>)582 b(matrix[1,3])0 27698 y(KeyError:)g(\(1,)g (3\))0 30006 y Fn(The)369 b Fk(get)h Fn(metho)31 b(d)370 b(solv)-31 b(es)370 b(this)f(problem:)0 32314 y Fk(>>>)582 b(matrix.get\(\(0,3\),)h(0\))0 33669 y(1)0 35977 y Fn(The)502 b(\257rst)e(argumen)-31 b(t)503 b(is)e(the)h(k)-31 b(ey;)568 b(the)502 b(second)f(argumen)-31 b(t)503 b(is)e(the)g(v)-61 b(alue)502 b Fk(get)g Fn(should)0 37332 y(return)369 b(if)g(the)h(k)-31 b(ey)369 b(is)g(not)h(in)g(the)f(dictionary:)0 39639 y Fk(>>>)582 b(matrix.get\(\(1,3\),)h(0\))0 40994 y(0)0 43302 y(get)273 b Fn(de\257nitely)h(impro)-31 b(v)g(es)274 b(the)f(seman)-31 b(tics)274 b(of)f(accessing)h(a)f(sparse)e(matrix.) 462 b(Shame)274 b(ab)31 b(out)0 44657 y(the)369 b(syn)-31 b(tax.)0 49353 y Fl(10.5)1792 b(Hin)-50 b(ts)0 51938 y Fn(If)363 b(y)-31 b(ou)364 b(pla)-31 b(y)g(ed)365 b(around)e(with)h (the)g Fk(fibonacci)g Fn(function)h(from)f(Section)g(5.7,)i(y)-31 b(ou)364 b(migh)-31 b(t)0 53293 y(ha)g(v)g(e)356 b(noticed)g(that)h (the)e(bigger)h(the)f(argumen)-31 b(t)357 b(y)-31 b(ou)356 b(pro)-31 b(vide,)359 b(the)c(longer)h(the)g(function)0 54648 y(tak)-31 b(es)516 b(to)g(run.)930 b(F)-92 b(urthermore,)552 b(the)515 b(run)g(time)h(increases)f(v)-31 b(ery)516 b(quic)-31 b(kly)-92 b(.)932 b(On)515 b(one)g(of)0 56003 y(our)371 b(mac)-31 b(hines,)373 b Fk(fibonacci\(20\))g Fn(\257nishes)d(instan)-31 b(tly)-92 b(,)374 b Fk(fibonacci\(30\))f Fn(tak)-31 b(es)372 b(ab)31 b(out)372 b(a)0 57358 y(second,)e(and)f Fk(fibonacci\(40\))i Fn(tak)-31 b(es)370 b(roughly)g(forev)-31 b(er.)p eop %%Page: 110 136 110 135 bop 0 -2070 a Fv(110)29612 b(Dictionaries)p 0 -1627 38191 45 v 0 865 a Fn(T)-92 b(o)370 b(understand)f(wh)-31 b(y)-92 b(,)370 b(consider)f(this)h Fv(call)423 b(graph)370 b Fn(for)f Fk(fibonacci)h Fn(with)h Fk(n=4)p Fn(:)7815 2244 y 13356326 9472573 0 0 20260782 14340423 startTexFig 7815 2244 a %%BeginDocument: illustrations/fibonacci.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: fibonacci.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Fri Dec 7 17:25:43 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 308 218 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 218 moveto 0 0 lineto 308 0 lineto 308 218 lineto closepath clip newpath -62.0 244.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 3450 450 m 4350 450 l 4350 1125 l 3450 1125 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 2250 1425 m 3150 1425 l 3150 2100 l 2250 2100 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 4650 1425 m 5550 1425 l 5550 2100 l 4650 2100 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 5250 2400 m 6150 2400 l 6150 3075 l 5250 3075 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 4050 2400 m 4950 2400 l 4950 3075 l 4050 3075 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 2850 2400 m 3750 2400 l 3750 3075 l 2850 3075 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1650 2400 m 2550 2400 l 2550 3075 l 1650 3075 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 2250 3375 m 3150 3375 l 3150 4050 l 2250 4050 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1050 3375 m 1950 3375 l 1950 4050 l 1050 4050 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 4095 929 m 4095 869 l 3943 869 l 4063 899 l 3943 929 l cp eoclip n 3705 899 m 4080 899 l gs col0 s gr gr % arrowhead n 3943 929 m 4063 899 l 3943 869 l col0 s /Helvetica ff 165.00 scf sf 3555 705 m gs 1 -1 sc (fibonacci) col0 sh gr /Helvetica ff 165.00 scf sf 3630 952 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4155 952 m gs 1 -1 sc (4) col0 sh gr % Polyline gs clippath 3118 1414 m 3160 1456 l 3268 1349 l 3162 1413 l 3225 1306 l cp eoclip n 3450 1125 m 3150 1425 l gs col0 s gr gr % arrowhead n 3225 1306 m 3162 1413 l 3268 1349 l col0 s % Polyline gs clippath 2068 2389 m 2110 2431 l 2218 2324 l 2112 2388 l 2175 2281 l cp eoclip n 2400 2100 m 2100 2400 l gs col0 s gr gr % arrowhead n 2175 2281 m 2112 2388 l 2218 2324 l col0 s % Polyline gs clippath 1468 3364 m 1510 3406 l 1618 3299 l 1512 3363 l 1575 3256 l cp eoclip n 1800 3075 m 1500 3375 l gs col0 s gr gr % arrowhead n 1575 3256 m 1512 3363 l 1618 3299 l col0 s % Polyline gs clippath 4468 2389 m 4510 2431 l 4618 2324 l 4512 2388 l 4575 2281 l cp eoclip n 4800 2100 m 4500 2400 l gs col0 s gr gr % arrowhead n 4575 2281 m 4512 2388 l 4618 2324 l col0 s % Polyline gs clippath 4639 1456 m 4681 1414 l 4574 1306 l 4638 1413 l 4531 1349 l cp eoclip n 4350 1125 m 4650 1425 l gs col0 s gr gr % arrowhead n 4531 1349 m 4638 1413 l 4574 1306 l col0 s % Polyline gs clippath 3289 2431 m 3331 2389 l 3224 2281 l 3288 2388 l 3181 2324 l cp eoclip n 3000 2100 m 3300 2400 l gs col0 s gr gr % arrowhead n 3181 2324 m 3288 2388 l 3224 2281 l col0 s % Polyline gs clippath 2689 3406 m 2731 3364 l 2624 3256 l 2688 3363 l 2581 3299 l cp eoclip n 2400 3075 m 2700 3375 l gs col0 s gr gr % arrowhead n 2581 3299 m 2688 3363 l 2624 3256 l col0 s % Polyline gs clippath 5689 2431 m 5731 2389 l 5624 2281 l 5688 2388 l 5581 2324 l cp eoclip n 5400 2100 m 5700 2400 l gs col0 s gr gr % arrowhead n 5581 2324 m 5688 2388 l 5624 2281 l col0 s % Polyline gs clippath 2895 1904 m 2895 1844 l 2743 1844 l 2863 1874 l 2743 1904 l cp eoclip n 2505 1874 m 2880 1874 l gs col0 s gr gr % arrowhead n 2743 1904 m 2863 1874 l 2743 1844 l col0 s % Polyline gs clippath 5295 1904 m 5295 1844 l 5143 1844 l 5263 1874 l 5143 1904 l cp eoclip n 4905 1874 m 5280 1874 l gs col0 s gr gr % arrowhead n 5143 1904 m 5263 1874 l 5143 1844 l col0 s % Polyline gs clippath 5895 2879 m 5895 2819 l 5743 2819 l 5863 2849 l 5743 2879 l cp eoclip n 5505 2849 m 5880 2849 l gs col0 s gr gr % arrowhead n 5743 2879 m 5863 2849 l 5743 2819 l col0 s % Polyline gs clippath 4695 2879 m 4695 2819 l 4543 2819 l 4663 2849 l 4543 2879 l cp eoclip n 4305 2849 m 4680 2849 l gs col0 s gr gr % arrowhead n 4543 2879 m 4663 2849 l 4543 2819 l col0 s % Polyline gs clippath 3495 2879 m 3495 2819 l 3343 2819 l 3463 2849 l 3343 2879 l cp eoclip n 3105 2849 m 3480 2849 l gs col0 s gr gr % arrowhead n 3343 2879 m 3463 2849 l 3343 2819 l col0 s % Polyline gs clippath 2295 2879 m 2295 2819 l 2143 2819 l 2263 2849 l 2143 2879 l cp eoclip n 1905 2849 m 2280 2849 l gs col0 s gr gr % arrowhead n 2143 2879 m 2263 2849 l 2143 2819 l col0 s % Polyline gs clippath 2895 3854 m 2895 3794 l 2743 3794 l 2863 3824 l 2743 3854 l cp eoclip n 2505 3824 m 2880 3824 l gs col0 s gr gr % arrowhead n 2743 3854 m 2863 3824 l 2743 3794 l col0 s % Polyline gs clippath 1695 3854 m 1695 3794 l 1543 3794 l 1663 3824 l 1543 3854 l cp eoclip n 1305 3824 m 1680 3824 l gs col0 s gr gr % arrowhead n 1543 3854 m 1663 3824 l 1543 3794 l col0 s /Helvetica ff 165.00 scf sf 2355 1680 m gs 1 -1 sc (fibonacci) col0 sh gr /Helvetica ff 165.00 scf sf 2430 1927 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2955 1927 m gs 1 -1 sc (3) col0 sh gr /Helvetica ff 165.00 scf sf 4755 1680 m gs 1 -1 sc (fibonacci) col0 sh gr /Helvetica ff 165.00 scf sf 4830 1927 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 5355 1927 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 5355 2655 m gs 1 -1 sc (fibonacci) col0 sh gr /Helvetica ff 165.00 scf sf 5430 2902 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 5955 2902 m gs 1 -1 sc (0) col0 sh gr /Helvetica ff 165.00 scf sf 4155 2655 m gs 1 -1 sc (fibonacci) col0 sh gr /Helvetica ff 165.00 scf sf 4230 2902 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4755 2902 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 2955 2655 m gs 1 -1 sc (fibonacci) col0 sh gr /Helvetica ff 165.00 scf sf 3030 2902 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3555 2902 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 1755 2655 m gs 1 -1 sc (fibonacci) col0 sh gr /Helvetica ff 165.00 scf sf 1830 2902 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2355 2902 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 2355 3630 m gs 1 -1 sc (fibonacci) col0 sh gr /Helvetica ff 165.00 scf sf 2430 3877 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2955 3877 m gs 1 -1 sc (0) col0 sh gr /Helvetica ff 165.00 scf sf 1155 3630 m gs 1 -1 sc (fibonacci) col0 sh gr /Helvetica ff 165.00 scf sf 1230 3877 m gs 1 -1 sc (n) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 1755 3877 m gs 1 -1 sc (1) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 20311 a Fn(A)417 b(call)i(graph)e(sho)-31 b(ws)418 b(a)f(set)g(function)i(frames,)430 b(with)418 b(lines)g(connecting)h (eac)-31 b(h)417 b(frame)h(to)0 21666 y(the)428 b(frames)g(of)h(the)f (functions)h(it)g(calls.)670 b(A)-31 b(t)429 b(the)f(top)h(of)g(the)f (graph,)444 b Fk(fibonacci)429 b Fn(with)0 23021 y Fk(n=4)524 b Fn(calls)g Fk(fibonacci)h Fn(with)f Fk(n=3)g Fn(and)g Fk(n=2)p Fn(.)956 b(In)523 b(turn,)562 b Fk(fibonacci)525 b Fn(with)f Fk(n=3)g Fn(calls)0 24375 y Fk(fibonacci)370 b Fn(with)h Fk(n=2)e Fn(and)h Fk(n=1)p Fn(.)493 b(And)369 b(so)g(on.)0 26604 y(Coun)-31 b(t)322 b(ho)-31 b(w)322 b(man)-31 b(y)322 b(times)f Fk(fibonacci\(0\))i Fn(and)d Fk(fibonacci\(1\))j Fn(are)d(called.)478 b(This)321 b(is)g(an)0 27959 y(ine\261cien)-31 b(t)424 b(solution)f(to)f(the)g(problem,)436 b(and)422 b(it)g(gets)h(far)e(w)-31 b(orse)422 b(as)g(the)f(argumen)-31 b(t)424 b(gets)0 29314 y(bigger.)0 31542 y(A)367 b(go)31 b(o)g(d)369 b(solution)g(is)e(to)h(k)-31 b(eep)368 b(trac)-31 b(k)368 b(of)g(v)-61 b(alues)368 b(that)g(ha)-31 b(v)g(e)369 b(already)f(b)31 b(een)367 b(computed)i(b)-31 b(y)0 32897 y(storing)457 b(them)g(in)g(a)g(dictionary)-92 b(.)756 b(A)456 b(previously)h(computed)h(v)-61 b(alue)457 b(that)g(is)g (stored)f(for)0 34252 y(later)361 b(use)e(is)h(called)h(a)f Fv(hin)-35 b(t)p Fn(.)489 b(Here)359 b(is)h(an)g(implemen)-31 b(tation)364 b(of)d Fk(fibonacci)g Fn(using)f(hin)-31 b(ts:)0 36561 y Fk(previous)582 b(=)g({0:1,)g(1:1})0 39271 y(def)g(fibonacci\(n\):)1162 40626 y(if)g(previous.has_key\(n\):) 2325 41981 y(return)g(previous[n])1162 43336 y(else:)2325 44691 y(newValue)g(=)f(fibonacci\(n-1\))i(+)f(fibonacci\(n-2\))2325 46046 y(previous[n])g(=)g(newValue)2325 47401 y(return)g(newValue)0 49710 y Fn(The)435 b(dictionary)j(named)d Fk(previous)h Fn(k)-31 b(eeps)436 b(trac)-31 b(k)435 b(of)h(the)g(Fib)31 b(onacci)436 b(n)-31 b(um)g(b)31 b(ers)435 b(w)-31 b(e)435 b(al-)0 51065 y(ready)369 b(kno)-31 b(w.)494 b(W)-92 b(e)369 b(start)g(with)i(only)f(t)-31 b(w)g(o)371 b(pairs:)492 b(0)370 b(maps)f(to)h(1;)g(and)g(1)f(maps)h(to)g(1.)0 53293 y(Whenev)-31 b(er)407 b Fk(fibonacci)h Fn(is)g(called,)418 b(it)408 b(c)-31 b(hec)g(ks)408 b(the)f(dictionary)j(to)e(determine)g (if)g(it)g(con-)0 54648 y(tains)539 b(the)g(result.)1001 b(If)538 b(it's)i(there,)581 b(the)539 b(function)h(can)f(return)f (immediately)k(without)0 56003 y(making)383 b(an)-31 b(y)382 b(more)f(recursiv)-31 b(e)381 b(calls.)529 b(If)381 b(not,)386 b(it)c(has)f(to)h(compute)g(the)f(new)h(v)-61 b(alue.)529 b(The)0 57358 y(new)369 b(v)-61 b(alue)370 b(is)f(added)h(to)g(the)f(dictionary)i(b)31 b(efore)369 b(the)h(function)g(returns.)p eop %%Page: 111 137 111 136 bop 0 -2070 a Fv(10.6)425 b(Long)h(in)-35 b(tegers)26074 b(111)p 0 -1627 38191 45 v 0 865 a Fn(Using)358 b(this)g(v)-31 b(ersion)357 b(of)h Fk(fibonacci)p Fn(,)j(our)c(mac)-31 b(hines)359 b(can)e(compute)i Fk(fibonacci\(40\))g Fn(in)0 2220 y(an)431 b(ey)-31 b(eblink.)679 b(But)432 b(when)f(w)-31 b(e)431 b(try)g(to)h(compute)g Fk(fibonacci\(50\))p Fn(,)448 b(w)-31 b(e)432 b(get)f(a)h(di\256eren)-31 b(t)0 3575 y(problem:)0 5945 y Fk(>>>)582 b(fibonacci\(50\))0 7300 y(OverflowError:)h(integer)f(addition)0 9669 y Fn(The)348 b(answ)-31 b(er,)352 b(as)347 b(y)-31 b(ou)348 b(will)h(see)e(in)g(a)h (min)-31 b(ute,)354 b(is)347 b(20,365,011,074.)492 b(The)347 b(problem)h(is)g(that)0 11024 y(this)383 b(n)-31 b(um)g(b)31 b(er)382 b(is)g(to)31 b(o)383 b(big)h(to)f(\257t)f(in)-31 b(to)384 b(a)e(Python)i(in)-31 b(teger.)533 b(It)382 b Fv(o)-35 b(v)g(er\260o)g(ws)p Fn(.)533 b(F)-92 b(ortunately)g(,)0 12379 y(this)370 b(problem)g(has)f(an)g(easy)g(solution.)0 17260 y Fl(10.6)1792 b(Long)598 b(in)-50 b(tegers)0 19932 y Fn(Python)302 b(pro)-31 b(vides)300 b(a)h(t)-31 b(yp)31 b(e)301 b(called)g Fk(long)582 b(int)300 b Fn(that)i(can)e(handle)h(an) -31 b(y)301 b(size)f(in)-31 b(teger.)471 b(There)0 21287 y(are)251 b(t)-31 b(w)g(o)252 b(w)-31 b(a)g(ys)252 b(to)g(create)f(a)g Fk(long)582 b(int)251 b Fn(v)-61 b(alue.)454 b(One)250 b(is)h(to)h(write)f(an)h(in)-31 b(teger)251 b(with)i(a)e(capital)0 22642 y Fk(L)369 b Fn(at)h(the)g(end:)0 25012 y Fk(>>>)582 b(type\(1L\))0 26367 y()0 28736 y Fn(The)406 b(other)f(is)h(to)g(use)e(the)i Fk(long)g Fn(function)h(to)f(con)-31 b(v)g(ert)406 b(a)g(v)-61 b(alue)406 b(to)g(a)f Fk(long)582 b(int)p Fn(.)602 b Fk(long)0 30091 y Fn(can)369 b(accept)h(an)-31 b(y)370 b(n)-31 b(umerical)371 b(t)-31 b(yp)31 b(e)370 b(and)f(ev)-31 b(en)369 b(strings)h(of)f(digits:)0 32461 y Fk(>>>)582 b(long\(1\))0 33816 y(1L)0 35171 y(>>>)g(long\(3.9\))0 36526 y(3L)0 37881 y(>>>)g(long\('57'\))0 39236 y(57L)0 41605 y Fn(All)347 b(of)g(the)g(math)g(op)31 b(erations)348 b(w)-31 b(ork)347 b(on)f Fk(long)582 b(int)p Fn(s,)351 b(so)c(w)-31 b(e)347 b(don't)g(ha)-31 b(v)g(e)347 b(to)h(do)e(m)-31 b(uc)g(h)347 b(to)0 42960 y(adapt)370 b Fk(fibonacci)p Fn(:)0 45330 y Fk(>>>)582 b(previous)g(=)f({0:1L,)h(1:1L})0 46685 y(>>>)g(fibonacci\(50\))0 48040 y(20365011074L)0 50409 y Fn(Just)444 b(b)-31 b(y)444 b(c)-31 b(hanging)446 b(the)e(initial)j(con)-31 b(ten)g(ts)445 b(of)g Fk(previous)p Fn(,)464 b(w)-31 b(e)444 b(c)-31 b(hange)445 b(the)f(b)31 b(eha)-31 b(vior)445 b(of)0 51764 y Fk(fibonacci)p Fn(.)492 b(The)366 b(\257rst)e(t)-31 b(w)g(o)367 b(n)-31 b(um)g(b)31 b(ers)365 b(in)g(the)h(sequence)f(are)g Fk(long)581 b(int)p Fn(s,)367 b(so)e(all)h(of)g(the)0 53119 y(subsequen)-31 b(t)369 b(n)-31 b(um)g(b)31 b(ers)369 b(in)g(the)h(sequence)f(are,)g (to)31 b(o.)2767 56003 y Fm(As)449 b(an)h(exer)-57 b(cise,)464 b(c)-57 b(onvert)450 b Fk(factorial)h Fm(so)e(that)g(it)g(pr)-57 b(o)g(duc)g(es)450 b(a)g Fk(long)581 b(int)2767 57358 y Fm(as)396 b(a)g(r)-57 b(esult.)p eop %%Page: 112 138 112 137 bop 0 -2070 a Fv(112)29612 b(Dictionaries)p 0 -1627 38191 45 v 0 865 a Fl(10.7)1792 b(Coun)-50 b(ting)599 b(letters)0 3316 y Fn(In)354 b(Chapter)h(7,)j(w)-31 b(e)355 b(wrote)g(a)f(function)i(that)f(coun)-31 b(ted)355 b(the)g(n)-31 b(um)g(b)31 b(er)354 b(of)h(o)31 b(ccurrences)353 b(of)i(a)0 4671 y(letter)325 b(in)g(a)g(string.)478 b(A)325 b(more)g(general)g(v) -31 b(ersion)325 b(of)g(this)g(problem)g(is)g(to)g(form)g(a)g (histogram)0 6026 y(of)370 b(the)f(letters)h(in)f(the)h(string,)g(that) g(is,)g(ho)-31 b(w)370 b(man)-31 b(y)370 b(times)g(eac)-31 b(h)370 b(letter)g(app)31 b(ears.)0 8144 y(Suc)-31 b(h)367 b(a)g(histogram)h(migh)-31 b(t)369 b(b)31 b(e)366 b(useful)h(for)g (compressing)g(a)g(text)h(\257le.)492 b(Because)367 b(di\256eren)-31 b(t)0 9499 y(letters)313 b(app)31 b(ear)312 b(with)h(di\256eren)-31 b(t)312 b(frequencies,)324 b(w)-31 b(e)313 b(can)f(compress)g(a)g (\257le)h(b)-31 b(y)312 b(using)g(shorter)0 10854 y(co)31 b(des)282 b(for)g(common)i(letters)f(and)g(longer)g(co)31 b(des)282 b(for)g(letters)h(that)g(app)31 b(ear)283 b(less)e(frequen) -31 b(tly)-92 b(.)0 12971 y(Dictionaries)371 b(pro)-31 b(vide)370 b(an)f(elegan)-31 b(t)371 b(w)-31 b(a)g(y)371 b(to)f(generate)g(a)f(histogram:)0 15170 y Fk(>>>)582 b(letterCounts)h(=)e({})0 16525 y(>>>)h(for)f(letter)h(in)g ("Mississippi":)0 17880 y(...)1744 b(letterCounts[letter])584 b(=)d(letterCounts.get)j(\(letter,)e(0\))g(+)f(1)0 19235 y(...)0 20590 y(>>>)h(letterCounts)0 21945 y({'M':)g(1,)f('s':)h(4,)g ('p':)f(2,)h('i':)f(4})0 24143 y Fn(W)-92 b(e)438 b(start)h(with)g(an)g (empt)-31 b(y)440 b(dictionary)-92 b(.)702 b(F)-92 b(or)437 b(eac)-31 b(h)439 b(letter)g(in)g(the)g(string,)457 b(w)-31 b(e)438 b(\257nd)h(the)0 25498 y(curren)-31 b(t)543 b(coun)-31 b(t)544 b(\(p)31 b(ossibly)545 b(zero\))f(and)f(incremen)-31 b(t)545 b(it.)1016 b(A)-31 b(t)544 b(the)g(end,)587 b(the)544 b(dictionary)0 26853 y(con)-31 b(tains)371 b(pairs)e(of)h(letters)f (and)h(their)f(frequencies.)0 28971 y(It)364 b(migh)-31 b(t)367 b(b)31 b(e)363 b(more)i(app)31 b(ealing)366 b(to)f(displa)-31 b(y)366 b(the)e(histogram)j(in)d(alphab)31 b(etical)367 b(order.)491 b(W)-92 b(e)0 30326 y(can)369 b(do)h(that)g(with)h(the)e Fk(items)h Fn(and)f Fk(sort)h Fn(metho)31 b(ds:)0 32524 y Fk(>>>)582 b(letterItems)g(=)g(letterCounts.items\(\))0 33879 y(>>>)g(letterItems.sort\(\))0 35234 y(>>>)g(print)f(letterItems) 0 36589 y([\('M',)h(1\),)g(\('i',)g(4\),)f(\('p',)h(2\),)g(\('s',)g (4\)])0 38788 y Fn(Y)-92 b(ou)354 b(ha)-31 b(v)g(e)355 b(seen)e(the)h Fk(items)g Fn(metho)31 b(d)355 b(b)31 b(efore,)357 b(but)d Fk(sort)h Fn(is)e(the)h(\257rst)g(metho)31 b(d)354 b(y)-31 b(ou)355 b(ha)-31 b(v)g(e)0 40143 y(encoun)g(tered)292 b(that)g(applies)g(to)g(lists.)467 b(There)291 b(are)g(sev)-31 b(eral)292 b(other)f(list)h(metho)31 b(ds,)308 b(including)0 41498 y Fk(append)p Fn(,)370 b Fk(extend)p Fn(,)h(and)e Fk(reverse)p Fn(.)494 b(Consult)370 b(the)g(Python)g(do)31 b(cumen)-31 b(tation)372 b(for)e(details.)0 45942 y Fl(10.8)1792 b(Glossary)0 48059 y Fv(dictionary:)553 b Fn(A)308 b(collection)i(of)e (k)-31 b(ey-v)-61 b(alue)308 b(pairs)g(that)h(maps)e(from)i(k)-31 b(eys)307 b(to)h(v)-61 b(alues.)473 b(The)2767 49414 y(k)-31 b(eys)370 b(can)f(b)31 b(e)369 b(an)-31 b(y)370 b(imm)-31 b(utable)372 b(t)-31 b(yp)31 b(e,)370 b(and)f(the)h(v)-61 b(alues)369 b(can)h(b)31 b(e)368 b(an)-31 b(y)370 b(t)-31 b(yp)31 b(e.)0 51611 y Fv(k)-35 b(ey:)553 b Fn(A)369 b(v)-61 b(alue)370 b(that)g(is)f(used)g(to)h(lo)31 b(ok)370 b(up)f(an)h(en)-31 b(try)369 b(in)h(a)f(dictionary)-92 b(.)0 53807 y Fv(k)-35 b(ey-v)-71 b(alue)425 b(pair:)553 b Fn(One)369 b(of)g(the)h(items)g(in)f(a)h(dictionary)-92 b(.)0 56003 y Fv(metho)35 b(d:)555 b Fn(A)365 b(kind)h(of)g(function)h (that)g(is)f(called)g(with)h(a)f(di\256eren)-31 b(t)366 b(syn)-31 b(tax)366 b(and)g(in)-31 b(v)g(ok)g(ed)2767 57358 y(\\on")371 b(an)e(ob)61 b(ject.)p eop %%Page: 113 139 113 138 bop 0 -2070 a Fv(10.8)425 b(Glossary)28784 b(113)p 0 -1627 38191 45 v 0 865 a(in)-35 b(v)g(ok)g(e:)553 b Fn(T)-92 b(o)369 b(call)i(a)e(metho)31 b(d.)0 3106 y Fv(hin)-35 b(t:)553 b Fn(T)-92 b(emp)31 b(orary)337 b(storage)g(of)f(a) h(precomputed)g(v)-61 b(alue)336 b(to)h(a)-31 b(v)g(oid)339 b(redundan)-31 b(t)336 b(computa-)2767 4461 y(tion.)0 6701 y Fv(o)-35 b(v)g(er\260o)g(w:)554 b Fn(A)330 b(n)-31 b(umerical)331 b(result)f(that)g(is)g(to)31 b(o)331 b(large)f(to)h(b)31 b(e)329 b(represen)-31 b(ted)329 b(in)h(a)f(n)-31 b(umerical)2767 8056 y(format.)p eop %%Page: 114 140 114 139 bop 0 -2070 a Fv(114)29612 b(Dictionaries)p 0 -1627 38191 45 v eop %%Page: 115 141 115 140 bop 0 9901 a Fi(Chapter)861 b(11)0 16180 y Fo(Files)1032 b(and)h(exceptions)0 22641 y Fn(While)431 b(a)g(program)h(is)f (running,)447 b(its)431 b(data)h(is)f(in)g(memory)-92 b(.)679 b(When)430 b(the)h(program)h(ends,)0 23996 y(or)448 b(the)g(computer)g(sh)-31 b(uts)447 b(do)-31 b(wn,)469 b(data)449 b(in)f(memory)h(disapp)31 b(ears.)728 b(T)-92 b(o)448 b(store)g(data)h(p)31 b(er-)0 25351 y(manen)-31 b(tly)-92 b(,)370 b(y)-31 b(ou)368 b(ha)-31 b(v)g(e)368 b(to)g(put)g(it)g(in)f(a)g Fv(\257le)p Fn(.)493 b(Files)367 b(are)g(usually)h(stored)f(on)h(a)f(hard)g(driv)-31 b(e,)0 26706 y(\260opp)g(y)370 b(driv)-31 b(e,)370 b(or)f(CD-R)-31 b(OM.)0 28739 y(When)262 b(there)g(are)h(a)g(large)g(n)-31 b(um)g(b)31 b(er)263 b(of)g(\257les,)284 b(they)263 b(are)f(often)i (organized)g(in)-31 b(to)264 b Fv(directories)0 30094 y Fn(\(also)279 b(called)f(\\folders"\).)464 b(Eac)-31 b(h)278 b(\257le)f(is)g(iden)-31 b(ti\257ed)279 b(b)-31 b(y)277 b(a)h(unique)f(name,)297 b(or)277 b(a)h(com)-31 b(bination)0 31449 y(of)370 b(a)f(\257le)h(name)g(and)f(a)g(directory)h (name.)0 33482 y(By)263 b(reading)g(and)f(writing)j(\257les,)284 b(programs)263 b(can)f(exc)-31 b(hange)264 b(information)h(with)f(eac) -31 b(h)263 b(other)0 34837 y(and)369 b(generate)h(prin)-31 b(table)371 b(formats)f(lik)-31 b(e)371 b(PDF.)0 36870 y(W)-92 b(orking)357 b(with)i(\257les)e(is)f(a)i(lot)g(lik)-31 b(e)358 b(w)-31 b(orking)359 b(with)f(b)31 b(o)g(oks.)489 b(T)-92 b(o)357 b(use)g(a)g(b)31 b(o)g(ok,)360 b(y)-31 b(ou)358 b(ha)-31 b(v)g(e)358 b(to)0 38225 y(op)31 b(en)400 b(it.)586 b(When)399 b(y)-31 b(ou're)401 b(done,)408 b(y)-31 b(ou)401 b(ha)-31 b(v)g(e)401 b(to)f(close)h(it.)585 b(While)401 b(the)f(b)31 b(o)g(ok)400 b(is)g(op)31 b(en,)408 b(y)-31 b(ou)0 39579 y(can)345 b(either)f(write)i(in)e(it)h(or)g(read)f (from)h(it.)485 b(In)344 b(either)h(case,)k(y)-31 b(ou)345 b(kno)-31 b(w)346 b(where)e(y)-31 b(ou)345 b(are)g(in)0 40934 y(the)393 b(b)31 b(o)g(ok.)562 b(Most)393 b(of)g(the)f(time,)400 b(y)-31 b(ou)393 b(read)g(the)f(whole)i(b)31 b(o)g(ok)393 b(in)f(its)h(natural)h(order,)k(but)0 42289 y(y)-31 b(ou)370 b(can)f(also)h(skip)g(around.)0 44322 y(All)496 b(of)g(this)g(applies)g (to)g(\257les)f(as)g(w)-31 b(ell.)872 b(T)-92 b(o)496 b(op)31 b(en)495 b(a)g(\257le,)528 b(y)-31 b(ou)496 b(sp)31 b(ecify)495 b(its)h(name)g(and)0 45677 y(indicate)371 b(whether)e(y)-31 b(ou)370 b(w)-31 b(an)g(t)371 b(to)f(read)f(or)g (write.)0 47710 y(Op)31 b(ening)352 b(a)h(\257le)f(creates)g(a)g (\257le)g(ob)61 b(ject.)489 b(In)351 b(this)i(example,)k(the)352 b(v)-61 b(ariable)353 b Fk(f)f Fn(refers)f(to)i(the)0 49065 y(new)369 b(\257le)h(ob)61 b(ject.)0 51179 y Fk(>>>)582 b(f)f(=)g(open\("test.dat","w"\))0 52534 y(>>>)h(print)f(f)0 53889 y()0 56003 y Fn(The)276 b(op)31 b(en)275 b(function)j(tak)-31 b(es)276 b(t)-31 b(w)g(o)277 b(argumen)-31 b(ts.)463 b(The)276 b(\257rst)f(is)g(the)h(name)h(of)f(the)g(\257le,)295 b(and)276 b(the)0 57358 y(second)369 b(is)g(the)h(mo)31 b(de.)493 b(Mo)31 b(de)369 b Fk("w")g Fn(means)h(that)g(w)-31 b(e)370 b(are)f(op)31 b(ening)370 b(the)f(\257le)h(for)f(writing.)p eop %%Page: 116 142 116 141 bop 0 -2070 a Fv(116)25000 b(Files)424 b(and)h(exceptions)p 0 -1627 38191 45 v 0 865 a Fn(If)361 b(there)f(is)h(no)h(\257le)f (named)g Fk(test.dat)p Fn(,)j(it)e(will)h(b)31 b(e)360 b(created.)491 b(If)360 b(there)h(already)h(is)f(one,)i(it)0 2220 y(will)371 b(b)31 b(e)369 b(replaced)g(b)-31 b(y)369 b(the)h(\257le)f(w)-31 b(e)370 b(are)f(writing.)0 4245 y(When)418 b(w)-31 b(e)418 b(prin)-31 b(t)419 b(the)g(\257le)f(ob)61 b(ject,)432 b(w)-31 b(e)419 b(see)f(the)g(name)h(of)g(the)f(\257le,)431 b(the)419 b(mo)31 b(de,)431 b(and)419 b(the)0 5600 y(lo)31 b(cation)372 b(of)d(the)h(ob)61 b(ject.)0 7626 y(T)-92 b(o)370 b(put)f(data)i(in)e(the)g(\257le)h(w)-31 b(e)370 b(in)-31 b(v)g(ok)g(e)371 b(the)e Fk(write)h Fn(metho)31 b(d)370 b(on)f(the)h(\257le)f(ob)61 b(ject:)0 9732 y Fk(>>>)582 b(f.write\("Now)h(is)e(the)h(time"\))0 11087 y(>>>)g(f.write\("to)g(close)g(the)g(file"\))0 13193 y Fn(Closing)478 b(the)f(\257le)f(tells)i(the)e(system)h(that)g(w)-31 b(e)477 b(are)g(done)f(writing)i(and)f(mak)-31 b(es)477 b(the)g(\257le)0 14548 y(a)-31 b(v)-61 b(ailable)372 b(for)d(reading:)0 16655 y Fk(>>>)582 b(f.close\(\))0 18761 y Fn(No)-31 b(w)456 b(w)-31 b(e)455 b(can)g(op)31 b(en)455 b(the)f(\257le)h(again,)479 b(this)455 b(time)g(for)g (reading,)477 b(and)455 b(read)g(the)g(con)-31 b(ten)g(ts)0 20116 y(in)g(to)371 b(a)e(string.)493 b(This)370 b(time,)h(the)e(mo)31 b(de)370 b(argumen)-31 b(t)370 b(is)g Fk("r")f Fn(for)g(reading:)0 22222 y Fk(>>>)582 b(f)f(=)g(open\("test.dat","r"\))0 24329 y Fn(If)369 b(w)-31 b(e)370 b(try)f(to)h(op)31 b(en)369 b(a)g(\257le)h(that)g(do)31 b(esn't)370 b(exist,)g(w)-31 b(e)370 b(get)g(an)f(error:)0 26435 y Fk(>>>)582 b(f)f(=)g (open\("test.cat","r"\))0 27790 y(IOError:)h([Errno)g(2])g(No)f(such)h (file)g(or)f(directory:)i('test.cat')0 29897 y Fn(Not)304 b(surprisingly)-92 b(,)317 b(the)304 b Fk(read)f Fn(metho)31 b(d)304 b(reads)f(data)h(from)g(the)f(\257le.)471 b(With)304 b(no)f(argumen)-31 b(ts,)0 31252 y(it)370 b(reads)f(the)g(en)-31 b(tire)370 b(con)-31 b(ten)g(ts)370 b(of)g(the)f(\257le:)0 33358 y Fk(>>>)582 b(text)f(=)h(f.read\(\))0 34713 y(>>>)g(print)f (text)0 36068 y(Now)h(is)f(the)h(timeto)g(close)g(the)f(file)0 38174 y Fn(There)435 b(is)g(no)g(space)g(b)31 b(et)-31 b(w)g(een)436 b(\\time")h(and)f(\\to")g(b)31 b(ecause)435 b(w)-31 b(e)436 b(did)f(not)h(write)g(a)f(space)0 39529 y(b)31 b(et)-31 b(w)g(een)370 b(the)g(strings.)0 41554 y Fk(read)g Fn(can)f(also)h(tak)-31 b(e)371 b(an)e(argumen)-31 b(t)371 b(that)f(indicates)h(ho)-31 b(w)370 b(man)-31 b(y)370 b(c)-31 b(haracters)369 b(to)h(read:)0 43661 y Fk(>>>)582 b(f)f(=)g(open\("test.dat","r"\))0 45016 y(>>>)h(print)f(f.read\(5\))0 46371 y(Now)h(i)0 48477 y Fn(If)360 b(not)h(enough)g(c)-31 b(haracters)361 b(are)f(left)h(in)g (the)f(\257le,)j Fk(read)e Fn(returns)e(the)h(remaining)i(c)-31 b(harac-)0 49832 y(ters.)492 b(When)369 b(w)-31 b(e)369 b(get)h(to)g(the)g(end)f(of)g(the)h(\257le,)g Fk(read)f Fn(returns)g(the)g(empt)-31 b(y)370 b(string:)0 51938 y Fk(>>>)582 b(print)f(f.read\(1000006\))0 53293 y(s)g(the)h(timeto)g (close)g(the)f(file)0 54648 y(>>>)h(print)f(f.read\(\))0 57358 y(>>>)p eop %%Page: 117 143 117 142 bop 0 -2070 a Fv(11.1)425 b(T)-106 b(ext)425 b(\257les)28493 b(117)p 0 -1627 38191 45 v 0 865 a Fn(The)415 b(follo)-31 b(wing)419 b(function)d(copies)f(a)g(\257le,)427 b(reading)416 b(and)f(writing)i(up)d(to)i(\257ft)-31 b(y)416 b(c)-31 b(haracters)0 2220 y(at)375 b(a)f(time.)508 b(The)375 b(\257rst)e(argumen)-31 b(t)376 b(is)e(the)g(name)g(of)h(the) f(original)j(\257le;)g(the)d(second)g(is)g(the)0 3575 y(name)c(of)g(the)f(new)g(\257le:)0 5825 y Fk(def)582 b(copyFile\(oldFile,)h(newFile\):)1162 7180 y(f1)f(=)f(open\(oldFile,)i ("r"\))1162 8535 y(f2)f(=)f(open\(newFile,)i("w"\))1162 9890 y(while)f(1:)2325 11245 y(text)f(=)h(f1.read\(50\))2325 12600 y(if)f(text)h(==)f("":)3487 13955 y(break)2325 15310 y(f2.write\(text\))1162 16665 y(f1.close\(\))1162 18020 y(f2.close\(\))1162 19375 y(return)0 21625 y Fn(The)424 b Fk(break)g Fn(statemen)-31 b(t)426 b(is)e(new.)657 b(Executing)425 b(it)g(breaks)e(out)i(of)f(the)g(lo)31 b(op;)453 b(the)424 b(\260o)-31 b(w)424 b(of)0 22980 y(execution)371 b(mo)-31 b(v)g(es)370 b(to)g(the)f(\257rst)g(statemen) -31 b(t)371 b(after)f(the)f(lo)31 b(op.)0 25150 y(In)424 b(this)g(example,)440 b(the)425 b Fk(while)f Fn(lo)31 b(op)426 b(is)e(in\257nite)h(b)31 b(ecause)424 b(the)g(v)-61 b(alue)425 b Fk(1)f Fn(is)g(alw)-31 b(a)g(ys)427 b(true.)0 26505 y(The)401 b Fm(only)h Fn(w)-31 b(a)g(y)402 b(to)g(get)g(out)f(of) h(the)f(lo)31 b(op)402 b(is)f(to)h(execute)f Fk(break)p Fn(,)410 b(whic)-31 b(h)402 b(happ)31 b(ens)401 b(when)0 27859 y Fk(text)370 b Fn(is)f(the)g(empt)-31 b(y)371 b(string,)f(whic)-31 b(h)370 b(happ)31 b(ens)369 b(when)g(w)-31 b(e)370 b(get)g(to)f(the)h(end)f(of)h(the)f(\257le.)0 32383 y Fl(11.1)1792 b(T)-149 b(ext)599 b(\257les)0 34888 y Fn(A)293 b Fv(text)338 b(\257le)293 b Fn(is)g(a)h(\257le)f(that)i (con)-31 b(tains)295 b(prin)-31 b(table)294 b(c)-31 b(haracters)294 b(and)f(whitespace,)311 b(organized)0 36243 y(in)-31 b(to)321 b(lines)f(separated)h(b)-31 b(y)320 b(newline)g(c)-31 b(haracters.)477 b(Since)320 b(Python)h(is)f(sp)31 b(eci\257cally)321 b(designed)0 37598 y(to)370 b(pro)31 b(cess)368 b(text)i(\257les,)g(it) g(pro)-31 b(vides)369 b(metho)31 b(ds)370 b(that)g(mak)-31 b(e)371 b(the)e(job)h(easy)-92 b(.)0 39767 y(T)g(o)481 b(demonstrate,)510 b(w)-31 b(e'll)483 b(create)e(a)g(text)g(\257le)g (with)h(three)e(lines)h(of)g(text)h(separated)f(b)-31 b(y)0 41122 y(newlines:)0 43373 y Fk(>>>)582 b(f)f(=)g (open\("test.dat","w"\))0 44728 y(>>>)h(f.write\("line)h(one\\nline)f (two\\nline)h(three\\n"\))0 46083 y(>>>)f(f.close\(\))0 48333 y Fn(The)480 b Fk(readline)g Fn(metho)31 b(d)481 b(reads)e(all)i(the)f(c)-31 b(haracters)480 b(up)f(to)h(and)g (including)i(the)d(next)0 49688 y(newline)370 b(c)-31 b(haracter:)0 51938 y Fk(>>>)582 b(f)f(=)g(open\("test.dat","r"\))0 53293 y(>>>)h(print)f(f.readline\(\))0 54648 y(line)h(one)0 57358 y(>>>)p eop %%Page: 118 144 118 143 bop 0 -2070 a Fv(118)25000 b(Files)424 b(and)h(exceptions)p 0 -1627 38191 45 v 0 865 a Fk(readlines)370 b Fn(returns)e(all)j(of)f (the)f(remaining)i(lines)f(as)f(a)g(list)h(of)g(strings:)0 2900 y Fk(>>>)582 b(print)f(f.readlines\(\))0 4255 y(['line)h (two\\012',)h('line)e(three\\012'])0 6290 y Fn(In)408 b(this)g(case,)418 b(the)408 b(output)h(is)f(in)h(list)f(format,)420 b(whic)-31 b(h)409 b(means)f(that)i(the)e(strings)g(app)31 b(ear)0 7645 y(with)316 b(quotation)i(marks)d(and)g(the)h(newline)g(c) -31 b(haracter)315 b(app)31 b(ears)315 b(as)g(the)g(escap)31 b(e)314 b(sequence)0 9000 y Fk(012)p Fn(.)0 10954 y(A)-31 b(t)280 b(the)g(end)f(of)h(the)f(\257le,)298 b Fk(readline)281 b Fn(returns)d(the)i(empt)-31 b(y)280 b(string)g(and)f Fk(readlines)i Fn(returns)0 12309 y(the)369 b(empt)-31 b(y)371 b(list:)0 14344 y Fk(>>>)582 b(print)f(f.readline\(\))0 17053 y(>>>)h(print)f(f.readlines\(\))0 18408 y([])0 20443 y Fn(The)342 b(follo)-31 b(wing)346 b(is)c(an)h(example)g(of)g(a) f(line-pro)31 b(cessing)343 b(program.)484 b Fk(filterFile)344 b Fn(mak)-31 b(es)343 b(a)0 21798 y(cop)-31 b(y)370 b(of)g Fk(oldFile)p Fn(,)g(omitting)i(an)-31 b(y)370 b(lines)g(that)g(b)31 b(egin)370 b(with)g Fk(#)p Fn(:)0 23833 y Fk(def)582 b(filterFile\(oldFile,)i(newFile\):)1162 25188 y(f1)e(=)f (open\(oldFile,)i("r"\))1162 26543 y(f2)f(=)f(open\(newFile,)i("w"\)) 1162 27898 y(while)f(1:)2325 29253 y(text)f(=)h(f1.readline\(\))2325 30608 y(if)f(text)h(==)f("":)3487 31963 y(break)2325 33318 y(if)g(text[0])h(==)g('#':)3487 34672 y(continue)2325 36027 y(f2.write\(text\))1162 37382 y(f1.close\(\))1162 38737 y(f2.close\(\))1162 40092 y(return)0 42127 y Fn(The)418 b Fk(continue)h Fn(statemen)-31 b(t)421 b(ends)c(the)h(curren)-31 b(t)418 b(iteration)i(of)f(the)f(lo)31 b(op,)432 b(but)419 b(con)-31 b(tin)g(ues)0 43482 y(lo)31 b(oping.)457 b(The)256 b(\260o)-31 b(w)257 b(of)f(execution)h(mo)-31 b(v)g(es)257 b(to)g(the)f(top)h(of)f(the)g(lo)31 b(op,)280 b(c)-31 b(hec)g(ks)256 b(the)g(condition,)0 44837 y(and)369 b(pro)31 b(ceeds)369 b(accordingly)-92 b(.)0 46791 y(Th)-31 b(us,)399 b(if)393 b Fk(text)h Fn(is)e(the)h(empt)-31 b(y)394 b(string,)400 b(the)393 b(lo)31 b(op)393 b(exits.)564 b(If)393 b(the)g(\257rst)f(c) -31 b(haracter)393 b(of)h Fk(text)0 48146 y Fn(is)384 b(a)g(hash)g(mark,)389 b(the)384 b(\260o)-31 b(w)385 b(of)g(execution)g(go)31 b(es)384 b(to)h(the)g(top)f(of)h(the)f(lo)31 b(op.)538 b(Only)385 b(if)f(b)31 b(oth)0 49501 y(conditions)371 b(fail)g(do)e(w)-31 b(e)370 b(cop)-31 b(y)370 b Fk(text)f Fn(in)-31 b(to)371 b(the)e(new)h(\257le.)0 53716 y Fl(11.2)1792 b(W)-149 b(riting)599 b(v)-100 b(ariables)0 56003 y Fn(The)370 b(argumen)-31 b(t)371 b(of)g Fk(write)f Fn(has)g(to)h(b)31 b(e)369 b(a)h(string,)h(so)f(if)h(w)-31 b(e)370 b(w)-31 b(an)g(t)372 b(to)e(put)g(other)h(v)-61 b(alues)370 b(in)0 57358 y(a)434 b(\257le,)451 b(w)-31 b(e)435 b(ha)-31 b(v)g(e)435 b(to)g(con)-31 b(v)g(ert)435 b(them)g(to)f(strings)g (\257rst.)687 b(The)435 b(easiest)f(w)-31 b(a)g(y)436 b(to)e(do)h(that)g(is)p eop %%Page: 119 145 119 144 bop 0 -2070 a Fv(11.2)425 b(W)-106 b(riting)425 b(v)-71 b(ariables)24026 b(119)p 0 -1627 38191 45 v 0 865 a Fn(with)370 b(the)g Fk(str)f Fn(function:)0 3151 y Fk(>>>)582 b(x)f(=)g(52)0 4506 y(>>>)h(f.write)g(\(str\(x\)\))0 6792 y Fn(An)398 b(alternativ)-31 b(e)401 b(is)e(to)g(use)f(the)g Fv(format)459 b(op)35 b(erator)400 b Fk(\045)p Fn(.)581 b(When)397 b(applied)j(to)f(in)-31 b(tegers,)407 b Fk(\045)0 8147 y Fn(is)338 b(the)h(mo)31 b(dulus)339 b(op)31 b(erator.)483 b(But)338 b(when)h(the)f(\257rst)g(op)31 b(erand)338 b(is)g(a)h(string,)345 b Fk(\045)339 b Fn(is)f(the)g(format)0 9502 y(op)31 b(erator.)0 11707 y(The)413 b(\257rst)f(op)31 b(erand)412 b(is)h(the)f Fv(format)475 b(string)p Fn(,)425 b(and)412 b(the)h(second)f(op)31 b(erand)413 b(is)f(a)h(tuple)g(of)0 13062 y(expressions.)626 b(The)415 b(result)f(is)g(a)g(string)g(that)h (con)-31 b(tains)416 b(the)e(v)-61 b(alues)414 b(of)h(the)f (expressions,)0 14417 y(formatted)371 b(according)g(to)f(the)f(format)i (string.)0 16622 y(As)249 b(a)h(simple)h(example,)275 b(the)250 b Fv(format)288 b(sequence)251 b Fk("\045d")f Fn(means)g(that)h(the)f(\257rst)f(expression)0 17977 y(in)483 b(the)h(tuple)g(should)f(b)31 b(e)483 b(formatted)i(as)e(an)g (in)-31 b(teger.)836 b(Here)483 b(the)g(letter)h Fm(d)f Fn(stands)g(for)0 19332 y(\\decimal":)0 21618 y Fk(>>>)582 b(cars)f(=)h(52)0 22973 y(>>>)g("\045d")f(\045)h(cars)0 24328 y('52')0 26614 y Fn(The)332 b(result)g(is)g(the)g(string)h Fk('52')p Fn(,)340 b(whic)-31 b(h)333 b(is)f(not)h(to)f(b)31 b(e)332 b(confused)g(with)h(the)f(in)-31 b(teger)333 b(v)-61 b(alue)0 27969 y Fk(52)p Fn(.)0 30174 y(A)352 b(format)i(sequence)d(can)i(app)31 b(ear)352 b(an)-31 b(ywhere)353 b(in)f(the)h(format)g(string,)k(so)352 b(w)-31 b(e)352 b(can)h(em)-31 b(b)31 b(ed)0 31529 y(a)369 b(v)-61 b(alue)370 b(in)g(a)f(sen)-31 b(tence:)0 33815 y Fk(>>>)582 b(cars)f(=)h(52)0 35170 y(>>>)g("In)f(July)h(we)f(sold)h(\045d)g (cars.")g(\045)f(cars)0 36524 y('In)h(July)f(we)h(sold)g(52)f(cars.')0 38811 y Fn(The)312 b(format)h(sequence)e Fk("\045f")h Fn(formats)g(the)g(next)g(item)h(in)e(the)h(tuple)g(as)g(a)f (\260oating-p)31 b(oin)-31 b(t)0 40165 y(n)g(um)g(b)31 b(er,)370 b(and)f Fk("\045s")h Fn(formats)g(the)f(next)h(item)h(as)e(a) g(string:)0 42451 y Fk(>>>)582 b("In)f(\045d)h(days)f(we)h(made)g (\045f)f(million)h(\045s.")g(\045)f(\(34,6.1,'dollars'\))0 43806 y('In)h(34)f(days)h(we)f(made)h(6.100000)g(million)h(dollars.')0 46092 y Fn(By)369 b(default,)i(the)f(\260oating-p)31 b(oin)-31 b(t)373 b(format)d(prin)-31 b(ts)370 b(six)f(decimal)i (places.)0 48297 y(The)501 b(n)-31 b(um)g(b)31 b(er)502 b(of)f(expressions)g(in)g(the)h(tuple)g(has)f(to)h(matc)-31 b(h)502 b(the)g(n)-31 b(um)g(b)31 b(er)501 b(of)g(format)0 49652 y(sequences)435 b(in)i(the)f(string.)694 b(Also,)454 b(the)436 b(t)-31 b(yp)31 b(es)437 b(of)f(the)h(expressions)e(ha)-31 b(v)g(e)437 b(to)g(matc)-31 b(h)438 b(the)0 51007 y(format)371 b(sequences:)0 53293 y Fk(>>>)582 b("\045d)f(\045d)h(\045d")f(\045)h (\(1,2\))0 54648 y(TypeError:)h(not)e(enough)h(arguments)h(for)e (format)h(string)0 56003 y(>>>)g("\045d")f(\045)h('dollars')0 57358 y(TypeError:)h(illegal)f(argument)g(type)g(for)g(built-in)g (operation)p eop %%Page: 120 146 120 145 bop 0 -2070 a Fv(120)25000 b(Files)424 b(and)h(exceptions)p 0 -1627 38191 45 v 0 865 a Fn(In)337 b(the)g(\257rst)g(example,)346 b(there)337 b(aren't)h(enough)g(expressions;)347 b(in)338 b(the)f(second,)344 b(the)338 b(expres-)0 2220 y(sion)370 b(is)f(the)g(wrong)h(t)-31 b(yp)31 b(e.)0 4150 y(F)-92 b(or)492 b(more)i(con)-31 b(trol)494 b(o)-31 b(v)g(er)494 b(the)f(format)i(of)f(n)-31 b(um)g(b)31 b(ers,)524 b(w)-31 b(e)493 b(can)h(sp)31 b(ecify)493 b(the)g(n)-31 b(um)g(b)31 b(er)493 b(of)0 5505 y(digits)371 b(as)e(part)g(of)h(the)f(format)i (sequence:)0 7517 y Fk(>>>)582 b("\0456d")f(\045)h(62)0 8872 y(')2325 b(62')0 10227 y(>>>)582 b("\04512f")g(\045)f(6.1)0 11582 y(')2325 b(6.100000')0 13593 y Fn(The)286 b(n)-31 b(um)g(b)31 b(er)286 b(after)g(the)g(p)31 b(ercen)-31 b(t)285 b(sign)h(is)g(the)g(minim)-31 b(um)288 b(n)-31 b(um)g(b)31 b(er)286 b(of)g(spaces)f(the)h(n)-31 b(um)g(b)31 b(er)0 14948 y(will)366 b(tak)-31 b(e)365 b(up.)490 b(If)364 b(the)g(v)-61 b(alue)364 b(pro)-31 b(vided)365 b(tak)-31 b(es)365 b(few)-31 b(er)364 b(digits,)j(leading)e(spaces)f(are)f (added.)0 16303 y(If)369 b(the)g(n)-31 b(um)g(b)31 b(er)370 b(of)f(spaces)g(is)g(negativ)-31 b(e,)372 b(trailing)f(spaces)e(are)g (added:)0 18314 y Fk(>>>)582 b("\045-6d")g(\045)f(62)0 19669 y('62)2325 b(')0 21681 y Fn(F)-92 b(or)419 b(\260oating-p)31 b(oin)-31 b(t)424 b(n)-31 b(um)g(b)31 b(ers,)433 b(w)-31 b(e)421 b(can)f(also)h(sp)31 b(ecify)420 b(the)h(n)-31 b(um)g(b)31 b(er)420 b(of)g(digits)i(after)f(the)0 23035 y(decimal)371 b(p)31 b(oin)-31 b(t:)0 25047 y Fk(>>>)582 b("\04512.2f")g(\045)f(6.1)0 26402 y(')4649 b(6.10')0 28413 y Fn(In)372 b(this)h(example,)i(the)e(result)f(tak)-31 b(es)373 b(up)f(t)-31 b(w)g(elv)g(e)375 b(spaces)d(and)h(includes)f(t) -31 b(w)g(o)375 b(digits)e(after)0 29768 y(the)347 b(decimal.)487 b(This)347 b(format)i(is)e(useful)g(for)g(prin)-31 b(ting)348 b(dollar)g(amoun)-31 b(ts)349 b(with)f(the)f(decimal)0 31123 y(p)31 b(oin)-31 b(ts)370 b(aligned.)0 33053 y(F)-92 b(or)509 b(example,)546 b(imagine)512 b(a)d(dictionary)j(that)e(con)-31 b(tains)511 b(studen)-31 b(t)510 b(names)g(as)f(k)-31 b(eys)510 b(and)0 34408 y(hourly)411 b(w)-31 b(ages)412 b(as)e(v)-61 b(alues.)617 b(Here)410 b(is)g(a)h(function)h(that)g(prin) -31 b(ts)410 b(the)h(con)-31 b(ten)g(ts)412 b(of)f(the)g(dic-)0 35763 y(tionary)371 b(as)e(a)g(formatted)i(rep)31 b(ort:)0 37775 y Fk(def)582 b(report)g(\(wages\))g(:)1162 39130 y(students)h(=)e(wages.keys\(\))1162 40485 y(students.sort\(\))1162 41839 y(for)h(student)g(in)g(students)g(:)2325 43194 y(print)f("\045-20s)i(\04512.02f")f(\045)f(\(student,)i (wages[student]\))0 45206 y Fn(T)-92 b(o)345 b(test)h(this)f(the)g (function,)352 b(w)-31 b(e'll)347 b(create)e(a)g(small)h(dictionary)h (and)e(prin)-31 b(t)346 b(the)f(con)-31 b(ten)g(ts:)0 47217 y Fk(>>>)582 b(wages)f(=)h({'mary':)g(6.23,)g('joe':)g(5.45,)g ('joshua':)g(4.25})0 48572 y(>>>)g(report)g(\(wages\))0 49927 y(joe)15110 b(5.45)0 51282 y(joshua)13367 b(4.25)0 52637 y(mary)14529 b(6.23)0 54648 y Fn(By)358 b(con)-31 b(trolling)360 b(the)e(width)g(of)g(eac)-31 b(h)358 b(v)-61 b(alue,)361 b(w)-31 b(e)358 b(guaran)-31 b(tee)359 b(that)f(the)g (columns)g(will)h(line)0 56003 y(up,)290 b(as)270 b(long)h(as)f(the)g (names)h(con)-31 b(tain)271 b(few)-31 b(er)271 b(than)f(t)-31 b(w)g(en)g(t)g(y-one)273 b(c)-31 b(haracters)270 b(and)h(the)f(w)-31 b(ages)0 57358 y(are)369 b(less)g(than)h(one)f(billion)i(dollars)g(an)e (hour.)p eop %%Page: 121 147 121 146 bop 0 -2070 a Fv(11.3)425 b(Directories)27497 b(121)p 0 -1627 38191 45 v 0 865 a Fl(11.3)1792 b(Directories)0 3517 y Fn(When)389 b(y)-31 b(ou)390 b(create)f(a)h(new)f(\257le)h(b)-31 b(y)389 b(op)31 b(ening)390 b(it)g(and)g(writing,)396 b(the)390 b(new)f(\257le)h(go)31 b(es)389 b(in)h(the)0 4872 y(curren)-31 b(t)466 b(directory)h(\(wherev)-31 b(er)466 b(y)-31 b(ou)467 b(w)-31 b(ere)467 b(when)f(y)-31 b(ou)467 b(ran)f(the)h(program\).)785 b(Similarly)-92 b(,)0 6227 y(when)369 b(y)-31 b(ou)370 b(op)31 b(en)369 b(a)h(\257le)f(for)h(reading,)g(Python)h(lo)31 b(oks)370 b(for)f(it)h(in)f(the)h(curren)-31 b(t)369 b(directory)-92 b(.)0 8502 y(If)380 b(y)-31 b(ou)382 b(w)-31 b(an)g(t)382 b(to)g(op)31 b(en)380 b(a)h(\257le)g(somewhere)g(else,)j(y)-31 b(ou)382 b(ha)-31 b(v)g(e)381 b(to)h(sp)31 b(ecify)381 b(the)f Fv(path)h Fn(to)h(the)0 9857 y(\257le,)370 b(whic)-31 b(h)370 b(is)f(the)h(name)g(of)f(the)h(directory)f(\(or)h(folder\))g (where)f(the)h(\257le)f(is)g(lo)31 b(cated:)0 12213 y Fk(>>>)1744 b(f)581 b(=)g(open\("/usr/share/dict/words","r"\))0 13568 y(>>>)1744 b(print)582 b(f.readline\(\))0 14923 y(Aarhus)0 17278 y Fn(This)336 b(example)h(op)31 b(ens)335 b(a)h(\257le)g(named)g Fk(words)g Fn(that)h(resides)e(in)h(a)g (directory)g(named)g Fk(dict)p Fn(,)0 18633 y(whic)-31 b(h)533 b(resides)f(in)g Fk(share)p Fn(,)574 b(whic)-31 b(h)533 b(resides)f(in)g Fk(usr)p Fn(,)574 b(whic)-31 b(h)533 b(resides)f(in)g(the)h(top-lev)-31 b(el)0 19988 y(directory)370 b(of)f(the)h(system,)g(called)g Fk(/)p Fn(.)0 22263 y(Y)-92 b(ou)460 b(cannot)h(use)e Fk(/)h Fn(as)g(part)g(of)g(a)h(\257lename;)506 b(it)461 b(is)f(reserv)-31 b(ed)459 b(as)g(a)h(delimiter)i(b)31 b(et)-31 b(w)g(een)0 23618 y(directory)370 b(and)f(\257lenames.)0 25893 y(The)333 b(\257le)g Fk(/usr/share/dict/words)j Fn(con)-31 b(tains)335 b(a)e(list)h(of)f(w)-31 b(ords)333 b(in)g(alphab)31 b(etical)336 b(order,)0 27248 y(of)370 b(whic)-31 b(h)370 b(the)f(\257rst)g(is)g (the)g(name)h(of)g(a)g(Danish)f(univ)-31 b(ersit)g(y)-92 b(.)0 32087 y Fl(11.4)1792 b(Pic)-50 b(kling)0 34740 y Fn(In)330 b(order)g(to)h(put)g(v)-61 b(alues)331 b(in)-31 b(to)332 b(a)f(\257le,)339 b(y)-31 b(ou)331 b(ha)-31 b(v)g(e)332 b(to)f(con)-31 b(v)g(ert)332 b(them)f(to)g(strings.)480 b(Y)-92 b(ou)331 b(ha)-31 b(v)g(e)0 36095 y(already)370 b(seen)f(ho)-31 b(w)370 b(to)g(do)f(that)i(with)f Fk(str)p Fn(:)0 38450 y Fk(>>>)582 b(f.write)g(\(str\(12.3\)\))0 39805 y(>>>)g(f.write)g(\(str\([1,2,3]\)\))0 42161 y Fn(The)274 b(problem)h(is)f(that)h(when)f(y)-31 b(ou)274 b(read)g(the)g(v)-61 b(alue)275 b(bac)-31 b(k,)294 b(y)-31 b(ou)274 b(get)h(a)f(string.)462 b(The)274 b(original)0 43516 y(t)-31 b(yp)31 b(e)307 b(information)i(has)e(b)31 b(een)306 b(lost.)472 b(In)306 b(fact,)321 b(y)-31 b(ou)307 b(can't)g(ev)-31 b(en)307 b(tell)h(where)e(one)h(v)-61 b(alue)307 b(ends)0 44871 y(and)369 b(the)h(next)g(b)31 b(egins:)0 47227 y Fk(>>>)1744 b(f.readline\(\))0 48582 y('12.3[1,)582 b(2,)g(3]')0 50938 y Fn(The)371 b(solution)i(is)d Fv(pic)-35 b(kling)p Fn(,)371 b(so)g(called)h(b)31 b(ecause)370 b(it)i(\\preserv)-31 b(es")370 b(data)i(structures.)497 b(The)0 52292 y Fk(pickle)473 b Fn(mo)31 b(dule)473 b(con)-31 b(tains)473 b(the)g(necessary)e(commands.)803 b(T)-92 b(o)473 b(use)e(it,)499 b(imp)31 b(ort)473 b Fk(pickle)0 53647 y Fn(and)369 b(then)h(op)31 b(en)369 b(the)g(\257le)h(in)f(the)h (usual)f(w)-31 b(a)g(y:)0 56003 y Fk(>>>)582 b(import)g(pickle)0 57358 y(>>>)g(f)f(=)g(open\("test.pck","w"\))p eop %%Page: 122 148 122 147 bop 0 -2070 a Fv(122)25000 b(Files)424 b(and)h(exceptions)p 0 -1627 38191 45 v 0 865 a Fn(T)-92 b(o)433 b(store)f(a)h(data)g (structure,)448 b(use)432 b(the)g Fk(dump)h Fn(metho)31 b(d)433 b(and)g(then)f(close)h(the)g(\257le)f(in)h(the)0 2220 y(usual)370 b(w)-31 b(a)g(y:)0 4467 y Fk(>>>)582 b(pickle.dump\(12.3,)h(f\))0 5821 y(>>>)f(pickle.dump\([1,2,3],)i(f\))0 7176 y(>>>)e(f.close\(\))0 9423 y Fn(Then)343 b(w)-31 b(e)344 b(can)g(op)31 b(en)343 b(the)h(\257le)f(for)g(reading)h(and)g (load)g(the)g(data)g(structures)f(w)-31 b(e)344 b(dump)31 b(ed:)0 11669 y Fk(>>>)582 b(f)f(=)g(open\("test.pck","r"\))0 13024 y(>>>)h(x)f(=)g(pickle.load\(f\))0 14379 y(>>>)h(x)0 15734 y(12.3)0 17089 y(>>>)g(type\(x\))0 18444 y()0 19799 y(>>>)g(y)f(=)g(pickle.load\(f\))0 21154 y(>>>)h(y)0 22509 y([1,)g(2,)f(3])0 23864 y(>>>)h(type\(y\))0 25219 y()0 27465 y Fn(Eac)-31 b(h)339 b(time)h(w)-31 b(e)339 b(in)-31 b(v)g(ok)g(e)340 b Fk(load)p Fn(,)346 b(w)-31 b(e)339 b(get)g(a)g(single)g(v)-61 b(alue)339 b(from)g(the)f(\257le,)346 b(complete)340 b(with)g(its)0 28820 y(original)371 b(t)-31 b(yp)31 b(e.)0 33332 y Fl(11.5)1792 b(Exceptions)0 35831 y Fn(Whenev)-31 b(er)251 b(a)h(run)-31 b(time)252 b(error)f(o)31 b(ccurs,)275 b(it)252 b(creates)f(an)h Fv(exception)p Fn(.)455 b(Usually)-92 b(,)276 b(the)252 b(program)0 37186 y(stops)369 b(and)h(Python)g(prin)-31 b(ts)369 b(an)h(error)e(message.)0 39351 y(F)-92 b(or)368 b(example,)j(dividing)h(b)-31 b(y)369 b(zero)g(creates)g(an)h (exception:)0 41598 y Fk(>>>)582 b(print)f(55/0)0 42953 y(ZeroDivisionError:)j(integer)e(division)g(or)g(modulo)0 45199 y Fn(So)369 b(do)31 b(es)369 b(accessing)h(a)f(nonexisten)-31 b(t)371 b(list)f(item:)0 47445 y Fk(>>>)582 b(a)f(=)g([])0 48800 y(>>>)h(print)f(a[5])0 50155 y(IndexError:)i(list)f(index)f(out)h (of)f(range)0 52402 y Fn(Or)369 b(accessing)g(a)h(k)-31 b(ey)369 b(that)i(isn't)f(in)f(the)h(dictionary:)0 54648 y Fk(>>>)582 b(b)f(=)g({})0 56003 y(>>>)h(print)f(b['what'])0 57358 y(KeyError:)h(what)p eop %%Page: 123 149 123 148 bop 0 -2070 a Fv(11.5)425 b(Exceptions)27536 b(123)p 0 -1627 38191 45 v 0 865 a Fn(In)514 b(eac)-31 b(h)516 b(case,)551 b(the)515 b(error)f(message)h(has)g(t)-31 b(w)g(o)516 b(parts:)784 b(the)515 b(t)-31 b(yp)31 b(e)515 b(of)g(error)f(b)31 b(efore)515 b(the)0 2220 y(colon,)587 b(and)542 b(sp)31 b(eci\257cs)541 b(ab)31 b(out)543 b(the)f(error)f (after)h(the)g(colon.)1012 b(Normally)544 b(Python)f(also)0 3575 y(prin)-31 b(ts)437 b(a)f(tracebac)-31 b(k)438 b(of)f(where)f(the) h(program)g(w)-31 b(as,)455 b(but)437 b(w)-31 b(e)437 b(ha)-31 b(v)g(e)437 b(omitted)i(that)e(from)0 4930 y(the)369 b(examples.)0 7097 y(Sometimes)349 b(w)-31 b(e)347 b(w)-31 b(an)g(t)349 b(to)f(execute)f(an)h(op)31 b(eration)348 b(that)g(could)g(cause)f(an)g(exception,)354 b(but)0 8452 y(w)-31 b(e)447 b(don't)h(w)-31 b(an)g(t)448 b(the)f(program)h(to) f(stop.)726 b(W)-92 b(e)446 b(can)h Fv(handle)g Fn(the)g(exception)h (using)f(the)0 9807 y Fk(try)369 b Fn(and)h Fk(except)g Fn(statemen)-31 b(ts.)0 11974 y(F)-92 b(or)404 b(example,)416 b(w)-31 b(e)405 b(migh)-31 b(t)406 b(prompt)g(the)f(user)f(for)h(the)g (name)g(of)g(a)g(\257le)g(and)g(then)g(try)g(to)0 13329 y(op)31 b(en)387 b(it.)546 b(If)386 b(the)h(\257le)g(do)31 b(esn't)387 b(exist,)392 b(w)-31 b(e)388 b(don't)f(w)-31 b(an)g(t)389 b(the)e(program)g(to)h(crash;)395 b(w)-31 b(e)387 b(w)-31 b(an)g(t)0 14684 y(to)370 b(handle)g(the)f(exception:)0 16932 y Fk(filename)582 b(=)g(raw_input\('Enter)h(a)e(file)h(name:)g ('\))0 18287 y(try:)1162 19642 y(f)g(=)f(open)h(\(filename,)g("r"\))0 20997 y(except:)1162 22352 y(print)g('There)g(is)g(no)f(file)h(named',) g(filename)0 24600 y Fn(The)389 b Fk(try)g Fn(statemen)-31 b(t)391 b(executes)e(the)h(statemen)-31 b(ts)390 b(in)f(the)h(\257rst)e (blo)31 b(c)-31 b(k.)553 b(If)389 b(no)g(exceptions)0 25955 y(o)31 b(ccur,)352 b(it)d(ignores)g(the)f Fk(except)h Fn(statemen)-31 b(t.)488 b(If)347 b(an)-31 b(y)349 b(exception)h(o)31 b(ccurs,)352 b(it)d(executes)f(the)0 27310 y(statemen)-31 b(ts)371 b(in)e(the)h Fk(except)g Fn(branc)-31 b(h)369 b(and)g(then)h(con)-31 b(tin)g(ues.)0 29477 y(W)-92 b(e)390 b(can)g(encapsulate)i(this)f(capabilit)-31 b(y)394 b(in)c(a)h (function:)537 b Fk(exists)391 b Fn(tak)-31 b(es)391 b(a)g(\257lename)h(and)0 30832 y(returns)368 b(true)h(if)h(the)f (\257le)h(exists,)g(false)f(if)h(it)g(do)31 b(esn't:)0 33080 y Fk(def)582 b(exists\(filename\):)1162 34435 y(try:)2325 35790 y(f)f(=)g(open\(filename\))2325 37145 y(f.close\(\))2325 38500 y(return)h(1)1162 39855 y(except:)2325 41210 y(return)g(0)0 43458 y Fn(Y)-92 b(ou)301 b(can)g(use)e(m)-31 b(ultiple)303 b Fk(except)f Fn(blo)31 b(c)-31 b(ks)301 b(to)g(handle)g(di\256eren)-31 b(t)301 b(kinds)g(of)g(exceptions.)471 b(The)0 44813 y Fm(Python)396 b(R)-57 b(efer)g(enc)g(e)399 b(Manual)369 b Fn(has)g(the)g(details.)0 46980 y(If)326 b(y)-31 b(our)327 b(program)g(detects)g(an)g(error)e(condition,)338 b(y)-31 b(ou)327 b(can)g(mak)-31 b(e)328 b(it)f Fv(raise)f Fn(an)h(exception.)0 48335 y(Here)411 b(is)h(an)g(example)h(that)g(gets)g(input)f(from)h (the)f(user)e(and)i(c)-31 b(hec)g(ks)412 b(for)g(the)g(v)-61 b(alue)413 b(17.)0 49690 y(Assuming)370 b(that)g(17)g(is)f(not)h(v)-61 b(alid)370 b(input)g(for)g(some)f(reason,)h(w)-31 b(e)369 b(raise)h(an)f(exception.)0 51938 y Fk(def)582 b(inputNumber)g(\(\))g (:)1162 53293 y(x)g(=)f(input)h(\('Pick)g(a)f(number:)h('\))1162 54648 y(if)g(x)f(==)g(17)h(:)2325 56003 y(raise)f('BadNumberError',)j ('17)e(is)f(a)h(bad)f(number')1162 57358 y(return)h(x)p eop %%Page: 124 150 124 149 bop 0 -2070 a Fv(124)25000 b(Files)424 b(and)h(exceptions)p 0 -1627 38191 45 v 0 865 a Fn(The)530 b Fk(raise)h Fn(statemen)-31 b(t)532 b(tak)-31 b(es)531 b(t)-31 b(w)g(o)532 b(argumen)-31 b(ts:)816 b(the)531 b(exception)g(t)-31 b(yp)31 b(e)531 b(and)f(sp)31 b(eci\257c)0 2220 y(information)464 b(ab)31 b(out)462 b(the)f(error.)767 b Fk(BadNumberError)463 b Fn(is)e(a)g(new)g(kind)h(of)f(exception)h(w)-31 b(e)0 3575 y(in)g(v)g(en)g(ted)371 b(for)e(this)h(application.)0 5764 y(If)468 b(the)h(function)h(that)g(called)g Fk(inputNumber)g Fn(handles)f(the)g(error,)493 b(then)469 b(the)g(program)0 7119 y(can)369 b(con)-31 b(tin)g(ue;)372 b(otherwise,)e(Python)h(prin) -31 b(ts)369 b(the)h(error)e(message)h(and)h(exits:)0 9389 y Fk(>>>)582 b(inputNumber)g(\(\))0 10744 y(Pick)g(a)f(number:)h (17)0 12099 y(BadNumberError:)h(17)f(is)f(a)h(bad)f(number)0 14369 y Fn(The)412 b(error)g(message)g(includes)h(the)f(exception)i(t) -31 b(yp)31 b(e)413 b(and)f(the)h(additional)i(information)0 15724 y(y)-31 b(ou)370 b(pro)-31 b(vided.)2767 18415 y Fm(As)543 b(an)f(exer)-57 b(cise,)581 b(write)542 b(a)h(function)h (that)e(uses)g Fk(inputNumber)i Fm(to)e(input)2767 19770 y(a)444 b(numb)-57 b(er)445 b(fr)-57 b(om)445 b(the)f(keyb)-57 b(o)g(ar)g(d)445 b(and)f(that)f(hand)57 b(les)443 b(the)h Fk(BadNumberError)2767 21125 y Fm(exc)-57 b(eption.)0 25708 y Fl(11.6)1792 b(Glossary)0 28240 y Fv(\257le:)553 b Fn(A)367 b(named)g(en)-31 b(tit)g(y)-92 b(,)369 b(usually)f(stored)f (on)f(a)h(hard)g(driv)-31 b(e,)367 b(\260opp)-31 b(y)368 b(disk,)f(or)g(CD-R)-31 b(OM,)2767 29595 y(that)371 b(con)-31 b(tains)371 b(a)e(stream)h(of)f(c)-31 b(haracters.)0 31880 y Fv(directory:)554 b Fn(A)369 b(named)h(collection)i(of)e (\257les,)f(also)h(called)h(a)e(folder.)0 34165 y Fv(path:)553 b Fn(A)368 b(sequence)f(of)g(directory)h(names)g(that)h(sp)31 b(eci\257es)366 b(the)i(exact)g(lo)31 b(cation)370 b(of)e(a)f(\257le.)0 36449 y Fv(text)425 b(\257le:)553 b Fn(A)485 b(\257le)h(that)h(con)-31 b(tains)487 b(prin)-31 b(table)486 b(c)-31 b(haracters)486 b(organized)g(in)-31 b(to)487 b(lines)f(sepa-)2767 37804 y(rated)370 b(b)-31 b(y)369 b(newline)i(c)-31 b(haracters.)0 40089 y Fv(break)425 b(statemen)-35 b(t:)554 b Fn(A)266 b(statemen)-31 b(t)267 b(that)h(causes)d(the)h(\260o)-31 b(w)267 b(of)f(execution)i(to)e(exit)h(a)f(lo)31 b(op.)0 42374 y Fv(con)-35 b(tin)g(ue)425 b(statemen)-35 b(t:)553 b Fn(A)374 b(statemen)-31 b(t)376 b(that)f(causes)f(the)g(curren)-31 b(t)373 b(iteration)j(of)f(a)f(lo)31 b(op)2767 43729 y(to)424 b(end.)655 b(The)424 b(\260o)-31 b(w)424 b(of)g(execution)h (go)31 b(es)423 b(to)h(the)g(top)g(of)f(the)h(lo)31 b(op,)438 b(ev)-61 b(aluates)425 b(the)2767 45084 y(condition,)372 b(and)e(pro)31 b(ceeds)368 b(accordingly)-92 b(.)0 47369 y Fv(format)425 b(op)35 b(erator:)555 b Fn(The)333 b Fk(\045)f Fn(op)31 b(erator)332 b(tak)-31 b(es)333 b(a)g(format)g (string)g(and)f(a)g(tuple)h(of)g(expres-)2767 48724 y(sions)266 b(and)g(yields)g(a)g(string)g(that)h(includes)f(the)g(expressions,)286 b(formatted)268 b(according)2767 50079 y(to)370 b(the)g(format)g (string.)0 52363 y Fv(format)425 b(string:)554 b Fn(A)594 b(string)h(that)g(con)-31 b(tains)596 b(prin)-31 b(table)596 b(c)-31 b(haracters)595 b(and)g(format)h(se-)2767 53718 y(quences)369 b(that)i(indicate)f(ho)-31 b(w)371 b(to)f(format)g(v)-61 b(alues.)0 56003 y Fv(format)425 b(sequence:)554 b Fn(A)459 b(sequence)g(of)h(c)-31 b(haracters)459 b(b)31 b(eginning)460 b(with)g Fk(\045)f Fn(that)i(indicates)2767 57358 y(ho)-31 b(w)371 b(to)f(format)g(a)g(v)-61 b(alue.)p eop %%Page: 125 151 125 150 bop 0 -2070 a Fv(11.6)425 b(Glossary)28784 b(125)p 0 -1627 38191 45 v 0 865 a(pic)-35 b(kle:)552 b Fn(T)-92 b(o)400 b(write)h(a)e(data)i(v)-61 b(alue)400 b(in)g(a)g(\257le)g (along)h(with)g(its)f(t)-31 b(yp)31 b(e)400 b(information)i(so)e(that) 2767 2220 y(it)370 b(can)g(b)31 b(e)368 b(reconstituted)j(later.)0 4461 y Fv(exception:)554 b Fn(An)369 b(error)g(that)h(o)31 b(ccurs)368 b(at)i(run)-31 b(time.)0 6701 y Fv(handle:)554 b Fn(T)-92 b(o)466 b(prev)-31 b(en)g(t)467 b(an)f(exception)h(from)g (terminating)i(a)d(program)h(using)f(the)h Fk(try)2767 8056 y Fn(and)370 b Fk(except)g Fn(statemen)-31 b(ts.)0 10296 y Fv(raise:)553 b Fn(T)-92 b(o)370 b(signal)h(an)e(exception)i (using)e(the)h Fk(raise)f Fn(statemen)-31 b(t.)p eop %%Page: 126 152 126 151 bop 0 -2070 a Fv(126)25000 b(Files)424 b(and)h(exceptions)p 0 -1627 38191 45 v eop %%Page: 127 153 127 152 bop 0 10069 a Fi(Chapter)861 b(12)0 16517 y Fo(Classes)1032 b(and)i(ob)172 b(jects)0 23824 y Fl(12.1)1792 b(User-de\257ned)601 b(comp)50 b(ound)598 b(t)-50 b(yp)50 b(es)0 26373 y Fn(Ha)-31 b(ving)492 b(used)d(some)i(of)g(Python's)g(built-in)h(t)-31 b(yp)31 b(es,)521 b(w)-31 b(e)490 b(are)g(ready)g(to)h(create)g(a)f (user-)0 27728 y(de\257ned)369 b(t)-31 b(yp)31 b(e:)493 b(the)369 b Fk(Point)p Fn(.)0 29930 y(Consider)450 b(the)f(concept)h (of)g(a)f(mathematical)454 b(p)31 b(oin)-31 b(t.)734 b(In)448 b(t)-31 b(w)g(o)451 b(dimensions,)471 b(a)450 b(p)31 b(oin)-31 b(t)450 b(is)0 31285 y(t)-31 b(w)g(o)446 b(n)-31 b(um)g(b)31 b(ers)444 b(\(co)31 b(ordinates\))447 b(that)e(are)f(treated)i(collectiv)-31 b(ely)447 b(as)e(a)f(single)i (ob)61 b(ject.)719 b(In)0 32640 y(mathematical)425 b(notation,)436 b(p)31 b(oin)-31 b(ts)421 b(are)g(often)g(written)h(in)f(paren)-31 b(theses)420 b(with)h(a)g(comma)0 33994 y(separating)355 b(the)g(co)31 b(ordinates.)488 b(F)-92 b(or)353 b(example,)359 b(\(0)p Fg(;)184 b Fn(0\))357 b(represen)-31 b(ts)353 b(the)h(origin,)359 b(and)354 b(\()p Fg(x;)184 b(y)40 b Fn(\))0 35349 y(represen)-31 b(ts)368 b(the)h(p)31 b(oin)-31 b(t)371 b Fg(x)d Fn(units)i(to)g(the)f(righ)-31 b(t)371 b(and)e Fg(y)409 b Fn(units)369 b(up)g(from)h(the)f(origin.)0 37551 y(A)359 b(natural)h(w)-31 b(a)g(y)360 b(to)g(represen)-31 b(t)358 b(a)h(p)31 b(oin)-31 b(t)360 b(in)f(Python)h(is)e(with)i(t)-31 b(w)g(o)361 b(\260oating-p)31 b(oin)-31 b(t)362 b(v)-61 b(alues.)0 38906 y(The)399 b(question,)408 b(then,)f(is)399 b(ho)-31 b(w)400 b(to)g(group)g(these)e(t)-31 b(w)g(o)401 b(v)-61 b(alues)399 b(in)-31 b(to)401 b(a)e(comp)31 b(ound)400 b(ob)61 b(ject.)0 40261 y(The)362 b(quic)-31 b(k)363 b(and)f(dirt)-31 b(y)363 b(solution)h(is)d(to)i(use)e(a)i(list)f(or)g (tuple,)j(and)d(for)g(some)g(applications)0 41616 y(that)370 b(migh)-31 b(t)372 b(b)31 b(e)368 b(the)i(b)31 b(est)369 b(c)-31 b(hoice.)0 43817 y(An)510 b(alternativ)-31 b(e)513 b(is)d(to)h(de\257ne)f(a)h(new)f(user-de\257ned)f(comp)31 b(ound)512 b(t)-31 b(yp)31 b(e,)546 b(also)511 b(called)h(a)0 45172 y Fv(class)p Fn(.)488 b(This)357 b(approac)-31 b(h)358 b(in)-31 b(v)g(olv)g(es)359 b(a)f(bit)g(more)f(e\256ort,)j(but) d(it)h(has)f(adv)-61 b(an)-31 b(tages)359 b(that)f(will)0 46527 y(b)31 b(e)369 b(apparen)-31 b(t)370 b(so)31 b(on.)0 48728 y(A)369 b(class)g(de\257nition)i(lo)31 b(oks)370 b(lik)-31 b(e)371 b(this:)0 51011 y Fk(class)582 b(Point:)1162 52366 y(pass)0 54648 y Fn(Class)379 b(de\257nitions)g(can)g(app)31 b(ear)378 b(an)-31 b(ywhere)379 b(in)f(a)h(program,)j(but)c(they)h(are) f(usually)h(near)0 56003 y(the)k(b)31 b(eginning)384 b(\(after)f(the)g Fk(import)h Fn(statemen)-31 b(ts\).)535 b(The)382 b(syn)-31 b(tax)384 b(rules)e(for)h(a)g(class)f(de\257-)0 57358 y(nition)371 b(are)e(the)g(same)h(as)f(for)g(other)h(comp)31 b(ound)370 b(statemen)-31 b(ts)371 b(\(see)e(Section)h(4.4\).)p eop %%Page: 128 154 128 153 bop 0 -2070 a Fv(128)25469 b(Classes)425 b(and)f(ob)71 b(jects)p 0 -1627 38191 45 v 0 865 a Fn(This)452 b(de\257nition)h (creates)e(a)h(new)f(class)h(called)g Fk(Point)p Fn(.)740 b(The)452 b Fv(pass)f Fn(statemen)-31 b(t)453 b(has)f(no)0 2220 y(e\256ect;)348 b(it)336 b(is)g(only)h(necessary)f(b)31 b(ecause)335 b(a)i(comp)31 b(ound)336 b(statemen)-31 b(t)338 b(m)-31 b(ust)337 b(ha)-31 b(v)g(e)337 b(something)0 3575 y(in)369 b(its)h(b)31 b(o)g(dy)-92 b(.)0 5811 y(By)476 b(creating)h(the)f Fk(Point)g Fn(class,)503 b(w)-31 b(e)476 b(created)g(a)g(new)g(t)-31 b(yp)31 b(e,)503 b(also)477 b(called)g Fk(Point)p Fn(.)813 b(The)0 7166 y(mem)-31 b(b)31 b(ers)392 b(of)g(this)g(t)-31 b(yp)31 b(e)392 b(are)g(called)h Fv(instances)e Fn(of)i(the)f(t)-31 b(yp)31 b(e)392 b(or)f Fv(ob)71 b(jects)p Fn(.)561 b(Creating)394 b(a)0 8521 y(new)f(instance)h(is)f(called)h Fv(instan)-35 b(tiation)p Fn(.)563 b(T)-92 b(o)393 b(instan)-31 b(tiate)396 b(a)d Fk(Point)g Fn(ob)61 b(ject,)401 b(w)-31 b(e)394 b(call)g(a)0 9876 y(function)371 b(named)e(\(y)-31 b(ou)371 b(guessed)e(it\))h Fk(Point)p Fn(:)0 12194 y Fk(blank)582 b(=)f(Point\(\))0 14511 y Fn(The)413 b(v)-61 b(ariable)413 b Fk(blank)g Fn(is)f(assigned)h(a)g(reference)f(to)h(a)g(new)f Fk(Point)h Fn(ob)61 b(ject.)624 b(A)413 b(function)0 15866 y(lik)-31 b(e)370 b Fk(Point)g Fn(that)h(creates)e(new)g(ob)61 b(jects)370 b(is)f(called)i(a)e Fv(constructor)p Fn(.)0 20591 y Fl(12.2)1792 b(A)-50 b(ttributes)0 23189 y Fn(W)-92 b(e)368 b(can)i(add)f(new)h(data)g(to)g(an)g(instance)g(using)f(dot)h (notation:)0 25507 y Fk(>>>)582 b(blank.x)g(=)f(3.0)0 26862 y(>>>)h(blank.y)g(=)f(4.0)0 29179 y Fn(This)328 b(syn)-31 b(tax)328 b(is)f(similar)i(to)f(the)g(syn)-31 b(tax)328 b(for)f(selecting)i(a)f(v)-61 b(ariable)328 b(from)g(a)f(mo)31 b(dule,)337 b(suc)-31 b(h)0 30534 y(as)336 b Fk(math.pi)h Fn(or)f Fk(string.uppercase)p Fn(.)484 b(In)336 b(this)h(case,)343 b(though,)i(w)-31 b(e)336 b(are)h(selecting)g(a)g(data)0 31889 y(item)370 b(from)g(an)g(instance.)493 b(These)369 b(named)h(items)g(are)f(called) h Fv(attributes)p Fn(.)0 34126 y(The)f(follo)-31 b(wing)373 b(state)d(diagram)h(sho)-31 b(ws)370 b(the)f(result)g(of)h(these)f (assignmen)-31 b(ts:)12484 35505 y 7828029 2828615 0 0 7828029 2828615 startTexFig 12484 35505 a %%BeginDocument: illustrations/point.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: point.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 09:41:45 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 119 43 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 43 moveto 0 0 lineto 119 0 lineto 119 43 lineto closepath clip newpath -58.0 100.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 1800 975 m 2925 975 l 2925 1650 l 1800 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 2490 1477 m 2490 1417 l 2338 1417 l 2458 1447 l 2338 1477 l cp eoclip n 2100 1447 m 2475 1447 l gs col0 s gr gr % arrowhead n 2338 1477 m 2458 1447 l 2338 1417 l col0 s % Polyline gs clippath 2490 1177 m 2490 1117 l 2338 1117 l 2458 1147 l 2338 1177 l cp eoclip n 2100 1147 m 2475 1147 l gs col0 s gr gr % arrowhead n 2338 1177 m 2458 1147 l 2338 1117 l col0 s % Polyline gs clippath 1815 1147 m 1815 1087 l 1663 1087 l 1783 1117 l 1663 1147 l cp eoclip n 1425 1117 m 1800 1117 l gs col0 s gr gr % arrowhead n 1663 1147 m 1783 1117 l 1663 1087 l col0 s /Helvetica ff 165.00 scf sf 2025 1200 m gs 1 -1 sc (x) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1500 m gs 1 -1 sc (y) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1200 m gs 1 -1 sc (3.0) col0 sh gr /Helvetica ff 165.00 scf sf 2550 1500 m gs 1 -1 sc (4.0) col0 sh gr /Helvetica ff 165.00 scf sf 1350 1170 m gs 1 -1 sc (blank) dup sw pop neg 0 rm col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 42357 a Fn(The)285 b(v)-61 b(ariable)286 b Fk(blank)g Fn(refers)d(to)j(a)f(P)-31 b(oin)g(t)287 b(ob)61 b(ject,)304 b(whic)-31 b(h)286 b(con)-31 b(tains)286 b(t)-31 b(w)g(o)287 b(attributes.)466 b(Eac)-31 b(h)0 43712 y(attribute)371 b(refers)d(to)i(a)f(\260oating-p)31 b(oin)-31 b(t)373 b(n)-31 b(um)g(b)31 b(er.)0 45949 y(W)-92 b(e)368 b(can)i(read)f(the)g (v)-61 b(alue)370 b(of)g(an)f(attribute)i(using)f(the)f(same)h(syn)-31 b(tax:)0 48266 y Fk(>>>)582 b(print)f(blank.y)0 49621 y(4.0)0 50976 y(>>>)h(x)f(=)g(blank.x)0 52331 y(>>>)h(print)f(x)0 53686 y(3.0)0 56003 y Fn(The)395 b(expression)f Fk(blank.x)h Fn(means,)401 b(\\Go)395 b(to)g(the)g(ob)61 b(ject)396 b Fk(blank)f Fn(refers)e(to)i(and)g(get)g(the)0 57358 y(v)-61 b(alue)451 b(of)h Fk(x)p Fn(.")738 b(In)451 b(this)g(case,)472 b(w)-31 b(e)451 b(assign)h(that)g(v)-61 b(alue)452 b(to)f(a)h(v)-61 b(ariable)452 b(named)f Fk(x)p Fn(.)738 b(There)p eop %%Page: 129 155 129 154 bop 0 -2070 a Fv(12.3)425 b(Instances)g(as)g(parameters)20242 b(129)p 0 -1627 38191 45 v 0 865 a Fn(is)430 b(no)g(con\260ict)h(b)31 b(et)-31 b(w)g(een)430 b(the)g(v)-61 b(ariable)431 b Fk(x)f Fn(and)f(the)h(attribute)i Fk(x)p Fn(.)674 b(The)430 b(purp)31 b(ose)429 b(of)h(dot)0 2220 y(notation)372 b(is)d(to)h(iden)-31 b(tify)371 b(whic)-31 b(h)370 b(v)-61 b(ariable)370 b(y)-31 b(ou)370 b(are)f(referring)g(to)h(unam)-31 b(biguously)-92 b(.)0 4295 y(Y)g(ou)344 b(can)g(use)f(dot)h(notation)j (as)d(part)g(of)g(an)-31 b(y)344 b(expression,)349 b(so)344 b(the)g(follo)-31 b(wing)347 b(statemen)-31 b(ts)0 5650 y(are)369 b(legal:)0 7806 y Fk(print)582 b('\(')f(+)h(str\(blank.x\))h (+)e(',)g(')h(+)f(str\(blank.y\))i(+)e('\)')0 9161 y(distanceSquared)i (=)f(blank.x)g(*)f(blank.x)h(+)g(blank.y)g(*)f(blank.y)0 11317 y Fn(The)369 b(\257rst)g(line)h(outputs)g Fk(\(3.0,)582 b(4.0\))p Fn(;)370 b(the)f(second)g(line)h(calculates)h(the)f(v)-61 b(alue)369 b(25.0.)0 13392 y(Y)-92 b(ou)369 b(migh)-31 b(t)372 b(b)31 b(e)368 b(tempted)j(to)f(prin)-31 b(t)369 b(the)h(v)-61 b(alue)369 b(of)h Fk(blank)g Fn(itself:)0 15548 y Fk(>>>)582 b(print)f(blank)0 16903 y(<__main__.Point)i (instance)g(at)e(80f8e70>)0 19059 y Fn(The)478 b(result)g(indicates)h (that)g Fk(blank)g Fn(is)f(an)g(instance)g(of)h(the)f Fk(Point)h Fn(class)e(and)i(it)f(w)-31 b(as)0 20414 y(de\257ned)487 b(in)p 5411 20414 349 45 v 5829 20414 V 1325 w Fk(main)p 8572 20414 V 8990 20414 V 837 w Fn(.)848 b Fk(80f8e70)488 b Fn(is)f(the)h(unique)g(iden)-31 b(ti\257er)488 b(for)g(this)g(ob)61 b(ject,)519 b(written)0 21769 y(in)468 b(hexadecimal)j(\(base)d(16\).) 790 b(This)469 b(is)f(probably)h(not)g(the)f(most)h(informativ)-31 b(e)471 b(w)-31 b(a)g(y)469 b(to)0 23124 y(displa)-31 b(y)371 b(a)e Fk(Point)h Fn(ob)61 b(ject.)494 b(Y)-92 b(ou)369 b(will)i(see)e(ho)-31 b(w)370 b(to)g(c)-31 b(hange)370 b(it)g(shortly)-92 b(.)2767 25512 y Fm(As)395 b(an)h(exer)-57 b(cise,)397 b(cr)-57 b(e)g(ate)396 b(and)g(print)g(a)f Fk(Point)h Fm(obje)-57 b(ct,)398 b(and)d(then)h(use)f Fk(id)h Fm(to)2767 26867 y(print)417 b(the)f(obje)-57 b(ct's)418 b(unique)f(identi\257er.)572 b(T)-85 b(r)-57 b(anslate)417 b(the)f(hexade)-57 b(cimal)416 b(form)2767 28222 y(into)397 b(de)-57 b(cimal)397 b(and)f(c)-57 b(on\257rm)397 b(that)e(they)h(match.)0 32606 y Fl(12.3)1792 b(Instances)600 b(as)d(parameters)0 35015 y Fn(Y)-92 b(ou)369 b(can)h(pass)f(an)g (instance)h(as)f(a)h(parameter)g(in)f(the)g(usual)h(w)-31 b(a)g(y)-92 b(.)494 b(F)-92 b(or)368 b(example:)0 37171 y Fk(def)582 b(printPoint\(p\):)1162 38526 y(print)g('\(')g(+)f (str\(p.x\))h(+)g(',)f(')g(+)h(str\(p.y\))g(+)f('\)')0 40682 y(printPoint)270 b Fn(tak)-31 b(es)270 b(a)g(p)31 b(oin)-31 b(t)270 b(as)f(an)h(argumen)-31 b(t)270 b(and)g(displa)-31 b(ys)270 b(it)g(in)f(the)g(standard)h(format.)0 42037 y(If)369 b(y)-31 b(ou)370 b(call)g Fk(printPoint\(blank\))p Fn(,)i(the)e(output)g(is)f Fk(\(3.0,)582 b(4.0\))p Fn(.)2767 44425 y Fm(As)450 b(an)h(exer)-57 b(cise,)465 b(r)-57 b(ewrite)451 b(the)f Fk(distance)i Fm(function)g(fr)-57 b(om)452 b(Se)-57 b(ction)452 b(5.2)e(so)2767 45780 y(that)396 b(it)g(takes)f(two)g Fk(Point)p Fm(s)i(as)e(p)-57 b(ar)g(ameters)396 b(inste)-57 b(ad)396 b(of)h(four)f(numb)-57 b(ers.)0 50165 y Fl(12.4)1792 b(Sameness)0 52573 y Fn(The)433 b(meaning)i(of)e(the)g(w)-31 b(ord)433 b(\\same")h(seems)f(p)31 b(erfectly)433 b(clear)g(un)-31 b(til)434 b(y)-31 b(ou)434 b(giv)-31 b(e)434 b(it)g(some)0 53928 y(though)-31 b(t,)372 b(and)d(then)g(y)-31 b(ou)370 b(realize)g(there)f(is)g(more)h(to)g(it)g (than)g(y)-31 b(ou)370 b(exp)31 b(ected.)0 56003 y(F)-92 b(or)323 b(example,)335 b(if)324 b(y)-31 b(ou)325 b(sa)-31 b(y)-92 b(,)333 b(\\Chris)325 b(and)f(I)f(ha)-31 b(v)g(e)325 b(the)f(same)g(car,")334 b(y)-31 b(ou)325 b(mean)f(that)h(his)f(car)0 57358 y(and)402 b(y)-31 b(ours)401 b(are)g(the)h(same)f(mak)-31 b(e)403 b(and)e(mo)31 b(del,)411 b(but)402 b(that)g(they)g(are)f(t)-31 b(w)g(o)403 b(di\256eren)-31 b(t)402 b(cars.)p eop %%Page: 130 156 130 155 bop 0 -2070 a Fv(130)25469 b(Classes)425 b(and)f(ob)71 b(jects)p 0 -1627 38191 45 v 0 865 a Fn(If)352 b(y)-31 b(ou)353 b(sa)-31 b(y)-92 b(,)356 b(\\Chris)c(and)h(I)e(ha)-31 b(v)g(e)354 b(the)e(same)g(mother,")358 b(y)-31 b(ou)353 b(mean)f(that)i(his)e(mother)h(and)0 2220 y(y)-31 b(ours)433 b(are)g(the)g(same)g(p)31 b(erson.)13228 1818 y Ff(1)14408 2220 y Fn(So)433 b(the)h(idea)f(of)h(\\sameness")f(is)g(di\256eren)-31 b(t)434 b(dep)31 b(ending)0 3575 y(on)369 b(the)h(con)-31 b(text.)0 5981 y(When)365 b(y)-31 b(ou)366 b(talk)h(ab)31 b(out)367 b(ob)61 b(jects,)368 b(there)d(is)h(a)g(similar)h(am)-31 b(biguit)g(y)-92 b(.)494 b(F)-92 b(or)365 b(example,)j(if)e(t)-31 b(w)g(o)0 7336 y Fk(Point)p Fn(s)355 b(are)f(the)g(same,)k(do)31 b(es)354 b(that)i(mean)f(they)g(con)-31 b(tain)356 b(the)f(same)f(data) i(\(co)31 b(ordinates\))0 8691 y(or)369 b(that)h(they)g(are)f(actually) j(the)d(same)h(ob)61 b(ject?)0 11097 y(T)-92 b(o)374 b(\257nd)f(out)h(if)g(t)-31 b(w)g(o)376 b(references)c(refer)g(to)j (the)e(same)h(ob)61 b(ject,)377 b(use)372 b(the)i Fk(==)g Fn(op)31 b(erator.)506 b(F)-92 b(or)0 12452 y(example:)0 14939 y Fk(>>>)582 b(p1)f(=)g(Point\(\))0 16294 y(>>>)h(p1.x)f(=)h(3)0 17649 y(>>>)g(p1.y)f(=)h(4)0 19003 y(>>>)g(p2)f(=)g(Point\(\))0 20358 y(>>>)h(p2.x)f(=)h(3)0 21713 y(>>>)g(p2.y)f(=)h(4)0 23068 y(>>>)g(p1)f(==)g(p2)0 24423 y(0)0 26910 y Fn(Ev)-31 b(en)449 b(though)g Fk(p1)g Fn(and)f Fk(p2)h Fn(con)-31 b(tain)450 b(the)f(same)f(co)31 b(ordinates,)470 b(they)449 b(are)f(not)h(the)g(same)0 28265 y(ob)61 b(ject.)788 b(If)467 b(w)-31 b(e)468 b(assign)g Fk(p1)f Fn(to)h Fk(p2)p Fn(,)492 b(then)468 b(the)f(t)-31 b(w)g(o)469 b(v)-61 b(ariables)468 b(are)f(aliases)h(of)g(the)g(same)0 29620 y(ob)61 b(ject:)0 32107 y Fk(>>>)582 b(p2)f(=)g(p1)0 33462 y(>>>)h(p1)f(==)g(p2)0 34817 y(1)0 37304 y Fn(This)381 b(t)-31 b(yp)31 b(e)382 b(of)f(equalit)-31 b(y)384 b(is)c(called)j Fv(shallo)-35 b(w)437 b(equalit)-35 b(y)380 b Fn(b)31 b(ecause)381 b(it)g(compares)h(only)g(the)0 38659 y(references,)368 b(not)i(the)g(con)-31 b(ten)g(ts)370 b(of)g(the)f(ob)61 b(jects.)0 41065 y(T)-92 b(o)350 b(compare)g(the)g(con)-31 b(ten)g(ts)351 b(of)f(the)g(ob)61 b(jects|)p Fv(deep)405 b(equalit)-35 b(y)p Fn(|w)k(e)349 b(can)h(write)g(a)g(func-)0 42420 y(tion)370 b(called)h Fk(samePoint)p Fn(:)0 44907 y Fk(def)582 b(samePoint\(p1,)h(p2\))e(:)1162 46262 y(return)h(\(p1.x)g (==)g(p2.x\))g(and)f(\(p1.y)h(==)g(p2.y\))0 48749 y Fn(No)-31 b(w)405 b(if)g(w)-31 b(e)405 b(create)f(t)-31 b(w)g(o)406 b(di\256eren)-31 b(t)404 b(ob)61 b(jects)406 b(that)f(con)-31 b(tain)406 b(the)e(same)h(data,)415 b(w)-31 b(e)404 b(can)h(use)0 50103 y Fk(samePoint)370 b Fn(to)g(\257nd)f(out)h(if)g(they)g(represen) -31 b(t)368 b(the)h(same)h(p)31 b(oin)-31 b(t.)p 0 51475 15276 45 v 1232 52190 a Fp(1)1694 52503 y Fb(Not)340 b(all)i(languages)h(ha)-26 b(v)g(e)340 b(the)g(same)i(problem.)499 b(F)-78 b(or)340 b(example,)349 b(German)340 b(has)h(di\256eren)-26 b(t)340 b(w)-26 b(ords)340 b(for)0 53576 y(di\256eren)-26 b(t)326 b(kinds)g(of)g(sameness.)458 b(\\Same)328 b(car")f(in)f(this)h (con)-26 b(text)326 b(w)-26 b(ould)326 b(b)26 b(e)327 b(\\gleic)-26 b(he)328 b(Auto,")i(and)d(\\same)0 54648 y(mother")314 b(w)-26 b(ould)314 b(b)26 b(e)313 b(\\selb)26 b(e)315 b(Mutter.")p eop %%Page: 131 157 131 156 bop 0 -2070 a Fv(12.5)425 b(Rectangles)27594 b(131)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(p1)f(=)g(Point\(\))0 2220 y(>>>)h(p1.x)f(=)h(3)0 3575 y(>>>)g(p1.y)f(=)h(4)0 4930 y(>>>)g(p2)f(=)g(Point\(\))0 6285 y(>>>)h(p2.x)f(=)h(3)0 7640 y(>>>)g(p2.y)f(=)h(4)0 8995 y(>>>)g(samePoint\(p1,)h(p2\))0 10350 y(1)0 12563 y Fn(Of)360 b(course,)h(if)f(the)g(t)-31 b(w)g(o)362 b(v)-61 b(ariables)360 b(refer)f(to)h(the)g(same)g(ob)61 b(ject,)364 b(they)c(ha)-31 b(v)g(e)361 b(b)31 b(oth)360 b(shallo)-31 b(w)0 13918 y(and)369 b(deep)g(equalit)-31 b(y)-92 b(.)0 18382 y Fl(12.5)1792 b(Rectangles)0 20847 y Fn(Let's)405 b(sa)-31 b(y)405 b(that)h(w)-31 b(e)405 b(w)-31 b(an)g(t)407 b(a)e(class)g(to)g(represen)-31 b(t)404 b(a)h(rectangle.)601 b(The)405 b(question)h(is,)414 b(what)0 22202 y(information)264 b(do)d(w)-31 b(e)262 b(ha)-31 b(v)g(e)262 b(to)g(pro)-31 b(vide)261 b(in)h(order)e(to)i(sp) 31 b(ecify)261 b(a)g(rectangle?)457 b(T)-92 b(o)262 b(k)-31 b(eep)261 b(things)0 23557 y(simple,)482 b(assume)457 b(that)j(the)e(rectangle)h(is)f(orien)-31 b(ted)459 b(either)f(v)-31 b(ertically)461 b(or)c(horizon)-31 b(tally)-92 b(,)0 24912 y(nev)-31 b(er)369 b(at)h(an)f(angle.)0 27044 y(There)393 b(are)f(a)i(few)f(p)31 b(ossibilities:)542 b(w)-31 b(e)393 b(could)h(sp)31 b(ecify)393 b(the)g(cen)-31 b(ter)393 b(of)g(the)h(rectangle)g(\(t)-31 b(w)g(o)0 28399 y(co)31 b(ordinates\))507 b(and)g(its)f(size)f(\(width)j(and)e(heigh)-31 b(t\);)577 b(or)505 b(w)-31 b(e)507 b(could)f(sp)31 b(ecify)506 b(one)g(of)h(the)0 29754 y(corners)373 b(and)i(the)g(size;)i(or)e(w)-31 b(e)375 b(could)g(sp)31 b(ecify)375 b(t)-31 b(w)g(o)376 b(opp)31 b(osing)375 b(corners.)508 b(A)374 b(con)-31 b(v)g(en)g(tional)0 31109 y(c)g(hoice)370 b(is)f(to)h(sp)31 b(ecify)369 b(the)h(upp)31 b(er-left)369 b(corner)g(of)h(the)f (rectangle)h(and)g(the)f(size.)0 33241 y(Again,)i(w)-31 b(e'll)371 b(de\257ne)e(a)h(new)f(class:)0 35454 y Fk(class)582 b(Rectangle:)1162 36809 y(pass)0 39022 y Fn(And)369 b(instan)-31 b(tiate)372 b(it:)0 41235 y Fk(box)582 b(=)f(Rectangle\(\))0 42590 y(box.width)h(=)g(100.0)0 43945 y(box.height)h(=)e(200.0)0 46158 y Fn(This)441 b(co)31 b(de)440 b(creates)g(a)g(new)h Fk(Rectangle)g Fn(ob)61 b(ject)442 b(with)f(t)-31 b(w)g(o)442 b(\260oating-p)31 b(oin)-31 b(t)444 b(attributes.)0 47512 y(T)-92 b(o)370 b(sp)31 b(ecify)369 b(the)g(upp)31 b(er-left)370 b(corner,)f(w)-31 b(e)370 b(can)f(em)-31 b(b)31 b(ed)369 b(an)h(ob)61 b(ject)370 b(within)h(an)f(ob)61 b(ject!)0 49725 y Fk(box.corner)583 b(=)e(Point\(\))0 51080 y(box.corner.x)i(=)e (0.0;)0 52435 y(box.corner.y)i(=)e(0.0;)0 54648 y Fn(The)391 b(dot)h(op)31 b(erator)391 b(comp)31 b(oses.)558 b(The)391 b(expression)g Fk(box.corner.x)i Fn(means,)k(\\Go)391 b(to)h(the)0 56003 y(ob)61 b(ject)483 b Fk(box)e Fn(refers)f(to)i(and)g (select)f(the)h(attribute)h(named)f Fk(corner)p Fn(;)538 b(then)482 b(go)g(to)g(that)0 57358 y(ob)61 b(ject)371 b(and)e(select)h(the)f(attribute)i(named)f Fk(x)p Fn(.")p eop %%Page: 132 158 132 157 bop 0 -2070 a Fv(132)25469 b(Classes)425 b(and)f(ob)71 b(jects)p 0 -1627 38191 45 v 0 865 a Fn(The)369 b(\257gure)g(sho)-31 b(ws)370 b(the)f(state)h(of)g(this)g(ob)61 b(ject:)7317 2244 y 13945733 4012687 0 0 13945733 4012687 startTexFig 7317 2244 a %%BeginDocument: illustrations/rectangle.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: rectangle.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 09:48:32 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 212 61 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 61 moveto 0 0 lineto 212 0 lineto 212 61 lineto closepath clip newpath -46.0 118.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 3300 1350 m 4275 1350 l 4275 1950 l 3300 1950 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1500 975 m 3000 975 l 3000 1950 l 1500 1950 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 3915 1852 m 3915 1792 l 3763 1792 l 3883 1822 l 3763 1852 l cp eoclip n 3525 1822 m 3900 1822 l gs col0 s gr gr % arrowhead n 3763 1852 m 3883 1822 l 3763 1792 l col0 s % Polyline gs clippath 3915 1552 m 3915 1492 l 3763 1492 l 3883 1522 l 3763 1552 l cp eoclip n 3525 1522 m 3900 1522 l gs col0 s gr gr % arrowhead n 3763 1552 m 3883 1522 l 3763 1492 l col0 s /Helvetica ff 165.00 scf sf 3450 1875 m gs 1 -1 sc (y) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3975 1575 m gs 1 -1 sc (0.0) col0 sh gr /Helvetica ff 165.00 scf sf 3450 1575 m gs 1 -1 sc (x) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3975 1875 m gs 1 -1 sc (0.0) col0 sh gr % Polyline gs clippath 2490 1477 m 2490 1417 l 2338 1417 l 2458 1447 l 2338 1477 l cp eoclip n 2100 1447 m 2475 1447 l gs col0 s gr gr % arrowhead n 2338 1477 m 2458 1447 l 2338 1417 l col0 s % Polyline gs clippath 3310 1774 m 3309 1714 l 3157 1715 l 3278 1745 l 3158 1775 l cp eoclip n 2100 1747 m 3295 1745 l gs col0 s gr gr % arrowhead n 3158 1775 m 3278 1745 l 3157 1715 l col0 s % Polyline gs clippath 2490 1177 m 2490 1117 l 2338 1117 l 2458 1147 l 2338 1177 l cp eoclip n 2100 1147 m 2475 1147 l gs col0 s gr gr % arrowhead n 2338 1177 m 2458 1147 l 2338 1117 l col0 s % Polyline gs clippath 1515 1185 m 1515 1125 l 1363 1125 l 1483 1155 l 1363 1185 l cp eoclip n 1115 1155 m 1500 1155 l gs col0 s gr gr % arrowhead n 1363 1185 m 1483 1155 l 1363 1125 l col0 s /Helvetica ff 165.00 scf sf 2025 1200 m gs 1 -1 sc (width) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1500 m gs 1 -1 sc (height) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1200 m gs 1 -1 sc (100.0) col0 sh gr /Helvetica ff 165.00 scf sf 2025 1800 m gs 1 -1 sc (corner) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1500 m gs 1 -1 sc (200.0) col0 sh gr /Helvetica ff 165.00 scf sf 1050 1200 m gs 1 -1 sc (box) dup sw pop neg 0 rm col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 13767 a Fl(12.6)1792 b(Instances)600 b(as)d(return)j(v)-100 b(alues)0 16450 y Fn(F)-92 b(unctions)434 b(can)h(return)e(instances.) 689 b(F)-92 b(or)433 b(example,)453 b Fk(findCenter)435 b Fn(tak)-31 b(es)435 b(a)g Fk(Rectangle)0 17805 y Fn(as)334 b(an)h(argumen)-31 b(t)335 b(and)g(returns)e(a)h Fk(Point)h Fn(that)g(con)-31 b(tains)336 b(the)f(co)31 b(ordinates)335 b(of)f(the)h(cen)-31 b(ter)0 19160 y(of)370 b(the)f Fk(Rectangle)p Fn(:)0 21538 y Fk(def)582 b(findCenter\(box\):)1162 22893 y(p)g(=)f(Point\(\))1162 24248 y(p.x)h(=)f(box.corner.x)i(+)e (box.width/2.0)1162 25603 y(p.y)h(=)f(box.corner.y)i(+)e (box.height/2.0)1162 26958 y(return)h(p)0 29336 y Fn(T)-92 b(o)273 b(call)h(this)f(function,)294 b(pass)273 b Fk(box)g Fn(as)f(an)i(argumen)-31 b(t)274 b(and)f(assign)g(the)g(result)g(to)g (a)g(v)-61 b(ariable:)0 31714 y Fk(>>>)582 b(center)g(=)f (findCenter\(box\))0 33069 y(>>>)h(printPoint\(center\))0 34424 y(\(50.0,)g(100.0\))0 39411 y Fl(12.7)1792 b(Ob)100 b(jects)599 b(are)f(m)-50 b(utable)0 42094 y Fn(W)-92 b(e)457 b(can)h(c)-31 b(hange)459 b(the)f(state)g(of)g(an)g(ob)61 b(ject)460 b(b)-31 b(y)458 b(making)h(an)f(assignmen)-31 b(t)460 b(to)e(one)g(of)h(its)0 43449 y(attributes.)524 b(F)-92 b(or)378 b(example,)384 b(to)379 b(c)-31 b(hange)381 b(the)e(size)g(of)g(a)h(rectangle)g(without)i(c)-31 b(hanging)381 b(its)0 44804 y(p)31 b(osition,)371 b(w)-31 b(e)370 b(could)g(mo)31 b(dify)370 b(the)g(v)-61 b(alues)369 b(of)h Fk(width)g Fn(and)f Fk(height)p Fn(:)0 47182 y Fk(box.width)582 b(=)g(box.width)g(+)g(50)0 48537 y(box.height)h(=)e(box.height)i(+)e (100)0 50915 y Fn(W)-92 b(e)360 b(could)i(encapsulate)g(this)g(co)31 b(de)361 b(in)g(a)h(metho)31 b(d)361 b(and)h(generalize)g(it)g(to)g (gro)-31 b(w)362 b(the)f(rect-)0 52270 y(angle)370 b(b)-31 b(y)370 b(an)-31 b(y)370 b(amoun)-31 b(t:)0 54648 y Fk(def)582 b(growRect\(box,)h(dwidth,)f(dheight\))g(:)1162 56003 y(box.width)h(=)e(box.width)i(+)e(dwidth)1162 57358 y(box.height)i(=)e (box.height)i(+)e(dheight)p eop %%Page: 133 159 133 158 bop 0 -2070 a Fv(12.8)425 b(Cop)-35 b(ying)28998 b(133)p 0 -1627 38191 45 v 0 865 a Fn(The)535 b(v)-61 b(ariables)534 b Fk(dwidth)h Fn(and)g Fk(dheight)g Fn(indicate)h(ho)-31 b(w)535 b(m)-31 b(uc)g(h)535 b(the)g(rectangle)h(should)0 2220 y(gro)-31 b(w)455 b(in)e(eac)-31 b(h)454 b(direction.)747 b(In)-31 b(v)g(oking)456 b(this)e(metho)31 b(d)454 b(has)f(the)h (e\256ect)g(of)g(mo)31 b(difying)456 b(the)0 3575 y Fk(Rectangle)370 b Fn(that)h(is)e(passed)g(as)g(an)g(argumen)-31 b(t.)0 5709 y(F)-92 b(or)564 b(example,)615 b(w)-31 b(e)564 b(could)i(create)e(a)h(new)f Fk(Rectangle)i Fn(named)f Fk(bob)g Fn(and)f(pass)g(it)h(to)0 7064 y Fk(growRect)p Fn(:)0 9279 y Fk(>>>)582 b(bob)f(=)g(Rectangle\(\))0 10634 y(>>>)h(bob.width)g(=)f(100.0)0 11989 y(>>>)h(bob.height)g(=)g (200.0)0 13344 y(>>>)g(bob.corner)g(=)g(Point\(\))0 14699 y(>>>)g(bob.corner.x)h(=)e(0.0;)0 16054 y(>>>)h(bob.corner.y)h(=)e (0.0;)0 17409 y(>>>)h(growRect\(bob,)h(50,)e(100\))0 19624 y Fn(While)335 b Fk(growRect)g Fn(is)f(running,)342 b(the)334 b(parameter)h Fk(box)g Fn(is)f(an)h(alias)g(for)f Fk(bob)p Fn(.)482 b(An)-31 b(y)334 b(c)-31 b(hanges)0 20979 y(made)370 b(to)g Fk(box)f Fn(also)h(a\256ect)g Fk(bob)p Fn(.)2767 23535 y Fm(As)649 b(an)h(exer)-57 b(cise,)713 b(write)649 b(a)g(function)i(name)-57 b(d)650 b Fk(moveRect)h Fm(that)d(takes)h(a)2767 24890 y Fk(Rectangle)401 b Fm(and)d(two)g(p)-57 b(ar)g(ameters)399 b(name)-57 b(d)400 b Fk(dx)f Fm(and)g Fk(dy)p Fm(.)518 b(It)398 b(should)g(change)2767 26245 y(the)565 b(lo)-57 b(c)g(ation)566 b(of)g(the)e(r)-57 b(e)g(ctangle)567 b(by)f(adding)f Fk(dx)g Fm(to)g(the)g Fk(x)g Fm(c)-57 b(o)g(or)g(dinate)566 b(of)2767 27600 y Fk(corner)397 b Fm(and)f(adding)h Fk(dy)f Fm(to)g(the)f Fk(y)i Fm(c)-57 b(o)g(or)g(dinate)397 b(of)f Fk(corner)p Fm(.)0 32067 y Fl(12.8)1792 b(Cop)-50 b(ying)0 34535 y Fn(Aliasing)282 b(can)d(mak)-31 b(e)281 b(a)f(program)g (di\261cult)i(to)e(read)f(b)31 b(ecause)279 b(c)-31 b(hanges)280 b(made)h(in)e(one)h(place)0 35890 y(migh)-31 b(t)410 b(ha)-31 b(v)g(e)409 b(unexp)31 b(ected)409 b(e\256ects)e(in)i(another) g(place.)610 b(It)408 b(is)h(hard)f(to)h(k)-31 b(eep)408 b(trac)-31 b(k)409 b(of)g(all)0 37245 y(the)369 b(v)-61 b(ariables)370 b(that)h(migh)-31 b(t)371 b(refer)d(to)i(a)g(giv)-31 b(en)370 b(ob)61 b(ject.)0 39379 y(Cop)-31 b(ying)311 b(an)e(ob)61 b(ject)310 b(is)f(often)g(an)g(alternativ)-31 b(e)311 b(to)f(aliasing.)475 b(The)309 b Fk(copy)g Fn(mo)31 b(dule)309 b(con)-31 b(tains)0 40734 y(a)369 b(function)i(called)f Fk(copy)g Fn(that)g(can)g(duplicate)h(an)-31 b(y)370 b(ob)61 b(ject:)0 42949 y Fk(>>>)582 b(import)g(copy)0 44304 y(>>>)g(p1)f(=)g(Point\(\))0 45659 y(>>>)h(p1.x)f(=)h(3)0 47014 y(>>>)g(p1.y)f(=)h(4)0 48368 y(>>>)g(p2)f(=)g(copy.copy\(p1\))0 49723 y(>>>)h(p1)f(==)g(p2)0 51078 y(0)0 52433 y(>>>)h(samePoint\(p1,)h (p2\))0 53788 y(1)0 56003 y Fn(Once)368 b(w)-31 b(e)369 b(imp)31 b(ort)369 b(the)f Fk(copy)h Fn(mo)31 b(dule,)369 b(w)-31 b(e)369 b(can)f(use)g(the)g Fk(copy)h Fn(metho)31 b(d)369 b(to)g(mak)-31 b(e)369 b(a)g(new)0 57358 y Fk(Point)p Fn(.)493 b Fk(p1)370 b Fn(and)f Fk(p2)g Fn(are)g(not)h(the)g(same)f(p) 31 b(oin)-31 b(t,)371 b(but)e(they)h(con)-31 b(tain)371 b(the)f(same)f(data.)p eop %%Page: 134 160 134 159 bop 0 -2070 a Fv(134)25469 b(Classes)425 b(and)f(ob)71 b(jects)p 0 -1627 38191 45 v 0 865 a Fn(T)-92 b(o)521 b(cop)-31 b(y)520 b(a)h(simple)g(ob)61 b(ject)521 b(lik)-31 b(e)521 b(a)g Fk(Point)p Fn(,)558 b(whic)-31 b(h)521 b(do)31 b(esn't)521 b(con)-31 b(tain)522 b(an)-31 b(y)521 b(em)-31 b(b)31 b(edded)0 2220 y(ob)61 b(jects,)371 b Fk(copy)e Fn(is)g(su\261cien)-31 b(t.)494 b(This)370 b(is)f(called)h Fv(shallo)-35 b(w)424 b(cop)-35 b(ying)p Fn(.)0 4523 y(F)-92 b(or)431 b(something)j(lik)-31 b(e)434 b(a)e Fk(Rectangle)p Fn(,)450 b(whic)-31 b(h)433 b(con)-31 b(tains)434 b(a)e(reference)f(to)i(a)g Fk(Point)p Fn(,)449 b Fk(copy)0 5878 y Fn(do)31 b(esn't)362 b(do)f(quite)h(the)g(righ)-31 b(t)362 b(thing.)491 b(It)362 b(copies)f(the)h(reference)e(to)i(the)f Fk(Point)h Fn(ob)61 b(ject,)365 b(so)0 7232 y(b)31 b(oth)370 b(the)f(old)h Fk(Rectangle)g Fn(and)g(the)f(new)h(one)f(refer)f(to)i(a) g(single)g Fk(Point)p Fn(.)0 9535 y(If)f(w)-31 b(e)371 b(create)f(a)g(b)31 b(o)-31 b(x,)370 b Fk(b1)p Fn(,)h(in)f(the)g(usual) g(w)-31 b(a)g(y)371 b(and)f(then)g(mak)-31 b(e)371 b(a)f(cop)-31 b(y)-92 b(,)371 b Fk(b2)p Fn(,)f(using)g Fk(copy)p Fn(,)0 10890 y(the)f(resulting)i(state)f(diagram)g(lo)31 b(oks)371 b(lik)-31 b(e)370 b(this:)40 13069 y 22563143 4012687 0 0 22563143 4012687 startTexFig 40 13069 a %%BeginDocument: illustrations/rectangle2.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: rectangle2.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Sat Dec 8 14:55:19 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 343 61 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 61 moveto 0 0 lineto 343 0 lineto 343 61 lineto closepath clip newpath -56.0 118.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 3300 1350 m 4275 1350 l 4275 1950 l 3300 1950 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 4575 975 m 6075 975 l 6075 1950 l 4575 1950 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1500 975 m 3000 975 l 3000 1950 l 1500 1950 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 3915 1852 m 3915 1792 l 3763 1792 l 3883 1822 l 3763 1852 l cp eoclip n 3525 1822 m 3900 1822 l gs col0 s gr gr % arrowhead n 3763 1852 m 3883 1822 l 3763 1792 l col0 s % Polyline gs clippath 3915 1552 m 3915 1492 l 3763 1492 l 3883 1522 l 3763 1552 l cp eoclip n 3525 1522 m 3900 1522 l gs col0 s gr gr % arrowhead n 3763 1552 m 3883 1522 l 3763 1492 l col0 s /Helvetica ff 165.00 scf sf 3450 1875 m gs 1 -1 sc (y) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3975 1575 m gs 1 -1 sc (0.0) col0 sh gr /Helvetica ff 165.00 scf sf 3450 1575 m gs 1 -1 sc (x) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3975 1875 m gs 1 -1 sc (0.0) col0 sh gr % Polyline gs clippath 2490 1477 m 2490 1417 l 2338 1417 l 2458 1447 l 2338 1477 l cp eoclip n 2100 1447 m 2475 1447 l gs col0 s gr gr % arrowhead n 2338 1477 m 2458 1447 l 2338 1417 l col0 s % Polyline gs clippath 2490 1177 m 2490 1117 l 2338 1117 l 2458 1147 l 2338 1177 l cp eoclip n 2100 1147 m 2475 1147 l gs col0 s gr gr % arrowhead n 2338 1177 m 2458 1147 l 2338 1117 l col0 s % Polyline gs clippath 5085 1417 m 5085 1477 l 5237 1477 l 5117 1447 l 5237 1417 l cp eoclip n 5475 1447 m 5100 1447 l gs col0 s gr gr % arrowhead n 5237 1417 m 5117 1447 l 5237 1477 l col0 s % Polyline gs clippath 5085 1117 m 5085 1177 l 5237 1177 l 5117 1147 l 5237 1117 l cp eoclip n 5475 1147 m 5100 1147 l gs col0 s gr gr % arrowhead n 5237 1117 m 5117 1147 l 5237 1177 l col0 s % Polyline gs clippath 3310 1774 m 3309 1714 l 3157 1715 l 3278 1745 l 3158 1775 l cp eoclip n 2100 1747 m 3295 1745 l gs col0 s gr gr % arrowhead n 3158 1775 m 3278 1745 l 3157 1715 l col0 s % Polyline gs clippath 4257 1724 m 4256 1784 l 4408 1785 l 4289 1755 l 4409 1725 l cp eoclip n 5467 1757 m 4272 1755 l gs col0 s gr gr % arrowhead n 4409 1725 m 4289 1755 l 4408 1785 l col0 s % Polyline gs clippath 6060 1125 m 6060 1185 l 6212 1185 l 6092 1155 l 6212 1125 l cp eoclip n 6420 1155 m 6075 1155 l gs col0 s gr gr % arrowhead n 6212 1125 m 6092 1155 l 6212 1185 l col0 s % Polyline gs clippath 1515 1185 m 1515 1125 l 1363 1125 l 1483 1155 l 1363 1185 l cp eoclip n 1140 1155 m 1500 1155 l gs col0 s gr gr % arrowhead n 1363 1185 m 1483 1155 l 1363 1125 l col0 s /Helvetica ff 165.00 scf sf 4650 1200 m gs 1 -1 sc (100.0) col0 sh gr /Helvetica ff 165.00 scf sf 4650 1500 m gs 1 -1 sc (200.0) col0 sh gr /Helvetica ff 165.00 scf sf 2025 1200 m gs 1 -1 sc (width) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1500 m gs 1 -1 sc (height) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1200 m gs 1 -1 sc (100.0) col0 sh gr /Helvetica ff 165.00 scf sf 2025 1800 m gs 1 -1 sc (corner) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1500 m gs 1 -1 sc (200.0) col0 sh gr /Helvetica ff 165.00 scf sf 5550 1200 m gs 1 -1 sc (width) col0 sh gr /Helvetica ff 165.00 scf sf 5550 1500 m gs 1 -1 sc (height) col0 sh gr /Helvetica ff 165.00 scf sf 5550 1800 m gs 1 -1 sc (corner) col0 sh gr /Helvetica ff 165.00 scf sf 1125 1200 m gs 1 -1 sc (b1) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 6450 1200 m gs 1 -1 sc (b2) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 22788 a Fn(This)375 b(is)g(almost)h(certainly)g(not)g(what)f(w)-31 b(e)376 b(w)-31 b(an)g(t.)510 b(In)374 b(this)h(case,)i(in)-31 b(v)g(oking)377 b Fk(growRect)f Fn(on)0 24142 y(one)441 b(of)h(the)g Fk(Rectangles)g Fn(w)-31 b(ould)443 b(not)f(a\256ect)g (the)f(other,)460 b(but)442 b(in)-31 b(v)g(oking)443 b Fk(moveRect)g Fn(on)0 25497 y(either)369 b(w)-31 b(ould)371 b(a\256ect)f(b)31 b(oth!)493 b(This)369 b(b)31 b(eha)-31 b(vior)371 b(is)e(confusing)h(and)f(error-prone.)0 27800 y(F)-92 b(ortunately)g(,)405 b(the)397 b Fk(copy)g Fn(mo)31 b(dule)398 b(con)-31 b(tains)399 b(a)e(metho)31 b(d)397 b(named)h Fk(deepcopy)g Fn(that)g(copies)0 29155 y(not)405 b(only)g(the)f(ob)61 b(ject)406 b(but)e(also)h(an)-31 b(y)405 b(em)-31 b(b)31 b(edded)404 b(ob)61 b(jects.)598 b(Y)-92 b(ou)404 b(will)i(not)f(b)31 b(e)403 b(surprised)0 30510 y(to)370 b(learn)f(that)i(this)e(op)31 b(eration)371 b(is)e(called)i(a)e Fv(deep)426 b(cop)-35 b(y)p Fn(.)0 32893 y Fk(>>>)582 b(b2)f(=)g(copy.deepcopy\(b1\))0 35277 y Fn(No)-31 b(w)370 b Fk(b1)g Fn(and)f Fk(b2)g Fn(are)g(completely)j (separate)e(ob)61 b(jects.)0 37580 y(W)-92 b(e)534 b(can)i(use)f Fk(deepcopy)h Fn(to)g(rewrite)f Fk(growRect)i Fn(so)e(that)h(instead)g (of)g(mo)31 b(difying)538 b(an)0 38934 y(existing)398 b Fk(Rectangle)p Fn(,)404 b(it)397 b(creates)f(a)g(new)g Fk(Rectangle)i Fn(that)f(has)f(the)g(same)h(lo)31 b(cation)398 b(as)0 40289 y(the)369 b(old)h(one)g(but)f(new)h(dimensions:)0 42673 y Fk(def)582 b(growRect\(box,)h(dwidth,)f(dheight\))g(:)1162 44028 y(import)g(copy)1162 45383 y(newBox)g(=)g(copy.deepcopy\(box\)) 1162 46738 y(newBox.width)h(=)f(newBox.width)g(+)g(dwidth)1162 48093 y(newBox.height)h(=)f(newBox.height)h(+)e(dheight)1162 49448 y(return)h(newBox)2767 52439 y Fm(A)-28 b(n)486 b(an)g(exer)-57 b(cise,)510 b(r)-57 b(ewrite)486 b Fk(moveRect)h Fm(so)f(that)f(it)h(cr)-57 b(e)g(ates)486 b(and)g(r)-57 b(eturns)486 b(a)2767 53794 y(new)397 b Fk(Rectangle)g Fm(inste)-57 b(ad)396 b(of)h(mo)-57 b(difying)398 b(the)e(old)g(one.)p eop %%Page: 135 161 135 160 bop 0 -2070 a Fv(12.9)425 b(Glossary)28784 b(135)p 0 -1627 38191 45 v 0 865 a Fl(12.9)1792 b(Glossary)0 3030 y Fv(class:)553 b Fn(A)526 b(user-de\257ned)g(comp)31 b(ound)527 b(t)-31 b(yp)31 b(e.)966 b(A)527 b(class)f(can)h(also)h(b)31 b(e)526 b(though)-31 b(t)529 b(of)e(as)g(a)2767 4385 y(template)372 b(for)d(the)g(ob)61 b(jects)371 b(that)f(are)f (instances)h(of)f(it.)0 6626 y Fv(instan)-35 b(tiate:)553 b Fn(T)-92 b(o)369 b(create)h(an)f(instance)h(of)g(a)g(class.)0 8866 y Fv(instance:)553 b Fn(An)370 b(ob)61 b(ject)370 b(that)h(b)31 b(elongs)369 b(to)h(a)g(class.)0 11107 y Fv(ob)71 b(ject:)554 b Fn(A)362 b(comp)31 b(ound)362 b(data)h(t)-31 b(yp)31 b(e)363 b(that)g(is)e(often)i(used)e(to)i(mo)31 b(del)363 b(a)f(thing)h(or)e(concept)2767 12462 y(in)370 b(the)f(real)h(w)-31 b(orld.)0 14702 y Fv(constructor:)555 b Fn(A)369 b(metho)31 b(d)370 b(used)f(to)h(create)f(new)h(ob)61 b(jects.)0 16943 y Fv(attribute:)554 b Fn(One)369 b(of)g(the)h(named)g (data)g(items)g(that)h(mak)-31 b(es)370 b(up)f(an)g(instance.)0 19183 y Fv(shallo)-35 b(w)424 b(equalit)-35 b(y:)552 b Fn(Equalit)-31 b(y)431 b(of)d(references,)442 b(or)428 b(t)-31 b(w)g(o)429 b(references)e(that)i(p)31 b(oin)-31 b(t)429 b(to)g(the)2767 20538 y(same)370 b(ob)61 b(ject.)0 22779 y Fv(deep)426 b(equalit)-35 b(y:)552 b Fn(Equalit)-31 b(y)324 b(of)d(v)-61 b(alues,)331 b(or)321 b(t)-31 b(w)g(o)322 b(references)e(that)i(p)31 b(oin)-31 b(t)322 b(to)g(ob)61 b(jects)322 b(that)2767 24133 y(ha)-31 b(v)g(e)371 b(the)e(same)h(v)-61 b(alue.)0 26374 y Fv(shallo)-35 b(w)424 b(cop)-35 b(y:)553 b Fn(T)-92 b(o)404 b(cop)-31 b(y)404 b(the)g(con)-31 b(ten)g(ts)405 b(of)e(an)h(ob)61 b(ject,)414 b(including)405 b(an)-31 b(y)404 b(references)e(to)2767 27729 y(em)-31 b(b)31 b(edded)302 b(ob)61 b(jects;)325 b(implemen)-31 b(ted)303 b(b)-31 b(y)302 b(the)f Fk(copy)h Fn(function)g(in)g(the)f Fk(copy)h Fn(mo)31 b(dule.)0 29969 y Fv(deep)426 b(cop)-35 b(y:)553 b Fn(T)-92 b(o)475 b(cop)-31 b(y)476 b(the)g(con)-31 b(ten)g(ts)476 b(of)g(an)f(ob)61 b(ject)477 b(as)e(w)-31 b(ell)476 b(as)g(an)-31 b(y)475 b(em)-31 b(b)31 b(edded)476 b(ob-)2767 31324 y(jects,)362 b(and)e(an)-31 b(y)360 b(ob)61 b(jects)360 b(em)-31 b(b)31 b(edded)360 b(in)g(them,)i(and)e (so)f(on;)k(implemen)-31 b(ted)362 b(b)-31 b(y)360 b(the)2767 32679 y Fk(deepcopy)371 b Fn(function)f(in)g(the)f Fk(copy)h Fn(mo)31 b(dule.)p eop %%Page: 136 162 136 161 bop 0 -2070 a Fv(136)25469 b(Classes)425 b(and)f(ob)71 b(jects)p 0 -1627 38191 45 v eop %%Page: 137 163 137 162 bop 0 10209 a Fi(Chapter)861 b(13)0 16797 y Fo(Classes)1032 b(and)i(functions)0 24243 y Fl(13.1)1792 b(Time)0 26989 y Fn(As)360 b(another)h(example)h(of)f(a)g(user-de\257ned)f(t)-31 b(yp)31 b(e,)363 b(w)-31 b(e'll)362 b(de\257ne)f(a)f(class)h(called)h Fk(Time)f Fn(that)0 28344 y(records)368 b(the)i(time)g(of)g(da)-31 b(y)-92 b(.)493 b(The)369 b(class)h(de\257nition)g(lo)31 b(oks)370 b(lik)-31 b(e)371 b(this:)0 30766 y Fk(class)582 b(Time:)1162 32121 y(pass)0 34543 y Fn(W)-92 b(e)364 b(can)g(create)h(a)f(new)h Fk(Time)f Fn(ob)61 b(ject)366 b(and)f(assign)g(attributes)g(for)g(hours,)g(min)-31 b(utes,)367 b(and)0 35898 y(seconds:)0 38320 y Fk(time)582 b(=)f(Time\(\))0 39675 y(time.hours)i(=)e(11)0 41030 y(time.minutes)i(=)e(59)0 42385 y(time.seconds)i(=)e(30)0 44808 y Fn(The)369 b(state)h(diagram)h(for)f(the)f Fk(Time)h Fn(ob)61 b(ject)370 b(lo)31 b(oks)370 b(lik)-31 b(e)371 b(this:)11762 46187 y 8683192 4012687 0 0 8683192 4012687 startTexFig 11762 46187 a %%BeginDocument: illustrations/time.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: time.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 10:11:34 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 132 61 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 61 moveto 0 0 lineto 132 0 lineto 132 61 lineto closepath clip newpath -45.0 118.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 1500 975 m 2925 975 l 2925 1950 l 1500 1950 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 2565 1477 m 2565 1417 l 2413 1417 l 2533 1447 l 2413 1477 l cp eoclip n 2175 1447 m 2550 1447 l gs col0 s gr gr % arrowhead n 2413 1477 m 2533 1447 l 2413 1417 l col0 s % Polyline gs clippath 2557 1777 m 2557 1717 l 2405 1717 l 2525 1747 l 2405 1777 l cp eoclip n 2175 1747 m 2542 1747 l gs col0 s gr gr % arrowhead n 2405 1777 m 2525 1747 l 2405 1717 l col0 s % Polyline gs clippath 2565 1177 m 2565 1117 l 2413 1117 l 2533 1147 l 2413 1177 l cp eoclip n 2175 1147 m 2550 1147 l gs col0 s gr gr % arrowhead n 2413 1177 m 2533 1147 l 2413 1117 l col0 s /Helvetica ff 165.00 scf sf 2625 1500 m gs 1 -1 sc (59) col0 sh gr /Helvetica ff 165.00 scf sf 2625 1800 m gs 1 -1 sc (30) col0 sh gr /Helvetica ff 165.00 scf sf 2100 1200 m gs 1 -1 sc (hour) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2100 1500 m gs 1 -1 sc (minute) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2100 1800 m gs 1 -1 sc (second) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2625 1200 m gs 1 -1 sc (11) col0 sh gr % Polyline gs clippath 1515 1185 m 1515 1125 l 1363 1125 l 1483 1155 l 1363 1185 l cp eoclip n 1115 1155 m 1500 1155 l gs col0 s gr gr % arrowhead n 1363 1185 m 1483 1155 l 1363 1125 l col0 s /Helvetica ff 165.00 scf sf 1050 1200 m gs 1 -1 sc (time) dup sw pop neg 0 rm col0 sh gr $F2psEnd rs %%EndDocument endTexFig 2767 55788 a Fm(As)365 b(an)f(exer)-57 b(cise,)373 b(write)364 b(a)g(function)j Fk(printTime)f Fm(that)e(takes)g(a)g Fk(Time)i Fm(obje)-57 b(ct)2767 57143 y(as)385 b(an)g(ar)-57 b(gument)385 b(and)g(prints)g(it)g(in)g(the)g(form)g Fk(hours:minutes:seconds)p Fm(.)p eop %%Page: 138 164 138 163 bop 0 -2070 a Fv(138)24355 b(Classes)425 b(and)f(functions)p 0 -1627 38191 45 v 2767 865 a Fm(As)397 b(a)g(se)-57 b(c)g(ond)398 b(exer)-57 b(cise,)398 b(write)f(a)f(b)-57 b(o)g(ole)g(an)399 b(function)f Fk(after)g Fm(that)e(takes)h(two)2767 2220 y Fk(Time)468 b Fm(obje)-57 b(cts,)486 b Fk(t1)467 b Fm(and)f Fk(t2)p Fm(,)486 b(as)466 b(ar)-57 b(guments,)486 b(and)466 b(r)-57 b(eturns)467 b(true)g(\(1\))f(if)h Fk(t1)2767 3575 y Fm(fol)57 b(lows)395 b Fk(t2)h Fm(chr)-57 b(onolo)g(gic)g(al)57 b(ly)397 b(and)f(false)g(\(0\))f(otherwise.)0 8670 y Fl(13.2)1792 b(Pure)599 b(functions)0 11442 y Fn(In)389 b(the)h(next)f(few)h(sections,)396 b(w)-31 b(e'll)391 b(write)f(t)-31 b(w)g(o)391 b(v)-31 b(ersions)390 b(of)g(a)f(function)i(called)g Fk(addTime)p Fn(,)0 12797 y(whic)-31 b(h)485 b(calculates)h(the)e(sum)g(of)h(t)-31 b(w)g(o)485 b Fk(Time)p Fn(s.)838 b(They)484 b(will)i(demonstrate)f(t) -31 b(w)g(o)486 b(kinds)e(of)0 14152 y(functions:)494 b(pure)368 b(functions)i(and)g(mo)31 b(di\257ers.)0 16512 y(The)369 b(follo)-31 b(wing)373 b(is)c(a)h(rough)f(v)-31 b(ersion)370 b(of)g Fk(addTime)p Fn(:)0 18953 y Fk(def)582 b(addTime\(t1,)g(t2\):)1162 20308 y(sum)g(=)f(Time\(\))1162 21663 y(sum.hours)i(=)e(t1.hours)h(+)g(t2.hours)1162 23018 y(sum.minutes)h(=)e(t1.minutes)i(+)e(t2.minutes)1162 24372 y(sum.seconds)i(=)e(t1.seconds)i(+)e(t2.seconds)1162 25727 y(return)h(sum)0 28168 y Fn(The)361 b(function)i(creates)e(a)h (new)f Fk(Time)h Fn(ob)61 b(ject,)365 b(initializes)f(its)d (attributes,)k(and)c(returns)g(a)0 29523 y(reference)320 b(to)i(the)f(new)g(ob)61 b(ject.)478 b(This)321 b(is)g(called)h(a)f Fv(pure)370 b(function)322 b Fn(b)31 b(ecause)320 b(it)i(do)31 b(es)320 b(not)0 30878 y(mo)31 b(dify)375 b(an)-31 b(y)375 b(of)f(the)g(ob)61 b(jects)374 b(passed)g(to)g(it)h(as)e(parameters)h (and)g(it)h(has)e(no)h(side)g(e\256ects,)0 32233 y(suc)-31 b(h)369 b(as)g(displa)-31 b(ying)371 b(a)f(v)-61 b(alue)370 b(or)f(getting)i(user)d(input.)0 34593 y(Here)383 b(is)g(an)h(example)h (of)f(ho)-31 b(w)384 b(to)g(use)f(this)h(function.)537 b(W)-92 b(e'll)384 b(create)f(t)-31 b(w)g(o)386 b Fk(Time)d Fn(ob)61 b(jects:)0 35948 y Fk(currentTime)p Fn(,)354 b(whic)-31 b(h)350 b(con)-31 b(tains)350 b(the)e(curren)-31 b(t)348 b(time;)357 b(and)349 b Fk(breadTime)p Fn(,)354 b(whic)-31 b(h)349 b(con)-31 b(tains)0 37303 y(the)441 b(amoun)-31 b(t)443 b(of)e(time)h(it)f(tak)-31 b(es)442 b(for)e(a)h(breadmak)-31 b(er)442 b(to)f(mak)-31 b(e)442 b(bread.)707 b(Then)441 b(w)-31 b(e'll)443 b(use)0 38658 y Fk(addTime)504 b Fn(to)g(\257gure)f(out)g(when)h(the)f(bread)g(will)h (b)31 b(e)503 b(done.)895 b(If)502 b(y)-31 b(ou)504 b(ha)-31 b(v)g(en't)505 b(\257nished)0 40013 y(writing)371 b Fk(printTime)f Fn(y)-31 b(et,)371 b(tak)-31 b(e)370 b(a)g(lo)31 b(ok)370 b(ahead)g(to)g(Section)g(14.2)h(b)31 b(efore)369 b(y)-31 b(ou)370 b(try)f(this:)0 42454 y Fk(>>>)582 b(currentTime)g(=)g (Time\(\))0 43809 y(>>>)g(currentTime.hours)h(=)f(9)0 45164 y(>>>)g(currentTime.minutes)i(=)d(14)0 46519 y(>>>)h (currentTime.seconds)i(=)1162 b(30)0 49229 y(>>>)582 b(breadTime)g(=)f(Time\(\))0 50584 y(>>>)h(breadTime.hours)h(=)1162 b(3)0 51938 y(>>>)582 b(breadTime.minutes)h(=)1163 b(35)0 53293 y(>>>)582 b(breadTime.seconds)h(=)1163 b(0)0 56003 y(>>>)582 b(doneTime)g(=)f(addTime\(currentTime,)j(breadTime\))0 57358 y(>>>)e(printTime\(doneTime\))p eop %%Page: 139 165 139 164 bop 0 -2070 a Fv(13.3)425 b(Mo)35 b(di\257ers)28338 b(139)p 0 -1627 38191 45 v 0 865 a Fn(The)385 b(output)h(of)f(this)g (program)h(is)e Fk(12:49:30)p Fn(,)390 b(whic)-31 b(h)386 b(is)f(correct.)539 b(On)384 b(the)h(other)g(hand,)0 2220 y(there)369 b(are)g(cases)g(where)g(the)g(result)g(is)g(not)h (correct.)493 b(Can)370 b(y)-31 b(ou)370 b(think)g(of)f(one?)0 4733 y(The)331 b(problem)h(is)f(that)i(this)e(function)i(do)31 b(es)331 b(not)h(deal)g(with)g(cases)f(where)g(the)g(n)-31 b(um)g(b)31 b(er)331 b(of)0 6088 y(seconds)412 b(or)h(min)-31 b(utes)414 b(adds)e(up)h(to)g(more)g(than)h(sixt)-31 b(y)-92 b(.)624 b(When)412 b(that)i(happ)31 b(ens,)424 b(w)-31 b(e)413 b(ha)-31 b(v)g(e)0 7443 y(to)350 b(\\carry")g(the)g (extra)g(seconds)f(in)-31 b(to)351 b(the)f(min)-31 b(utes)351 b(column)g(or)e(the)h(extra)g(min)-31 b(utes)350 b(in)-31 b(to)0 8798 y(the)369 b(hours)g(column.)0 11310 y(Here's)g(a)g(second)g (corrected)g(v)-31 b(ersion)370 b(of)g(the)f(function:)0 13904 y Fk(def)582 b(addTime\(t1,)g(t2\):)1162 15259 y(sum)g(=)f(Time\(\))1162 16614 y(sum.hours)i(=)e(t1.hours)h(+)g (t2.hours)1162 17969 y(sum.minutes)h(=)e(t1.minutes)i(+)e(t2.minutes) 1162 19324 y(sum.seconds)i(=)e(t1.seconds)i(+)e(t2.seconds)1162 22034 y(if)h(sum.seconds)h(>=)e(60:)2325 23389 y(sum.seconds)h(=)g (sum.seconds)g(-)g(60)2325 24744 y(sum.minutes)g(=)g(sum.minutes)g(+)g (1)1162 27453 y(if)g(sum.minutes)h(>=)e(60:)2325 28808 y(sum.minutes)h(=)g(sum.minutes)g(-)g(60)2325 30163 y(sum.hours)g(=)f (sum.hours)i(+)e(1)1162 32873 y(return)h(sum)0 35467 y Fn(Although)345 b(this)f(function)g(is)f(correct,)349 b(it)344 b(is)f(starting)i(to)f(get)g(big.)484 b(Later)344 b(w)-31 b(e)344 b(will)g(suggest)0 36822 y(an)369 b(alternativ)-31 b(e)372 b(approac)-31 b(h)370 b(that)h(yields)f(shorter)e(co)31 b(de.)0 42375 y Fl(13.3)1792 b(Mo)50 b(di\257ers)0 45361 y Fn(There)426 b(are)h(times)g(when)g(it)h(is)e(useful)h(for)g(a)g (function)h(to)f(mo)31 b(dify)428 b(one)f(or)g(more)g(of)g(the)0 46716 y(ob)61 b(jects)305 b(it)f(gets)g(as)f(parameters.)472 b(Usually)-92 b(,)318 b(the)304 b(caller)g(k)-31 b(eeps)303 b(a)h(reference)f(to)h(the)g(ob)61 b(jects)0 48071 y(it)346 b(passes,)k(so)c(an)-31 b(y)346 b(c)-31 b(hanges)346 b(the)g(function)h(mak)-31 b(es)347 b(are)e(visible)i(to)f(the)g (caller.)486 b(F)-92 b(unctions)0 49426 y(that)370 b(w)-31 b(ork)370 b(this)g(w)-31 b(a)g(y)371 b(are)e(called)h Fv(mo)35 b(di\257ers)p Fn(.)0 51938 y Fk(increment)p Fn(,)410 b(whic)-31 b(h)401 b(adds)f(a)g(giv)-31 b(en)402 b(n)-31 b(um)g(b)31 b(er)400 b(of)g(seconds)g(to)h(a)f Fk(Time)h Fn(ob)61 b(ject,)410 b(w)-31 b(ould)401 b(b)31 b(e)0 53293 y(written)417 b(most)g(naturally)h(as)f(a)f(mo)31 b(di\257er.)634 b(A)416 b(rough)g(draft)h(of)g(the)f(function)i(lo)31 b(oks)417 b(lik)-31 b(e)0 54648 y(this:)p eop %%Page: 140 166 140 165 bop 0 -2070 a Fv(140)24355 b(Classes)425 b(and)f(functions)p 0 -1627 38191 45 v 0 865 a Fk(def)582 b(increment\(time,)h(seconds\):) 1162 2220 y(time.seconds)g(=)f(time.seconds)g(+)g(seconds)1162 4930 y(if)g(time.seconds)h(>=)e(60:)2325 6285 y(time.seconds)i(=)e (time.seconds)i(-)e(60)2325 7640 y(time.minutes)i(=)e(time.minutes)i(+) e(1)1162 10350 y(if)h(time.minutes)h(>=)e(60:)2325 11705 y(time.minutes)i(=)e(time.minutes)i(-)e(60)2325 13059 y(time.hours)h(=)g(time.hours)g(+)f(1)0 15199 y Fn(The)318 b(\257rst)f(line)h(p)31 b(erforms)317 b(the)h(basic)g(op)31 b(eration;)336 b(the)318 b(remainder)g(deals)g(with)h(the)e(sp)31 b(ecial)0 16554 y(cases)369 b(w)-31 b(e)369 b(sa)-31 b(w)370 b(b)31 b(efore.)0 18612 y(Is)549 b(this)i(function)g(correct?) 1035 b(What)551 b(happ)31 b(ens)549 b(if)i(the)f(parameter)h Fk(seconds)g Fn(is)f(m)-31 b(uc)g(h)0 19967 y(greater)475 b(than)h(sixt)-31 b(y?)810 b(In)474 b(that)i(case,)502 b(it)476 b(is)e(not)i(enough)f(to)h(carry)f(once;)528 b(w)-31 b(e)475 b(ha)-31 b(v)g(e)476 b(to)0 21322 y(k)-31 b(eep)364 b(doing)i(it)e(un)-31 b(til)366 b Fk(seconds)f Fn(is)f(less)f(than)i(sixt)-31 b(y)-92 b(.)492 b(One)364 b(solution)h(is)f(to)h(replace)g(the)f Fk(if)0 22677 y Fn(statemen)-31 b(ts)371 b(with)f Fk(while)g Fn(statemen)-31 b(ts:)0 24816 y Fk(def)582 b(increment\(time,)h(seconds\):)1162 26171 y(time.seconds)g(=)f(time.seconds)g(+)g(seconds)1162 28881 y(while)g(time.seconds)h(>=)f(60:)2325 30236 y(time.seconds)h(=)e (time.seconds)i(-)e(60)2325 31591 y(time.minutes)i(=)e(time.minutes)i (+)e(1)1162 34301 y(while)h(time.minutes)h(>=)f(60:)2325 35656 y(time.minutes)h(=)e(time.minutes)i(-)e(60)2325 37010 y(time.hours)h(=)g(time.hours)g(+)f(1)0 39150 y Fn(This)370 b(function)g(is)f(no)-31 b(w)370 b(correct,)g(but)f(it)h (is)f(not)h(the)g(most)g(e\261cien)-31 b(t)370 b(solution.)2767 41490 y Fm(As)450 b(an)h(exer)-57 b(cise,)465 b(r)-57 b(ewrite)450 b(this)g(function)i(so)e(that)f(it)i(do)-57 b(esn)-113 b('t)451 b(c)-57 b(ontain)451 b(any)2767 42845 y(lo)-57 b(ops.)2767 45185 y(As)526 b(a)g(se)-57 b(c)g(ond)526 b(exer)-57 b(cise,)560 b(r)-57 b(ewrite)526 b Fk(increment)h Fm(as)f(a)f(pur)-57 b(e)526 b(function,)561 b(and)2767 46540 y(write)396 b(function)i(c)-57 b(al)57 b(ls)395 b(to)h(b)-57 b(oth)396 b(versions.)0 50901 y Fl(13.4)1792 b(Whic)-50 b(h)599 b(is)f(b)50 b(etter?)0 53293 y Fn(An)-31 b(ything)490 b(that)g(can)f(b)31 b(e)487 b(done)i(with)h(mo)31 b(di\257ers)488 b(can)h(also)g(b)31 b(e)488 b(done)h(with)g(pure)f (func-)0 54648 y(tions.)478 b(In)322 b(fact,)333 b(some)323 b(programming)i(languages)f(only)f(allo)-31 b(w)325 b(pure)d (functions.)478 b(There)322 b(is)0 56003 y(some)373 b(evidence)h(that)g (programs)g(that)g(use)e(pure)h(functions)h(are)e(faster)i(to)f(dev)-31 b(elop)375 b(and)0 57358 y(less)408 b(error-prone)g(than)h(programs)g (that)h(use)d(mo)31 b(di\257ers.)611 b(Nev)-31 b(ertheless,)419 b(mo)31 b(di\257ers)409 b(are)0 58713 y(con)-31 b(v)g(enien)g(t)371 b(at)f(times,)h(and)e(in)h(some)f(cases,)g(functional)j(programs)e(are) f(less)f(e\261cien)-31 b(t.)p eop %%Page: 141 167 141 166 bop 0 -2070 a Fv(13.5)425 b(Protot)-35 b(yp)35 b(e)427 b(dev)-35 b(elopmen)g(t)425 b(v)-35 b(ersus)425 b(planning)11435 b(141)p 0 -1627 38191 45 v 0 865 a Fn(In)368 b(general,)i(w)-31 b(e)369 b(recommend)h(that)g(y)-31 b(ou)369 b(write)g(pure)f(functions)i(whenev)-31 b(er)369 b(it)g(is)g(reason-)0 2220 y(able)451 b(to)g(do)f(so)g(and)g(resort)f (to)i(mo)31 b(di\257ers)450 b(only)h(if)g(there)f(is)g(a)g(comp)31 b(elling)452 b(adv)-61 b(an)-31 b(tage.)0 3575 y(This)370 b(approac)-31 b(h)370 b(migh)-31 b(t)371 b(b)31 b(e)369 b(called)h(a)f Fv(functional)425 b(programming)h(st)-35 b(yle)p Fn(.)0 7929 y Fl(13.5)1792 b(Protot)-50 b(yp)50 b(e)600 b(dev)-50 b(elopmen)g(t)600 b(v)-50 b(ersus)600 b(planning)0 10315 y Fn(In)489 b(this)h(c)-31 b(hapter,)520 b(w)-31 b(e)490 b(demonstrated)h(an)f(approac)-31 b(h)490 b(to)h(program)f(dev)-31 b(elopmen)g(t)492 b(that)0 11670 y(w)-31 b(e)465 b(call)i Fv(protot)-35 b(yp)35 b(e)536 b(dev)-35 b(elopmen)g(t)p Fn(.)781 b(In)465 b(eac)-31 b(h)465 b(case,)489 b(w)-31 b(e)466 b(wrote)g(a)f(rough)g(draft)h(\(or) 0 13025 y(protot)-31 b(yp)31 b(e\))503 b(that)e(p)31 b(erformed)501 b(the)g(basic)g(calculation)j(and)c(then)h(tested)g(it)h (on)f(a)f(few)0 14380 y(cases,)369 b(correcting)h(\260a)-31 b(ws)370 b(as)f(w)-31 b(e)370 b(found)f(them.)0 16433 y(Although)292 b(this)e(approac)-31 b(h)291 b(can)f(b)31 b(e)290 b(e\256ectiv)-31 b(e,)307 b(it)290 b(can)h(lead)f(to)h(co)31 b(de)290 b(that)h(is)f(unnecessarily)0 17788 y(complicated|since)448 b(it)d(deals)g(with)i(man)-31 b(y)446 b(sp)31 b(ecial)445 b(cases|and)g(unreliable|since)h(it)0 19143 y(is)369 b(hard)g(to)h(kno)-31 b(w)370 b(if)g(y)-31 b(ou)370 b(ha)-31 b(v)g(e)370 b(found)g(all)g(the)g(errors.)0 21196 y(An)407 b(alternativ)-31 b(e)410 b(is)d Fv(planned)469 b(dev)-35 b(elopmen)g(t)p Fn(,)418 b(in)407 b(whic)-31 b(h)408 b(high-lev)-31 b(el)409 b(insigh)-31 b(t)409 b(in)-31 b(to)409 b(the)0 22551 y(problem)280 b(can)g(mak)-31 b(e)281 b(the)e(programming)j(m)-31 b(uc)g(h)280 b(easier.)463 b(In)279 b(this)h(case,)298 b(the)279 b(insigh)-31 b(t)281 b(is)f(that)0 23906 y(a)338 b Fk(Time)g Fn(ob)61 b(ject)339 b(is)e(really)i(a)e(three-digit)j(n)-31 b(um)g(b)31 b(er)337 b(in)h(base)f(60!)483 b(The)338 b Fk(second)g Fn(comp)31 b(onen)-31 b(t)0 25261 y(is)420 b(the)g(\\ones)g(column,")435 b(the)420 b Fk(minute)g Fn(comp)31 b(onen)-31 b(t)422 b(is)e(the)g(\\sixties)h(column,")435 b(and)420 b(the)0 26616 y Fk(hour)370 b Fn(comp)31 b(onen)-31 b(t)370 b(is)f(the)h (\\thirt)-31 b(y-six)371 b(h)-31 b(undreds)369 b(column.")0 28669 y(When)378 b(w)-31 b(e)379 b(wrote)g Fk(addTime)h Fn(and)e Fk(increment)p Fn(,)383 b(w)-31 b(e)379 b(w)-31 b(ere)378 b(e\256ectiv)-31 b(ely)380 b(doing)g(addition)h(in)0 30024 y(base)369 b(60,)i(whic)-31 b(h)370 b(is)f(wh)-31 b(y)370 b(w)-31 b(e)369 b(had)h(to)g(carry)f(from)g(one)h(column)g(to)g (the)f(next.)0 32077 y(This)319 b(observ)-61 b(ation)320 b(suggests)f(another)g(approac)-31 b(h)320 b(to)g(the)f(whole)h (problem|w)-31 b(e)320 b(can)f(con-)0 33432 y(v)-31 b(ert)343 b(a)g Fk(Time)g Fn(ob)61 b(ject)344 b(in)-31 b(to)344 b(a)e(single)i(n)-31 b(um)g(b)31 b(er)342 b(and)h(tak)-31 b(e)344 b(adv)-61 b(an)-31 b(tage)345 b(of)e(the)f(fact)i(that)g(the)0 34787 y(computer)458 b(kno)-31 b(ws)458 b(ho)-31 b(w)458 b(to)g(do)f(arithmetic)i(with)g(n)-31 b(um)g(b)31 b(ers.)755 b(The)458 b(follo)-31 b(wing)461 b(function)0 36141 y(con)-31 b(v)g(erts)370 b(a)f Fk(Time)h Fn(ob)61 b(ject)371 b(in)-31 b(to)370 b(an)g(in)-31 b(teger:)0 38276 y Fk(def)582 b(convertToSeconds\(t\):)1162 39630 y(minutes)g(=)g(t.hours)g(*)f(60)h (+)f(t.minutes)1162 40985 y(seconds)h(=)g(minutes)g(*)f(60)h(+)f (t.seconds)1162 42340 y(return)h(seconds)0 44474 y Fn(No)-31 b(w,)371 b(all)f(w)-31 b(e)370 b(need)f(is)g(a)h(w)-31 b(a)g(y)370 b(to)g(con)-31 b(v)g(ert)370 b(from)g(an)g(in)-31 b(teger)370 b(to)g(a)f Fk(Time)h Fn(ob)61 b(ject:)0 46608 y Fk(def)582 b(makeTime\(seconds\):)1162 47963 y(time)g(=)f(Time\(\)) 1162 49318 y(time.hours)i(=)e(seconds/3600)1162 50673 y(time.minutes)i(=)f(\(seconds\0453600\)/60)1162 52028 y(time.seconds)h(=)f(seconds\04560)1162 53383 y(return)g(time)0 55517 y Fn(Y)-92 b(ou)348 b(migh)-31 b(t)349 b(ha)-31 b(v)g(e)348 b(to)h(think)f(a)g(bit)g(to)g(con)-31 b(vince)349 b(y)-31 b(ourself)348 b(that)h(this)e(function)i(is)f(correct.)0 56872 y(Assuming)375 b(y)-31 b(ou)374 b(are)g(con)-31 b(vinced,)376 b(y)-31 b(ou)375 b(can)f(use)f(it)i(and)f Fk(convertToSeconds)i Fn(to)f(rewrite)0 58227 y Fk(addTime)p Fn(:)p eop %%Page: 142 168 142 167 bop 0 -2070 a Fv(142)24355 b(Classes)425 b(and)f(functions)p 0 -1627 38191 45 v 0 865 a Fk(def)582 b(addTime\(t1,)g(t2\):)1162 2220 y(seconds)g(=)g(convertToSeconds\(t1\))i(+)d (convertToSeconds\(t2\))1162 3575 y(return)h(makeTime\(seconds\))0 5796 y Fn(This)366 b(v)-31 b(ersion)366 b(is)f(m)-31 b(uc)g(h)366 b(shorter)f(than)h(the)g(original,)j(and)c(it)h(is)g(m)-31 b(uc)g(h)366 b(easier)f(to)h(demon-)0 7151 y(strate)k(that)g(it)g(is)f (correct.)2767 9725 y Fm(As)396 b(an)g(exer)-57 b(cise,)397 b(r)-57 b(ewrite)396 b Fk(increment)i Fm(the)d(same)h(way.)0 14201 y Fl(13.6)1792 b(Generalization)0 16674 y Fn(In)372 b(some)g(w)-31 b(a)g(ys,)374 b(con)-31 b(v)g(erting)374 b(from)f(base)f(60)g(to)h(base)f(10)h(and)f(bac)-31 b(k)373 b(is)f(harder)f(than)i(just)0 18029 y(dealing)394 b(with)f(times.)562 b(Base)392 b(con)-31 b(v)g(ersion)393 b(is)f(more)g(abstract;)405 b(our)391 b(in)-31 b(tuition)395 b(for)d(dealing)0 19384 y(with)370 b(times)g(is)g(b)31 b(etter.)0 21524 y(But)268 b(if)g(w)-31 b(e)268 b(ha)-31 b(v)g(e)268 b(the)g(insigh)-31 b(t)269 b(to)g(treat)f(times)g(as)g(base)f(60)h(n)-31 b(um)g(b)31 b(ers)268 b(and)f(mak)-31 b(e)269 b(the)f(in)-31 b(v)g(est-)0 22879 y(men)g(t)446 b(of)g(writing)h(the)f(con)-31 b(v)g(ersion)446 b(functions)g(\()p Fk(convertToSeconds)i Fn(and)e Fk(makeTime)p Fn(\),)0 24234 y(w)-31 b(e)370 b(get)g(a)f(program)h(that)h(is)e(shorter,)g(easier)g(to)h(read)f(and)g (debug,)h(and)g(more)f(reliable.)0 26374 y(It)479 b(is)g(also)i(easier) e(to)h(add)f(features)h(later.)823 b(F)-92 b(or)479 b(example,)508 b(imagine)482 b(subtracting)e(t)-31 b(w)g(o)0 27729 y Fk(Time)p Fn(s)505 b(to)i(\257nd)e(the)g(duration)i(b)31 b(et)-31 b(w)g(een)506 b(them.)902 b(The)506 b(na)-123 b(\304)-430 b(\263v)-31 b(e)506 b(approac)-31 b(h)506 b(w)-31 b(ould)507 b(b)31 b(e)505 b(to)0 29084 y(implemen)-31 b(t)439 b(subtraction)e(with)h(b)31 b(orro)-31 b(wing.)695 b(Using)436 b(the)h(con)-31 b(v)g(ersion)437 b(functions)g(w)-31 b(ould)0 30439 y(b)31 b(e)369 b(easier)g(and)g(more)h(lik)-31 b(ely)371 b(to)f(b)31 b(e)369 b(correct.)0 32579 y(Ironically)-92 b(,)304 b(sometimes)286 b(making)h(a)e(problem)h(harder)e(\(or)h(more)g (general\))i(mak)-31 b(es)285 b(it)h(easier)0 33934 y(\(b)31 b(ecause)369 b(there)g(are)g(few)-31 b(er)370 b(sp)31 b(ecial)369 b(cases)g(and)h(few)-31 b(er)369 b(opp)31 b(ortunities)371 b(for)e(error\).)0 38410 y Fl(13.7)1792 b(Algorithms)0 40884 y Fn(When)246 b(y)-31 b(ou)248 b(write)g(a)f (general)h(solution)h(for)e(a)g(class)g(of)h(problems,)272 b(as)247 b(opp)31 b(osed)247 b(to)h(a)f(sp)31 b(eci\257c)0 42239 y(solution)437 b(to)e(a)g(single)g(problem,)453 b(y)-31 b(ou)435 b(ha)-31 b(v)g(e)436 b(written)g(an)f Fv(algorithm)p Fn(.)689 b(W)-92 b(e)434 b(men)-31 b(tioned)0 43593 y(this)410 b(w)-31 b(ord)410 b(b)31 b(efore)409 b(but)h(did)f(not)i(de\257ne)e(it)h(carefully)-92 b(.)614 b(It)410 b(is)f(not)i(easy)e(to)h(de\257ne,)420 b(so)409 b(w)-31 b(e)0 44948 y(will)371 b(try)e(a)h(couple)g(of)f(approac)-31 b(hes.)0 47088 y(First,)400 b(consider)393 b(something)j(that)e(is)g (not)g(an)g(algorithm.)568 b(When)393 b(y)-31 b(ou)395 b(learned)f(to)g(m)-31 b(ul-)0 48443 y(tiply)502 b(single-digit)i(n)-31 b(um)g(b)31 b(ers,)533 b(y)-31 b(ou)502 b(probably)g(memorized)g(the)f (m)-31 b(ultiplication)505 b(table.)0 49798 y(In)395 b(e\256ect,)402 b(y)-31 b(ou)396 b(memorized)h(100)f(sp)31 b(eci\257c)395 b(solutions.)572 b(That)397 b(kind)f(of)g(kno)-31 b(wledge)397 b(is)e(not)0 51153 y(algorithmic.)0 53293 y(But)511 b(if)h(y)-31 b(ou)511 b(w)-31 b(ere)511 b(\\lazy)-92 b(,")549 b(y)-31 b(ou)512 b(probably)g(c)-31 b(heated)511 b(b)-31 b(y)512 b(learning)g(a)f(few)g(tric)-31 b(ks.)919 b(F)-92 b(or)0 54648 y(example,)412 b(to)403 b(\257nd)f(the)g(pro)31 b(duct)402 b(of)h Fg(n)f Fn(and)h(9,)411 b(y)-31 b(ou)402 b(can)h(write)g Fg(n)268 b Fj(\241)g Fn(1)402 b(as)g(the)h(\257rst)e (digit)0 56003 y(and)388 b(10)260 b Fj(\241)f Fg(n)388 b Fn(as)g(the)h(second)f(digit.)551 b(This)389 b(tric)-31 b(k)389 b(is)f(a)g(general)h(solution)h(for)e(m)-31 b(ultiplying)0 57358 y(an)g(y)370 b(single-digit)i(n)-31 b(um)g(b)31 b(er)369 b(b)-31 b(y)370 b(9.)492 b(That's)371 b(an)e(algorithm!)p eop %%Page: 143 169 143 168 bop 0 -2070 a Fv(13.8)425 b(Glossary)28784 b(143)p 0 -1627 38191 45 v 0 865 a Fn(Similarly)-92 b(,)538 b(the)502 b(tec)-31 b(hniques)503 b(y)-31 b(ou)502 b(learned)g(for)g(addition)i (with)f(carrying,)537 b(subtraction)0 2220 y(with)351 b(b)31 b(orro)-31 b(wing,)355 b(and)350 b(long)h(division)h(are)d(all)i (algorithms.)489 b(One)349 b(of)i(the)f(c)-31 b(haracteristics)0 3575 y(of)454 b(algorithms)i(is)d(that)i(they)f(do)f(not)i(require)e (an)-31 b(y)454 b(in)-31 b(telligence)456 b(to)e(carry)f(out.)746 b(They)0 4930 y(are)398 b(mec)-31 b(hanical)401 b(pro)31 b(cesses)397 b(in)h(whic)-31 b(h)400 b(eac)-31 b(h)399 b(step)f(follo)-31 b(ws)401 b(from)e(the)f(last)i(according)f(to)0 6285 y(a)369 b(simple)h(set)g(of)f(rules.)0 8450 y(In)439 b(our)g(opinion,)460 b(it)440 b(is)f(em)-31 b(barrassing)441 b(that)f(h)-31 b(umans)440 b(sp)31 b(end)439 b(so)g(m)-31 b(uc)g(h)441 b(time)f(in)g(sc)-31 b(ho)31 b(ol)0 9805 y(learning)370 b(to)g(execute)g(algorithms)i(that,)e(quite)h(literally) -92 b(,)372 b(require)c(no)i(in)-31 b(telligence.)0 11970 y(On)407 b(the)h(other)g(hand,)418 b(the)408 b(pro)31 b(cess)407 b(of)h(designing)h(algorithms)h(is)e(in)-31 b(teresting,)419 b(in)-31 b(tellec-)0 13325 y(tually)371 b(c)-31 b(hallenging,)373 b(and)c(a)h(cen)-31 b(tral)370 b(part)f(of)h(what)g(w)-31 b(e)370 b(call)h(programming.)0 15490 y(Some)526 b(of)g(the)g(things)g(that)h(p)31 b(eople)526 b(do)g(naturally)-92 b(,)567 b(without)527 b(di\261cult)-31 b(y)528 b(or)d(conscious)0 16845 y(though)-31 b(t,)603 b(are)553 b(the)i(hardest)e(to)i(express)e(algorithmically)-92 b(.)1052 b(Understanding)555 b(natural)0 18200 y(language)507 b(is)d(a)h(go)31 b(o)g(d)505 b(example.)900 b(W)-92 b(e)504 b(all)h(do)g(it,)540 b(but)504 b(so)h(far)f(no)h(one)g(has)f(b)31 b(een)504 b(able)0 19555 y(to)370 b(explain)h Fm(how)d Fn(w)-31 b(e)369 b(do)h(it,)g(at)g(least)g(not)g(in)g(the)f(form)h(of)f (an)h(algorithm.)0 24066 y Fl(13.8)1792 b(Glossary)0 26231 y Fv(pure)425 b(function:)554 b Fn(A)352 b(function)g(that)h(do) 31 b(es)351 b(not)h(mo)31 b(dify)353 b(an)-31 b(y)352 b(of)g(the)f(ob)61 b(jects)353 b(it)f(receiv)-31 b(es)2767 27586 y(as)370 b(parameters.)493 b(Most)369 b(pure)f(functions)j(are)e (fruitful.)0 29826 y Fv(mo)35 b(di\257er:)555 b Fn(A)483 b(function)h(that)h(c)-31 b(hanges)484 b(one)f(or)g(more)h(of)g(the)f (ob)61 b(jects)485 b(it)f(receiv)-31 b(es)483 b(as)2767 31181 y(parameters.)493 b(Most)370 b(mo)31 b(di\257ers)369 b(are)g(v)-31 b(oid.)0 33422 y Fv(functional)424 b(programming)i(st)-35 b(yle:)553 b Fn(A)342 b(st)-31 b(yle)343 b(of)f(program)h(design)f(in)g (whic)-31 b(h)343 b(the)f(ma-)2767 34777 y(jorit)-31 b(y)371 b(of)f(functions)g(are)f(pure.)0 37017 y Fv(protot)-35 b(yp)35 b(e)426 b(dev)-35 b(elopmen)g(t:)555 b Fn(A)343 b(w)-31 b(a)g(y)344 b(of)f(dev)-31 b(eloping)345 b(programs)f(starting) g(with)g(a)f(pro-)2767 38372 y(tot)-31 b(yp)31 b(e)371 b(and)e(gradually)j(testing)e(and)g(impro)-31 b(ving)371 b(it.)0 40612 y Fv(planned)425 b(dev)-35 b(elopmen)g(t:)554 b Fn(A)261 b(w)-31 b(a)g(y)262 b(of)e(dev)-31 b(eloping)263 b(programs)e(that)g(in)-31 b(v)g(olv)g(es)263 b(high-lev)-31 b(el)2767 41967 y(insigh)g(t)287 b(in)-31 b(to)287 b(the)f(problem)g (and)g(more)g(planning)h(than)f(incremen)-31 b(tal)288 b(dev)-31 b(elopmen)g(t)2767 43322 y(or)369 b(protot)-31 b(yp)31 b(e)371 b(dev)-31 b(elopmen)g(t.)0 45563 y Fv(algorithm:)553 b Fn(A)256 b(set)f(of)h(instructions)h(for)e(solving)i(a)f(class)g(of)g (problems)g(b)-31 b(y)255 b(a)h(mec)-31 b(hanical,)2767 46918 y(unin)g(telligen)g(t)373 b(pro)31 b(cess.)p eop %%Page: 144 170 144 169 bop 0 -2070 a Fv(144)24355 b(Classes)425 b(and)f(functions)p 0 -1627 38191 45 v eop %%Page: 145 171 145 170 bop 0 9897 a Fi(Chapter)861 b(14)0 16173 y Fo(Classes)1032 b(and)i(metho)86 b(ds)0 23308 y Fl(14.1)1792 b(Ob)100 b(ject-orien)-50 b(ted)600 b(features)0 25671 y Fn(Python)332 b(is)e(an)g Fv(ob)71 b(ject-orien)-35 b(ted)382 b(programming)f (language)p Fn(,)340 b(whic)-31 b(h)331 b(means)g(that)g(it)0 27026 y(pro)-31 b(vides)370 b(features)f(that)h(supp)31 b(ort)369 b Fv(ob)71 b(ject-orien)-35 b(ted)427 b(programming)p Fn(.)0 29055 y(It)369 b(is)g(not)h(easy)g(to)f(de\257ne)g(ob)61 b(ject-orien)-31 b(ted)372 b(programming,)g(but)e(w)-31 b(e)369 b(ha)-31 b(v)g(e)370 b(already)h(seen)0 30410 y(some)f(of)f(its)h(c)-31 b(haracteristics:)1660 32668 y Fj(\262)554 b Fn(Programs)381 b(are)f(made)h(up)e(of)i(ob)61 b(ject)381 b(de\257nitions)h(and)e(function)h(de\257nitions,)k(and)2767 34023 y(most)370 b(of)g(the)g(computation)i(is)d(expressed)f(in)h (terms)h(of)f(op)31 b(erations)371 b(on)e(ob)61 b(jects.)1660 36137 y Fj(\262)554 b Fn(Eac)-31 b(h)411 b(ob)61 b(ject)411 b(de\257nition)g(corresp)31 b(onds)409 b(to)h(some)h(ob)61 b(ject)411 b(or)e(concept)i(in)f(the)g(real)2767 37492 y(w)-31 b(orld,)488 b(and)463 b(the)g(functions)g(that)h(op)31 b(erate)464 b(on)e(that)i(ob)61 b(ject)464 b(corresp)31 b(ond)462 b(to)i(the)2767 38847 y(w)-31 b(a)g(ys)371 b(real-w)-31 b(orld)370 b(ob)61 b(jects)371 b(in)-31 b(teract.)0 41105 y(F)-92 b(or)274 b(example,)296 b(the)275 b Fk(Time)g Fn(class)g(de\257ned)f(in)h(Chapter)h(13)f(corresp)31 b(onds)274 b(to)h(the)g(w)-31 b(a)g(y)276 b(p)31 b(eople)0 42460 y(record)450 b(the)g(time)i(of)f(da)-31 b(y)-92 b(,)472 b(and)450 b(the)h(functions)g(w)-31 b(e)451 b(de\257ned)f (corresp)31 b(ond)450 b(to)h(the)g(kinds)0 43815 y(of)496 b(things)g(p)31 b(eople)495 b(do)h(with)g(times.)872 b(Similarly)-92 b(,)529 b(the)496 b Fk(Point)g Fn(and)f Fk(Rectangle)h Fn(classes)0 45170 y(corresp)31 b(ond)368 b(to)i(the)g(mathematical)j(concepts)d(of)f(a)h(p)31 b(oin)-31 b(t)370 b(and)g(a)f(rectangle.)0 47199 y(So)464 b(far,)487 b(w)-31 b(e)464 b(ha)-31 b(v)g(e)464 b(not)h(tak)-31 b(en)464 b(adv)-61 b(an)-31 b(tage)466 b(of)e(the)f(features)h(Python)h (pro)-31 b(vides)463 b(to)i(sup-)0 48554 y(p)31 b(ort)524 b(ob)61 b(ject-orien)-31 b(ted)527 b(programming.)960 b(Strictly)526 b(sp)31 b(eaking,)565 b(these)524 b(features)g(are)g (not)0 49909 y(necessary)-92 b(.)556 b(F)-92 b(or)390 b(the)g(most)i(part,)k(they)391 b(pro)-31 b(vide)392 b(an)f(alternativ)-31 b(e)393 b(syn)-31 b(tax)391 b(for)g(things)g(w) -31 b(e)0 51264 y(ha)g(v)g(e)348 b(already)f(done,)352 b(but)347 b(in)g(man)-31 b(y)348 b(cases,)k(the)346 b(alternativ)-31 b(e)350 b(is)d(more)g(concise)g(and)g(more)0 52619 y(accurately)371 b(con)-31 b(v)g(eys)370 b(the)f(structure)g(of)g(the)h(program.)0 54648 y(F)-92 b(or)376 b(example,)381 b(in)c(the)g Fk(Time)g Fn(program,)j(there)d(is)f(no)h(ob)-31 b(vious)379 b(connection)f(b)31 b(et)-31 b(w)g(een)378 b(the)0 56003 y(class)264 b(de\257nition)i(and)f (the)g(function)h(de\257nitions)f(that)h(follo)-31 b(w.)460 b(With)265 b(some)g(examination,)0 57358 y(it)320 b(is)f(apparen)-31 b(t)320 b(that)g(ev)-31 b(ery)319 b(function)i(tak)-31 b(es)320 b(at)g(least)g(one)f Fk(Time)h Fn(ob)61 b(ject)320 b(as)f(a)h(parameter.)p eop %%Page: 146 172 146 171 bop 0 -2070 a Fv(146)24691 b(Classes)425 b(and)f(metho)35 b(ds)p 0 -1627 38191 45 v 0 865 a Fn(This)431 b(observ)-61 b(ation)432 b(is)e(the)h(motiv)-61 b(ation)434 b(for)c Fv(metho)35 b(ds)p Fn(.)679 b(W)-92 b(e)430 b(ha)-31 b(v)g(e)431 b(already)h(seen)e(some)0 2220 y(metho)31 b(ds,)420 b(suc)-31 b(h)409 b(as)g Fk(keys)g Fn(and)g Fk(values)p Fn(,)421 b(whic)-31 b(h)410 b(w)-31 b(ere)409 b(in)-31 b(v)g(ok)g(ed)411 b(on)e(dictionaries.)614 b(Eac)-31 b(h)0 3575 y(metho)31 b(d)362 b(is)f(asso)31 b(ciated)363 b(with)f(a)g(class)f(and)h(is)f(in)-31 b(tended)362 b(to)g(b)31 b(e)361 b(in)-31 b(v)g(ok)g(ed)363 b(on)f(instances)f(of)0 4930 y(that)370 b(class.)0 7204 y(Metho)31 b(ds)369 b(are)g(just)g(lik) -31 b(e)371 b(functions,)f(with)h(t)-31 b(w)g(o)371 b(di\256erences:) 1660 10060 y Fj(\262)554 b Fn(Metho)31 b(ds)464 b(are)f(de\257ned)g (inside)h(a)g(class)f(de\257nition)i(in)f(order)f(to)h(mak)-31 b(e)465 b(the)f(rela-)2767 11415 y(tionship)371 b(b)31 b(et)-31 b(w)g(een)370 b(the)f(class)h(and)f(the)h(metho)31 b(d)370 b(explicit.)1660 13858 y Fj(\262)554 b Fn(The)383 b(syn)-31 b(tax)383 b(for)f(in)-31 b(v)g(oking)384 b(a)f(metho)31 b(d)383 b(is)f(di\256eren)-31 b(t)382 b(from)g(the)h(syn)-31 b(tax)383 b(for)f(calling)2767 15213 y(a)370 b(function.)0 18068 y(In)335 b(the)h(next)h(few)f(sections,)343 b(w)-31 b(e)336 b(will)i(tak)-31 b(e)337 b(the)f(functions)h(from)f(the)g (previous)g(t)-31 b(w)g(o)337 b(c)-31 b(hap-)0 19423 y(ters)356 b(and)h(transform)g(them)h(in)-31 b(to)358 b(metho)31 b(ds.)489 b(This)357 b(transformation)i(is)e(purely)g(mec) -31 b(hani-)0 20778 y(cal;)319 b(y)-31 b(ou)293 b(can)g(do)f(it)h (simply)h(b)-31 b(y)292 b(follo)-31 b(wing)296 b(a)d(sequence)f(of)h (steps.)466 b(If)292 b(y)-31 b(ou)293 b(are)f(comfortable)0 22133 y(con)-31 b(v)g(erting)399 b(from)f(one)g(form)g(to)g(another,) 406 b(y)-31 b(ou)398 b(will)h(b)31 b(e)397 b(able)i(to)f(c)-31 b(ho)31 b(ose)398 b(the)f(b)31 b(est)397 b(form)0 23488 y(for)369 b(whatev)-31 b(er)371 b(y)-31 b(ou)370 b(are)f(doing.)0 28326 y Fl(14.2)1792 b Fe(printTime)0 30977 y Fn(In)348 b(Chapter)i(13,)k(w)-31 b(e)349 b(de\257ned)f(a)h(class)g(named)g Fk(Time)g Fn(and)g(y)-31 b(ou)350 b(wrote)f(a)g(function)h(named)0 32332 y Fk(printTime)p Fn(,)371 b(whic)-31 b(h)370 b(should)f(ha)-31 b(v)g(e)371 b(lo)31 b(ok)-31 b(ed)370 b(something)h(lik)-31 b(e)371 b(this:)0 34687 y Fk(class)582 b(Time:)1162 36042 y(pass)0 38752 y(def)g(printTime\(time\):)1162 40107 y(print)g(str\(time.hours\))i(+)d(":")g(+)h(\\)4649 41462 y(str\(time.minutes\))i(+)d(":")h(+)f(\\)4649 42817 y (str\(time.seconds\))0 45172 y Fn(T)-92 b(o)370 b(call)g(this)g (function,)h(w)-31 b(e)369 b(passed)g(a)h Fk(Time)f Fn(ob)61 b(ject)371 b(as)e(a)g(parameter:)0 47527 y Fk(>>>)582 b(currentTime)g(=)g(Time\(\))0 48882 y(>>>)g(currentTime.hours)h(=)f(9) 0 50237 y(>>>)g(currentTime.minutes)i(=)d(14)0 51592 y(>>>)h(currentTime.seconds)i(=)d(30)0 52947 y(>>>)h (printTime\(currentTime\))0 55302 y Fn(T)-92 b(o)329 b(mak)-31 b(e)330 b Fk(printTime)f Fn(a)g(metho)31 b(d,)338 b(all)329 b(w)-31 b(e)329 b(ha)-31 b(v)g(e)330 b(to)f(do)g(is)f(mo)-31 b(v)g(e)330 b(the)e(function)i(de\257nition)0 56657 y(inside)370 b(the)f(class)g(de\257nition.)495 b(Notice)370 b(the)g(c)-31 b(hange)370 b(in)f(inden)-31 b(tation.)p eop %%Page: 147 173 147 172 bop 0 -2070 a Fv(14.3)425 b(Another)i(example)23974 b(147)p 0 -1627 38191 45 v 0 865 a Fk(class)582 b(Time:)1162 2220 y(def)g(printTime\(time\):)2325 3575 y(print)f(str\(time.hours\))j (+)d(":")h(+)1162 b(\\)5811 4930 y(str\(time.minutes\))584 b(+)d(":")h(+)1163 b(\\)5811 6285 y(str\(time.seconds\))0 8519 y Fn(No)-31 b(w)370 b(w)-31 b(e)370 b(can)g(in)-31 b(v)g(ok)g(e)371 b Fk(printTime)f Fn(using)g(dot)f(notation.)0 10753 y Fk(>>>)582 b(currentTime.printTime\(\))0 12988 y Fn(As)313 b(usual,)326 b(the)313 b(ob)61 b(ject)315 b(on)f(whic)-31 b(h)314 b(the)g(metho)31 b(d)315 b(is)e(in)-31 b(v)g(ok)g(ed)315 b(app)31 b(ears)313 b(b)31 b(efore)314 b(the)f(dot)i(and)0 14343 y(the)369 b(name)h(of)g(the)f(metho)31 b(d)371 b(app)31 b(ears)368 b(after)i(the)g(dot.)0 16496 y(The)409 b(ob)61 b(ject)410 b(on)f(whic)-31 b(h)410 b(the)f(metho)31 b(d)409 b(is)g(in)-31 b(v)g(ok)g(ed)410 b(is)f(assigned)g(to)h(the)f(\257rst)f(parameter,)0 17851 y(so)369 b(in)h(this)f(case)g Fk(currentTime)i Fn(is)e(assigned)h(to)g (the)f(parameter)h Fk(time)p Fn(.)0 20004 y(By)401 b(con)-31 b(v)g(en)g(tion,)412 b(the)402 b(\257rst)e(parameter)i(of)f(a)h(metho) 31 b(d)402 b(is)f(called)h Fk(self)p Fn(.)589 b(The)401 b(reason)g(for)0 21359 y(this)370 b(is)f(a)g(little)j(con)-31 b(v)g(oluted,)372 b(but)d(it)h(is)f(based)g(on)h(a)f(useful)g (metaphor.)0 23512 y(The)513 b(syn)-31 b(tax)513 b(for)g(a)g(function)h (call,)550 b Fk(printTime\(currentTime\))p Fn(,)i(suggests)513 b(that)h(the)0 24867 y(function)338 b(is)e(the)g(activ)-31 b(e)338 b(agen)-31 b(t.)484 b(It)336 b(sa)-31 b(ys)336 b(something)i(lik)-31 b(e,)345 b(\\Hey)337 b Fk(printTime)p Fn(!)483 b(Here's)336 b(an)0 26222 y(ob)61 b(ject)371 b(for)e(y)-31 b(ou)370 b(to)g(prin)-31 b(t.")0 28376 y(In)480 b(ob)61 b(ject-orien)-31 b(ted)482 b(programming,)511 b(the)480 b(ob)61 b(jects)482 b(are)e(the)g(activ)-31 b(e)482 b(agen)-31 b(ts.)826 b(An)480 b(in)-31 b(v)g(o-)0 29730 y(cation)477 b(lik)-31 b(e)478 b Fk(currentTime.printTime\(\))h Fn(sa)-31 b(ys)475 b(\\Hey)i Fk(currentTime)p Fn(!)814 b(Please)476 b(prin)-31 b(t)0 31085 y(y)g(ourself)86 b(!")0 33239 y(This)419 b(c)-31 b(hange)420 b(in)f(p)31 b(ersp)g(ectiv)-31 b(e)419 b(migh)-31 b(t)420 b(b)31 b(e)419 b(more)g(p)31 b(olite,)433 b(but)419 b(it)h(is)e(not)i(ob)-31 b(vious)420 b(that)g(it)0 34594 y(is)414 b(useful.)627 b(In)413 b(the)h(examples)h(w)-31 b(e)415 b(ha)-31 b(v)g(e)415 b(seen)e(so)h(far,)425 b(it)415 b(ma)-31 b(y)415 b(not)g(b)31 b(e.)626 b(But)414 b(sometimes)0 35948 y(shifting)402 b(resp)31 b(onsibilit)-31 b(y)402 b(from)f(the)g(functions)h(on)-31 b(to)402 b(the)e(ob)61 b(jects)402 b(mak)-31 b(es)401 b(it)g(p)31 b(ossible)401 b(to)0 37303 y(write)369 b(more)f(v)-31 b(ersatile)369 b(functions,)h(and)e(mak)-31 b(es)369 b(it)f(easier)g(to)h(main)-31 b(tain)371 b(and)d(reuse)e(co)31 b(de.)0 41798 y Fl(14.3)1792 b(Another)599 b(example)0 44284 y Fn(Let's)440 b(con)-31 b(v)g(ert)440 b Fk(increment)h Fn(\(from)g(Section)f(13.3\))i(to)e(a)g(metho)31 b(d.)705 b(T)-92 b(o)440 b(sa)-31 b(v)g(e)440 b(space,)457 b(w)-31 b(e)0 45639 y(will)459 b(lea)-31 b(v)g(e)459 b(out)g(previously)f (de\257ned)f(metho)31 b(ds,)481 b(but)458 b(y)-31 b(ou)458 b(should)g(k)-31 b(eep)458 b(them)g(in)g(y)-31 b(our)0 46994 y(v)g(ersion:)0 49229 y Fk(class)582 b(Time:)1162 50584 y(#previous)h(method)f(definitions)h(here...)1162 53293 y(def)f(increment\(self,)h(seconds\):)2325 54648 y(self.seconds)g(=)e(seconds)h(+)f(self.seconds)p eop %%Page: 148 174 148 173 bop 0 -2070 a Fv(148)24691 b(Classes)425 b(and)f(metho)35 b(ds)p 0 -1627 38191 45 v 2325 865 a Fk(while)581 b(self.seconds)i(>=)f (60:)3487 2220 y(self.seconds)h(=)e(self.seconds)i(-)e(60)3487 3575 y(self.minutes)i(=)e(self.minutes)i(+)e(1)2325 6285 y(while)g(self.minutes)i(>=)f(60:)3487 7640 y(self.minutes)h(=)e (self.minutes)i(-)e(60)3487 8995 y(self.hours)i(=)e(self.hours)h(+)g(1) 0 11154 y Fn(The)391 b(transformation)i(is)e(purely)g(mec)-31 b(hanical|w)g(e)393 b(mo)-31 b(v)g(e)392 b(the)f(metho)31 b(d)392 b(de\257nition)g(in)-31 b(to)0 12509 y(the)369 b(class)h(de\257nition)g(and)g(c)-31 b(hange)370 b(the)f(name)h(of)g (the)f(\257rst)g(parameter.)0 14586 y(No)-31 b(w)370 b(w)-31 b(e)370 b(can)g(in)-31 b(v)g(ok)g(e)371 b Fk(increment)f Fn(as)f(a)h(metho)31 b(d.)0 16745 y Fk(currentTime.increment\(500\))0 18904 y Fn(Again,)539 b(the)504 b(ob)61 b(ject)505 b(on)f(whic)-31 b(h)504 b(the)g(metho)31 b(d)504 b(is)g(in)-31 b(v)g(ok)g(ed)505 b(gets)f(assigned)g(to)h(the)e(\257rst)0 20259 y(parameter,)370 b Fk(self)p Fn(.)494 b(The)369 b(second)g(parameter,)h Fk(seconds)g Fn(gets)g(the)f(v)-61 b(alue)370 b Fk(500)p Fn(.)2767 22656 y Fm(As)351 b(an)g(exer)-57 b(cise,)360 b(c)-57 b(onvert)352 b Fk(convertToSeconds)h Fm(\(fr)-57 b(om)351 b(Se)-57 b(ction)352 b(13.5\))f(to)f(a)2767 24010 y(metho)-57 b(d)396 b(in)h(the)f Fk(Time)h Fm(class.)0 28399 y Fl(14.4)1792 b(A)598 b(more)h(complicated)g(example)0 30811 y Fn(The)508 b Fk(after)g Fn(function)h(is)e(sligh)-31 b(tly)510 b(more)e(complicated)i(b)31 b(ecause)507 b(it)i(op)31 b(erates)507 b(on)h(t)-31 b(w)g(o)0 32165 y Fk(Time)339 b Fn(ob)61 b(jects,)346 b(not)339 b(just)g(one.)483 b(W)-92 b(e)337 b(can)i(only)h(con)-31 b(v)g(ert)339 b(one)g(of)g(the)g (parameters)g(to)g Fk(self)p Fn(;)0 33520 y(the)369 b(other)h(sta)-31 b(ys)370 b(the)f(same:)0 35679 y Fk(class)582 b(Time:)1162 37034 y(#previous)h(method)f(definitions)h(here...)1162 39744 y(def)f(after\(self,)h(time2\):)2325 41099 y(if)e(self.hour)i(>)e (time2.hour:)3487 42454 y(return)h(1)2325 43809 y(if)f(self.hour)i(<)e (time2.hour:)3487 45164 y(return)h(0)2325 47874 y(if)f(self.minute)i(>) e(time2.minute:)3487 49229 y(return)h(1)2325 50584 y(if)f(self.minute)i (<)e(time2.minute:)3487 51938 y(return)h(0)2325 54648 y(if)f(self.second)i(>)e(time2.second:)3487 56003 y(return)h(1)2325 57358 y(return)g(0)p eop %%Page: 149 175 149 174 bop 0 -2070 a Fv(14.5)425 b(Optional)g(argumen)-35 b(ts)22542 b(149)p 0 -1627 38191 45 v 0 865 a Fn(W)-92 b(e)368 b(in)-31 b(v)g(ok)g(e)372 b(this)d(metho)31 b(d)370 b(on)g(one)f(ob)61 b(ject)371 b(and)e(pass)g(the)g(other)h(as)f(an)g (argumen)-31 b(t:)0 3062 y Fk(if)581 b(doneTime.after\(currentTime\):) 1162 4417 y(print)h("The)g(bread)g(is)f(not)h(done)g(yet.")0 6613 y Fn(Y)-92 b(ou)382 b(can)g(almost)h(read)f(the)g(in)-31 b(v)g(o)31 b(cation)385 b(lik)-31 b(e)383 b(English:)519 b(\\If)382 b(the)f(done-time)j(is)d(after)i(the)0 7968 y(curren)-31 b(t-time,)371 b(then...")0 12409 y Fl(14.5)1792 b(Optional)598 b(argumen)-50 b(ts)0 14858 y Fn(W)-92 b(e)370 b(ha)-31 b(v)g(e)371 b(seen)e(built-in)j(functions)g(that)f (tak)-31 b(e)372 b(a)e(v)-61 b(ariable)372 b(n)-31 b(um)g(b)31 b(er)370 b(of)h(argumen)-31 b(ts.)497 b(F)-92 b(or)0 16213 y(example,)371 b Fk(string.find)g Fn(can)e(tak)-31 b(e)371 b(t)-31 b(w)g(o,)371 b(three,)e(or)g(four)h(argumen)-31 b(ts.)0 18329 y(It)406 b(is)h(p)31 b(ossible)406 b(to)h(write)g (user-de\257ned)e(functions)j(with)f(optional)i(argumen)-31 b(t)408 b(lists.)605 b(F)-92 b(or)0 19684 y(example,)564 b(w)-31 b(e)524 b(can)g(upgrade)f(our)h(o)-31 b(wn)524 b(v)-31 b(ersion)524 b(of)g Fk(find)g Fn(to)g(do)g(the)f(same)h(thing)h (as)0 21038 y Fk(string.find)p Fn(.)0 23154 y(This)370 b(is)f(the)g(original)j(v)-31 b(ersion)369 b(from)h(Section)g(7.7:)0 25350 y Fk(def)582 b(find\(str,)g(ch\):)1162 26705 y(index)g(=)f(0)1162 28060 y(while)h(index)g(<)f(len\(str\):)2325 29415 y(if)g(str[index])i (==)e(ch:)3487 30770 y(return)h(index)2325 32125 y(index)f(=)h(index)g (+)f(1)1162 33480 y(return)h(-1)0 35676 y Fn(This)370 b(is)f(the)g(new)h(and)f(impro)-31 b(v)g(ed)371 b(v)-31 b(ersion:)0 37873 y Fk(def)582 b(find\(str,)g(ch,)g(start=0\):)1162 39228 y(index)g(=)f(start)1162 40583 y(while)h(index)g(<)f(len\(str\):) 2325 41938 y(if)g(str[index])i(==)e(ch:)3487 43293 y(return)h(index) 2325 44648 y(index)f(=)h(index)g(+)f(1)1162 46003 y(return)h(-1)0 48199 y Fn(The)349 b(third)g(parameter,)354 b Fk(start)p Fn(,)g(is)349 b(optional)j(b)31 b(ecause)348 b(a)h(default)i(v)-61 b(alue,)354 b Fk(0)p Fn(,)f(is)c(pro)-31 b(vided.)0 49554 y(If)354 b(w)-31 b(e)354 b(in)-31 b(v)g(ok)g(e)356 b Fk(find)f Fn(with)g(only)g(t)-31 b(w)g(o)356 b(argumen)-31 b(ts,)358 b(it)d(uses)e(the)i(default)g(v)-61 b(alue)355 b(and)f(starts)0 50909 y(from)370 b(the)f(b)31 b(eginning)371 b(of)e(the)h(string:)0 53105 y Fk(>>>)582 b(find\("apple",)h("p"\))0 54460 y(1)0 56657 y Fn(If)369 b(w)-31 b(e)370 b(pro)-31 b(vide)370 b(a)f(third)h(parameter,)g(it)g Fv(o)-35 b(v)g(errides)370 b Fn(the)f(default:)p eop %%Page: 150 176 150 175 bop 0 -2070 a Fv(150)24691 b(Classes)425 b(and)f(metho)35 b(ds)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(find\("apple",)h("p",)e (2\))0 2220 y(2)0 3575 y(>>>)h(find\("apple",)h("p",)e(3\))0 4930 y(-1)2767 7862 y Fm(As)393 b(an)h(exer)-57 b(cise,)394 b(add)f(a)g(fourth)g(p)-57 b(ar)g(ameter,)394 b Fk(end)p Fm(,)h(that)d(sp)-57 b(e)g(ci\257es)395 b(wher)-57 b(e)393 b(to)2767 9217 y(stop)i(lo)-57 b(oking.)2767 11113 y(Warning:)761 b(This)521 b(exer)-57 b(cise)522 b(is)g(a)f(bit)g(tricky.)887 b(The)521 b(default)g(value)h(of)f Fk(end)2767 12468 y Fm(should)469 b(b)-57 b(e)471 b Fk(len\(str\))p Fm(,)490 b(but)470 b(that)f(do)-57 b(esn)-113 b('t)470 b(work.)731 b(The)470 b(default)g(values)g(ar)-57 b(e)2767 13823 y(evaluate)g(d)410 b(when)f(the)g(function)i(is)f(de\257ne)-57 b(d,)414 b(not)409 b(when)h(it)f(is)h(c)-57 b(al)57 b(le)-57 b(d.)550 b(When)2767 15178 y Fk(find)397 b Fm(is)f(de\257ne)-57 b(d,)398 b Fk(str)e Fm(do)-57 b(esn)-113 b('t)396 b(exist)g(yet,)h(so)e (you)i(c)-57 b(an)-113 b('t)397 b(\257nd)f(its)g(length.)0 20008 y Fl(14.6)1792 b(The)599 b(initialization)g(metho)50 b(d)0 22656 y Fn(The)313 b Fv(initialization)357 b(metho)35 b(d)314 b Fn(is)f(a)f(sp)31 b(ecial)314 b(metho)31 b(d)313 b(that)h(is)e(in)-31 b(v)g(ok)g(ed)315 b(when)e(an)f(ob)61 b(ject)0 24011 y(is)472 b(created.)801 b(The)473 b(name)f(of)h(this)f (metho)31 b(d)473 b(is)p 20307 24011 349 45 v 20725 24011 V 1309 w Fk(init)p 23468 24011 V 23887 24011 V 1309 w Fn(\(t)-31 b(w)g(o)474 b(underscore)d(c)-31 b(haracters,)0 25366 y(follo)g(w)g(ed)459 b(b)-31 b(y)457 b Fk(init)p Fn(,)479 b(and)456 b(then)h(t)-31 b(w)g(o)458 b(more)e(underscores\).) 753 b(An)457 b(initialization)k(metho)31 b(d)0 26720 y(for)369 b(the)h Fk(Time)f Fn(class)g(lo)31 b(oks)371 b(lik)-31 b(e)370 b(this:)0 29073 y Fk(class)582 b(Time:)1162 30428 y(def)g(__init__\(self,)h(hours=0,)f(minutes=0,)h(seconds=0\):) 2325 31783 y(self.hours)f(=)g(hours)2325 33138 y(self.minutes)h(=)e (minutes)2325 34493 y(self.seconds)i(=)e(seconds)0 36845 y Fn(There)265 b(is)h(no)f(con\260ict)i(b)31 b(et)-31 b(w)g(een)266 b(the)g(attribute)h Fk(self.hours)g Fn(and)f(the)g (parameter)g Fk(hours)p Fn(.)0 38200 y(Dot)370 b(notation)h(sp)31 b(eci\257es)369 b(whic)-31 b(h)370 b(v)-61 b(ariable)370 b(w)-31 b(e)370 b(are)f(referring)g(to.)0 40472 y(When)484 b(w)-31 b(e)484 b(in)-31 b(v)g(ok)g(e)487 b(the)d Fk(Time)h Fn(constructor,)514 b(the)484 b(argumen)-31 b(ts)486 b(w)-31 b(e)484 b(pro)-31 b(vide)485 b(are)f(passed)0 41827 y(along)371 b(to)f Fk(init)p Fn(:)0 44179 y Fk(>>>)582 b(currentTime)g(=)g(Time\(9,)g(14,)f(30\))0 45534 y(>>>)h (currentTime.printTime\(\))0 46889 y(>>>)g(9:14:30)0 49242 y Fn(Because)369 b(the)h(parameters)f(are)g(optional,)k(w)-31 b(e)369 b(can)h(omit)h(them:)0 51594 y Fk(>>>)582 b(currentTime)g(=)g (Time\(\))0 52949 y(>>>)g(currentTime.printTime\(\))0 54304 y(>>>)g(0:0:0)0 56657 y Fn(Or)369 b(pro)-31 b(vide)369 b(only)i(the)e(\257rst)g(parameter:)p eop %%Page: 151 177 151 176 bop 0 -2070 a Fv(14.7)425 b(P)-35 b(oin)g(ts)425 b(revisited)24901 b(151)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(currentTime)g(=)g(Time)f(\(9\))0 2220 y(>>>)h (currentTime.printTime\(\))0 3575 y(>>>)g(9:0:0)0 5815 y Fn(Or)369 b(the)g(\257rst)g(t)-31 b(w)g(o)371 b(parameters:)0 8055 y Fk(>>>)582 b(currentTime)g(=)g(Time)f(\(9,)h(14\))0 9410 y(>>>)g(currentTime.printTime\(\))0 10765 y(>>>)g(9:14:0)0 13005 y Fn(Finally)-92 b(,)371 b(w)-31 b(e)370 b(can)f(pro)-31 b(vide)370 b(a)g(subset)e(of)i(the)f(parameters)h(b)-31 b(y)369 b(naming)i(them)f(explicitly:)0 15245 y Fk(>>>)582 b(currentTime)g(=)g(Time\(seconds)h(=)e(30,)h(hours)f(=)h(9\))0 16600 y(>>>)g(currentTime.printTime\(\))0 17955 y(>>>)g(9:0:30)0 22538 y Fl(14.7)1792 b(P)-50 b(oin)g(ts)599 b(revisited)0 25030 y Fn(Let's)366 b(rewrite)g(the)g Fk(Point)h Fn(class)f(from)g (Section)h(12.1)h(in)e(a)g(more)g(ob)61 b(ject-orien)-31 b(ted)369 b(st)-31 b(yle:)0 27270 y Fk(class)582 b(Point:)1162 28625 y(def)g(__init__\(self,)h(x=0,)f(y=0\):)2325 29980 y(self.x)g(=)f(x)2325 31335 y(self.y)h(=)f(y)1162 34045 y(def)h(__str__\(self\):)2325 35400 y(return)g('\(')f(+)h (str\(self.x\))g(+)g(',)f(')g(+)h(str\(self.y\))g(+)g('\)')0 37640 y Fn(The)539 b(initialization)544 b(metho)31 b(d)540 b(tak)-31 b(es)540 b Fg(x)e Fn(and)h Fg(y)579 b Fn(v)-61 b(alues)539 b(as)f(optional)k(parameters;)625 b(the)0 38995 y(default)371 b(for)e(either)g(parameter)h(is)f(0.)0 41154 y(The)359 b(next)g(metho)31 b(d,)p 9142 41154 349 45 v 9560 41154 V 1199 w Fk(str)p 11722 41154 V 12141 41154 V 837 w Fn(,)362 b(returns)357 b(a)i(string)g(represen)-31 b(tation)360 b(of)f(a)g Fk(Point)h Fn(ob)61 b(ject.)490 b(If)0 42509 y(a)441 b(class)h(pro)-31 b(vides)441 b(a)h(metho)31 b(d)442 b(named)p 16912 42509 V 17331 42509 V 1278 w Fk(str)p 19492 42509 V 19911 42509 V 838 w Fn(,)459 b(it)442 b(o)-31 b(v)g(errides)441 b(the)h(default)g(b)31 b(eha)-31 b(vior)442 b(of)0 43864 y(the)369 b(Python)i(built-in)g Fk(str)e Fn(function.)0 46104 y Fk(>>>)582 b(p)f(=)g(Point\(3,)i(4\))0 47458 y(>>>)f(str\(p\))0 48813 y('\(3,)g(4\)')0 51053 y Fn(Prin)-31 b(ting)498 b(a)e Fk(Point)g Fn(ob)61 b(ject)498 b(implicitly)h(in)-31 b(v)g(ok)g(es)p 21533 51053 V 21952 51053 V 1334 w Fk(str)p 24113 51053 V 24532 51053 V 1334 w Fn(on)496 b(the)g(ob)61 b(ject,)529 b(so)496 b(de\257ning)p 0 52408 V 418 52408 V 767 52408 a Fk(str)p 2580 52408 V 2999 52408 V 1206 w Fn(also)370 b(c)-31 b(hanges)370 b(the)g(b)31 b(eha)-31 b(vior)370 b(of)g Fk(print)p Fn(:)0 54648 y Fk(>>>)582 b(p)f(=)g(Point\(3,)i(4\))0 56003 y(>>>)f(print)f(p)0 57358 y(\(3,)h(4\))p eop %%Page: 152 178 152 177 bop 0 -2070 a Fv(152)24691 b(Classes)425 b(and)f(metho)35 b(ds)p 0 -1627 38191 45 v 0 865 a Fn(When)382 b(w)-31 b(e)382 b(write)h(a)f(new)h(class,)j(w)-31 b(e)382 b(almost)i(alw)-31 b(a)g(ys)384 b(start)f(b)-31 b(y)382 b(writing)p 30771 865 349 45 v 31189 865 V 1221 w Fk(init)p 33932 865 V 34351 865 V 837 w Fn(,)k(whic)-31 b(h)0 2220 y(mak)g(es)307 b(it)g(easier)f(to)g(instan)-31 b(tiate)309 b(ob)61 b(jects,)321 b(and)p 20270 2220 V 20688 2220 V 1143 w Fk(str)p 22850 2220 V 23268 2220 V 837 w Fn(,)e(whic)-31 b(h)307 b(is)f(almost)i(alw) -31 b(a)g(ys)308 b(useful)0 3575 y(for)369 b(debugging.)0 8045 y Fl(14.8)1792 b(Op)50 b(erator)599 b(o)-50 b(v)g(erloading)0 10514 y Fn(Some)249 b(languages)i(mak)-31 b(e)250 b(it)f(p)31 b(ossible)249 b(to)h(c)-31 b(hange)250 b(the)f(de\257nition)h(of)f(the) g(built-in)i(op)31 b(erators)0 11869 y(when)443 b(they)g(are)f(applied) i(to)g(user-de\257ned)d(t)-31 b(yp)31 b(es.)713 b(This)443 b(feature)g(is)g(called)h Fv(op)35 b(erator)0 13224 y(o)-35 b(v)g(erloading)p Fn(.)493 b(It)370 b(is)f(esp)31 b(ecially)370 b(useful)f(when)h(de\257ning)g(new)f(mathematical)k(t)-31 b(yp)31 b(es.)0 15360 y(F)-92 b(or)391 b(example,)398 b(to)392 b(o)-31 b(v)g(erride)392 b(the)g(addition)h(op)31 b(erator)392 b Fk(+)p Fn(,)397 b(w)-31 b(e)392 b(pro)-31 b(vide)392 b(a)g(metho)31 b(d)392 b(named)p 0 16715 V 418 16715 V 767 16715 a Fk(add)p 2580 16715 V 2999 16715 V 837 w Fn(:)0 18932 y Fk(class)582 b(Point:)1162 20287 y(#)g(previously)g(defined)g(methods)h(here...)1162 22997 y(def)f(__add__\(self,)h(other\):)2325 24351 y(return)f(Point\(self.x)h (+)e(other.x,)h(self.y)g(+)g(other.y\))0 26568 y Fn(As)321 b(usual,)332 b(the)322 b(\257rst)f(parameter)i(is)e(the)h(ob)61 b(ject)323 b(on)f(whic)-31 b(h)323 b(the)f(metho)31 b(d)322 b(is)g(in)-31 b(v)g(ok)g(ed.)479 b(The)0 27923 y(second)362 b(parameter)i(is)e(con)-31 b(v)g(enien)g(tly)366 b(named)d Fk(other)g Fn(to)h(distinguish)g(it)f(from)h Fk(self)p Fn(.)490 b(T)-92 b(o)0 29278 y(add)318 b(t)-31 b(w)g(o)319 b Fk(Point)p Fn(s,)328 b(w)-31 b(e)318 b(create)g(and)g(return)f(a)g (new)h Fk(Point)g Fn(that)h(con)-31 b(tains)319 b(the)e(sum)h(of)g(the) 0 30633 y Fg(x)369 b Fn(co)31 b(ordinates)370 b(and)f(the)h(sum)f(of)h (the)f Fg(y)408 b Fn(co)31 b(ordinates.)0 32769 y(No)-31 b(w,)371 b(when)e(w)-31 b(e)370 b(apply)g(the)g Fk(+)f Fn(op)31 b(erator)369 b(to)h Fk(Point)g Fn(ob)61 b(jects,)371 b(Python)f(in)-31 b(v)g(ok)g(es)p 34278 32769 V 34696 32769 V 1208 w Fk(add)p 36858 32769 V 37277 32769 V 837 w Fn(:)0 34986 y Fk(>>>)1744 b(p1)581 b(=)h(Point\(3,)g(4\))0 36341 y(>>>)1744 b(p2)581 b(=)h(Point\(5,)g(7\))0 37696 y(>>>)1744 b(p3)581 b(=)h(p1)f(+)g(p2)0 39051 y(>>>)1744 b(print)582 b(p3)0 40406 y(\(8,)g(11\))0 42622 y Fn(The)470 b(expression)g Fk(p1)581 b(+)g(p2)470 b Fn(is)g(equiv)-61 b(alen)-31 b(t)472 b(to)e Fk(p1.)p 22188 42622 V 22607 42622 V 838 w(add)p 24769 42622 V 25187 42622 V 837 w(\(p2\))p Fn(,)496 b(but)470 b(ob)-31 b(viously)472 b(more)0 43977 y(elegan)-31 b(t.)2767 46539 y Fm(As)393 b(an)h(exer)-57 b(cise,)395 b(add)d(a)h(metho)-57 b(d)p 17439 46539 V 17858 46539 V 1231 w Fk(sub)p 20020 46539 V 20438 46539 V 837 w(\(self,)582 b(other\))394 b Fm(that)f(overlo)-57 b(ads)2767 47894 y(the)396 b(subtr)-57 b(action)396 b(op)-57 b(er)g(ator,)396 b(and)g(try)g(it)h(out.)0 50456 y Fn(There)382 b(are)h(sev)-31 b(eral)383 b(w)-31 b(a)g(ys)384 b(to)f(o)-31 b(v)g(erride)383 b(the)g(b)31 b(eha)-31 b(vior)383 b(of)h(the)e(m)-31 b(ultiplication)388 b(op)31 b(erator:)0 51811 y(b)-31 b(y)369 b(de\257ning)h(a)g(metho)31 b(d)370 b(named)p 14307 51811 V 14725 51811 V 1207 w Fk(mul)p 16887 51811 V 17305 51811 V 837 w Fn(,)f(or)p 19756 51811 V 20175 51811 V 1206 w Fk(rmul)p 22917 51811 V 23336 51811 V 838 w Fn(,)g(or)g(b)31 b(oth.)0 53947 y(If)355 b(the)h(left)g(op)31 b(erand)355 b(of)h Fk(*)f Fn(is)h(a)f Fk(Point)p Fn(,)k(Python)e(in)-31 b(v)g(ok)g(es)p 24747 53947 V 25165 53947 V 1194 w Fk(mul)p 27327 53947 V 27745 53947 V 837 w Fn(,)358 b(whic)-31 b(h)357 b(assumes)e(that)0 55302 y(the)445 b(other)g(op)31 b(erand)445 b(is)g(also)g(a)g Fk(Point)p Fn(.)720 b(It)445 b(computes)h(the)f Fv(dot)512 b(pro)35 b(duct)446 b Fn(of)f(the)g(t)-31 b(w)g(o)0 56657 y(p)31 b(oin)-31 b(ts,)371 b(de\257ned)d(according)j (to)f(the)f(rules)g(of)h(linear)f(algebra:)p eop %%Page: 153 179 153 178 bop 0 -2070 a Fv(14.9)425 b(P)-35 b(olymorphism)25545 b(153)p 0 -1627 38191 45 v 0 865 a Fk(def)582 b(__mul__\(self,)h (other\):)1162 2220 y(return)f(self.x)g(*)g(other.x)g(+)f(self.y)h(*)g (other.y)0 4572 y Fn(If)445 b(the)h(left)h(op)31 b(erand)446 b(of)g Fk(*)g Fn(is)f(a)h(primitiv)-31 b(e)448 b(t)-31 b(yp)31 b(e)446 b(and)g(the)g(righ)-31 b(t)447 b(op)31 b(erand)445 b(is)h(a)g Fk(Point)p Fn(,)0 5927 y(Python)370 b(in)-31 b(v)g(ok)g(es)p 7840 5927 349 45 v 8258 5927 V 1208 w Fk(rmul)p 11001 5927 V 11420 5927 V 838 w Fn(,)369 b(whic)-31 b(h)370 b(p)31 b(erforms)369 b Fv(scalar)424 b(m)-35 b(ultiplication)p Fn(:)0 8279 y Fk(def)582 b(__rmul__\(self,)h (other\):)1162 9634 y(return)f(Point\(other)h(*)e(self.x,)1164 b(other)582 b(*)f(self.y\))0 11985 y Fn(The)538 b(result)g(is)g(a)g (new)g Fk(Point)g Fn(whose)g(co)31 b(ordinates)539 b(are)f(a)g(m)-31 b(ultiple)540 b(of)f(the)f(original)0 13340 y(co)31 b(ordinates.)751 b(If)454 b Fk(other)i Fn(is)e(a)i(t)-31 b(yp)31 b(e)455 b(that)h(cannot)g(b)31 b(e)454 b(m)-31 b(ultiplied)458 b(b)-31 b(y)455 b(a)g(\260oating-p)31 b(oin)-31 b(t)0 14695 y(n)g(um)g(b)31 b(er,)370 b(then)p 6930 14695 V 7348 14695 V 1206 w Fk(rmul)p 10091 14695 V 10510 14695 V 1206 w Fn(will)h(yield)f(an)g(error.)0 16966 y(This)g(example)g (demonstrates)g(b)31 b(oth)370 b(kinds)f(of)h(m)-31 b(ultiplication:)0 19318 y Fk(>>>)582 b(p1)f(=)g(Point\(3,)i(4\))0 20673 y(>>>)f(p2)f(=)g(Point\(5,)i(7\))0 22028 y(>>>)f(print)f(p1)h(*)f(p2)0 23383 y(43)0 24738 y(>>>)h(print)f(2)h(*)f(p2)0 26092 y(\(10,)h(14\))0 28444 y Fn(What)506 b(happ)31 b(ens)505 b(if)i(w)-31 b(e)506 b(try)g(to)g(ev)-61 b(aluate)507 b Fk(p2)582 b(*)f(2)p Fn(?)901 b(Since)506 b(the)g(\257rst)g(parameter) g(is)g(a)0 29799 y Fk(Point)p Fn(,)408 b(Python)400 b(in)-31 b(v)g(ok)g(es)p 11520 29799 V 11938 29799 V 1238 w Fk(mul)p 14100 29799 V 14519 29799 V 1236 w Fn(with)401 b Fk(2)e Fn(as)g(the)g(second)g(argumen)-31 b(t.)585 b(Inside)p 34535 29799 V 34954 29799 V 1235 w Fk(mul)p 37115 29799 V 37534 29799 V 838 w Fn(,)0 31154 y(the)435 b(program)g(tries)g(to)g (access)f(the)h Fk(x)g Fn(co)31 b(ordinate)436 b(of)f Fk(other)p Fn(,)452 b(whic)-31 b(h)436 b(fails)f(b)31 b(ecause)435 b(an)0 32509 y(in)-31 b(teger)370 b(has)f(no)h (attributes:)0 34861 y Fk(>>>)582 b(print)f(p2)h(*)f(2)0 36216 y(AttributeError:)i('int')f(object)g(has)g(no)f(attribute)i('x')0 38568 y Fn(Unfortunately)-92 b(,)442 b(the)425 b(error)f(message)i(is)f (a)g(bit)h(opaque.)662 b(This)425 b(example)i(demonstrates)0 39923 y(some)438 b(of)h(the)f(di\261culties)h(of)g(ob)61 b(ject-orien)-31 b(ted)440 b(programming.)701 b(Sometimes)440 b(it)e(is)g(hard)0 41277 y(enough)370 b(just)f(to)h(\257gure)f(out)h (what)g(co)31 b(de)370 b(is)f(running.)0 43548 y(F)-92 b(or)368 b(a)i(more)f(complete)i(example)g(of)e(op)31 b(erator)370 b(o)-31 b(v)g(erloading,)373 b(see)368 b(App)31 b(endix)370 b(B.)0 48376 y Fl(14.9)1792 b(P)-50 b(olymorphism)0 51023 y Fn(Most)383 b(of)g(the)g(metho)31 b(ds)384 b(w)-31 b(e)383 b(ha)-31 b(v)g(e)384 b(written)g(only)g(w)-31 b(ork)383 b(for)g(a)g(sp)31 b(eci\257c)383 b(t)-31 b(yp)31 b(e.)534 b(When)382 b(y)-31 b(ou)0 52378 y(create)369 b(a)h(new)f(ob)61 b(ject,)371 b(y)-31 b(ou)370 b(write)g(metho)31 b(ds)370 b(that)h(op)31 b(erate)369 b(on)h(that)g(t)-31 b(yp)31 b(e.)0 54648 y(But)284 b(there)f(are)g(certain)h(op)31 b(erations)285 b(that)f(y)-31 b(ou)285 b(will)g(w)-31 b(an)g(t)285 b(to)f(apply)g(to)h(man)-31 b(y)284 b(t)-31 b(yp)31 b(es,)301 b(suc)-31 b(h)0 56003 y(as)310 b(the)g(arithmetic)i (op)31 b(erations)312 b(in)e(the)g(previous)g(sections.)474 b(If)310 b(man)-31 b(y)311 b(t)-31 b(yp)31 b(es)310 b(supp)31 b(ort)310 b(the)0 57358 y(same)315 b(set)f(of)i(op)31 b(erations,)327 b(y)-31 b(ou)315 b(can)g(write)g(functions)h(that)g(w) -31 b(ork)315 b(on)g(an)-31 b(y)315 b(of)g(those)g(t)-31 b(yp)31 b(es.)p eop %%Page: 154 180 154 179 bop 0 -2070 a Fv(154)24691 b(Classes)425 b(and)f(metho)35 b(ds)p 0 -1627 38191 45 v 0 865 a Fn(F)-92 b(or)367 b(example,)i(the)f Fk(multadd)g Fn(op)31 b(eration)369 b(\(whic)-31 b(h)369 b(is)f(common)h(in)f(linear)g(algebra\))h(tak)-31 b(es)0 2220 y(three)428 b(parameters;)458 b(it)429 b(m)-31 b(ultiplies)431 b(the)d(\257rst)g(t)-31 b(w)g(o)430 b(and)e(then)g(adds)g(the)h(third.) 669 b(W)-92 b(e)428 b(can)0 3575 y(write)370 b(it)g(in)f(Python)i(lik) -31 b(e)370 b(this:)0 5653 y Fk(def)582 b(multadd)g(\(x,)f(y,)h(z\):) 1162 7008 y(return)g(x)g(*)f(y)g(+)h(z)0 9085 y Fn(This)355 b(metho)31 b(d)356 b(will)g(w)-31 b(ork)356 b(for)f(an)-31 b(y)355 b(v)-61 b(alues)355 b(of)g Fk(x)g Fn(and)g Fk(y)g Fn(that)h(can)f(b)31 b(e)354 b(m)-31 b(ultiplied)358 b(and)d(for)0 10440 y(an)-31 b(y)370 b(v)-61 b(alue)370 b(of)f Fk(z)g Fn(that)i(can)e(b)31 b(e)369 b(added)g(to)h(the)g(pro)31 b(duct.)0 12437 y(W)-92 b(e)368 b(can)i(in)-31 b(v)g(ok)g(e)371 b(it)f(with)g(n)-31 b(umeric)370 b(v)-61 b(alues:)0 14514 y Fk(>>>)582 b(multadd)g(\(3,)f(2,)h(1\))0 15869 y(7)0 17947 y Fn(Or)369 b(with)h Fk(Point)p Fn(s:)0 20024 y Fk(>>>)582 b(p1)f(=)g(Point\(3,)i(4\))0 21379 y(>>>)f(p2)f(=)g (Point\(5,)i(7\))0 22734 y(>>>)f(print)f(multadd)i(\(2,)e(p1,)h(p2\))0 24089 y(\(11,)g(15\))0 25444 y(>>>)g(print)f(multadd)i(\(p1,)e(p2,)h (1\))0 26799 y(44)0 28877 y Fn(In)357 b(the)h(\257rst)f(case,)j(the)e Fk(Point)g Fn(is)f(m)-31 b(ultiplied)361 b(b)-31 b(y)358 b(a)g(scalar)g(and)f(then)h(added)g(to)g(another)0 30231 y Fk(Point)p Fn(.)490 b(In)357 b(the)i(second)f(case,)j(the)d(dot)h (pro)31 b(duct)358 b(yields)h(a)g(n)-31 b(umeric)359 b(v)-61 b(alue,)361 b(so)d(the)h(third)0 31586 y(parameter)370 b(also)g(has)f(to)h(b)31 b(e)369 b(a)g(n)-31 b(umeric)370 b(v)-61 b(alue.)0 33583 y(A)553 b(function)i(lik)-31 b(e)555 b(this)f(that)g(can)g(tak)-31 b(e)555 b(parameters)e(with)i (di\256eren)-31 b(t)554 b(t)-31 b(yp)31 b(es)553 b(is)h(called)0 34938 y Fv(p)35 b(olymorphic)p Fn(.)0 36934 y(As)483 b(another)i(example,)514 b(consider)484 b(the)g(metho)31 b(d)484 b Fk(frontAndBack)p Fn(,)515 b(whic)-31 b(h)484 b(prin)-31 b(ts)484 b(a)g(list)0 38289 y(t)-31 b(wice,)371 b(forw)-31 b(ard)370 b(and)g(bac)-31 b(kw)g(ard:)0 40367 y Fk(def)582 b(frontAndBack\(front\):)1162 41722 y(import)g(copy)1162 43077 y(back)g(=)f(copy.copy\(front\))1162 44432 y(back.reverse\(\)) 1162 45787 y(print)h(str\(front\))h(+)e(str\(back\))0 47864 y Fn(Because)433 b(the)f Fk(reverse)i Fn(metho)31 b(d)433 b(is)g(a)g(mo)31 b(di\257er,)449 b(w)-31 b(e)434 b(mak)-31 b(e)433 b(a)g(cop)-31 b(y)434 b(of)f(the)g(list)g(b)31 b(efore)0 49219 y(rev)-31 b(ersing)376 b(it.)513 b(That)377 b(w)-31 b(a)g(y)-92 b(,)379 b(this)d(metho)31 b(d)377 b(do)31 b(esn't)377 b(mo)31 b(dify)377 b(the)f(list)h(it)f(gets)g(as)g (a)g(param-)0 50574 y(eter.)0 52571 y(Here's)369 b(an)g(example)i(that) f(applies)g Fk(frontAndBack)h Fn(to)f(a)g(list:)0 54648 y Fk(>>>)1744 b(myList)582 b(=)f([1,)h(2,)f(3,)h(4])0 56003 y(>>>)1744 b(frontAndBack\(myList\))0 57358 y([1,)582 b(2,)f(3,)g(4][4,)h(3,)g(2,)f(1])p eop %%Page: 155 181 155 180 bop 0 -2070 a Fv(14.10)426 b(Glossary)28147 b(155)p 0 -1627 38191 45 v 0 865 a Fn(Of)317 b(course,)327 b(w)-31 b(e)317 b(in)-31 b(tended)318 b(to)f(apply)h(this)f(function)h(to)g (lists,)328 b(so)317 b(it)g(is)g(not)g(surprising)g(that)0 2220 y(it)370 b(w)-31 b(orks.)493 b(What)370 b(w)-31 b(ould)370 b(b)31 b(e)369 b(surprising)g(is)g(if)h(w)-31 b(e)369 b(could)h(apply)g(it)g(to)g(a)g Fk(Point)p Fn(.)0 4412 y(T)-92 b(o)434 b(determine)g(whether)g(a)g(function)h(can)e(b)31 b(e)433 b(applied)i(to)f(a)g(new)g(t)-31 b(yp)31 b(e,)450 b(w)-31 b(e)434 b(apply)h(the)0 5767 y(fundamen)-31 b(tal)372 b(rule)d(of)g(p)31 b(olymorphism:)2767 8464 y Fv(If)504 b(all)g(of)g(the)h(op)35 b(erations)507 b(inside)d(the)h(function)g (can)f(b)35 b(e)506 b(applied)2767 9819 y(to)425 b(the)g(t)-35 b(yp)35 b(e,)425 b(the)g(function)g(can)f(b)35 b(e)425 b(applied)g(to)g(the)g(t)-35 b(yp)35 b(e.)0 12516 y Fn(The)369 b(op)31 b(erations)371 b(in)e(the)h(metho)31 b(d)370 b(include)g Fk(copy)p Fn(,)g Fk(reverse)p Fn(,)g(and)g Fk(print)p Fn(.)0 14708 y Fk(copy)436 b Fn(w)-31 b(orks)436 b(on)g(an)-31 b(y)437 b(ob)61 b(ject,)454 b(and)436 b(w)-31 b(e)436 b(ha)-31 b(v)g(e)437 b(already)g(written)g(a)p 28987 14708 349 45 v 29406 14708 V 1272 w Fk(str)p 31567 14708 V 31986 14708 V 1273 w Fn(metho)31 b(d)437 b(for)0 16063 y Fk(Point)p Fn(s,)370 b(so)f(all)h(w)-31 b(e)370 b(need)f(is)g(a)h Fk(reverse)g Fn(metho)31 b(d)370 b(in)f(the)h Fk(Point)f Fn(class:)0 18336 y Fk(def)582 b(reverse\(self\):)1162 19691 y(self.x)g(,)g(self.y)g(=)f(self.y,)h(self.x)0 21964 y Fn(Then)369 b(w)-31 b(e)370 b(can)g(pass)e Fk(Point)p Fn(s)i(to)g Fk(frontAndBack)p Fn(:)0 24237 y Fk(>>>)1744 b(p)581 b(=)g(Point\(3,)i(4\))0 25592 y(>>>)1744 b(frontAndBack\(p\))0 26947 y(\(3,)582 b(4\)\(4,)f(3\))0 29220 y Fn(The)440 b(b)31 b(est)440 b(kind)g(of)h(p)31 b(olymorphism)442 b(is)d(the)i(unin)-31 b(ten)g(tional)443 b(kind,)459 b(where)440 b(y)-31 b(ou)440 b(disco)-31 b(v)g(er)0 30575 y(that)327 b(a)f(function)g(y)-31 b(ou)327 b(ha)-31 b(v)g(e)326 b(already)h(written)g(can)e(b)31 b(e)325 b(applied)i(to)f(a)g(t)-31 b(yp)31 b(e)326 b(for)g(whic)-31 b(h)326 b(y)-31 b(ou)0 31930 y(nev)g(er)369 b(planned.)0 36521 y Fl(14.10)1792 b(Glossary)0 38713 y Fv(ob)71 b(ject-orien)-35 b(ted)427 b(language:)554 b Fn(A)412 b(language)j(that)f(pro)-31 b(vides)413 b(features,)424 b(suc)-31 b(h)412 b(as)g(user-)2767 40068 y(de\257ned)488 b(classes)g(and)g(inheritance,)519 b(that)489 b(facilitate)j(ob)61 b(ject-orien)-31 b(ted)490 b(program-)2767 41423 y(ming.)0 43713 y Fv(ob)71 b(ject-orien)-35 b(ted)427 b(programming:)554 b Fn(A)415 b(st)-31 b(yle)416 b(of)f(programming)j(in)d(whic)-31 b(h)416 b(data)g(and)2767 45068 y(the)338 b(op)31 b(erations)339 b(that)g(manipulate)h(it)e(are)f (organized)i(in)-31 b(to)339 b(classes)e(and)h(metho)31 b(ds.)0 47358 y Fv(metho)k(d:)555 b Fn(A)382 b(function)i(that)f(is)f (de\257ned)g(inside)g(a)h(class)f(de\257nition)i(and)e(is)h(in)-31 b(v)g(ok)g(ed)384 b(on)2767 48713 y(instances)370 b(of)g(that)g(class.) 0 51003 y Fv(o)-35 b(v)g(erride:)554 b Fn(T)-92 b(o)269 b(replace)f(a)g(default.)461 b(Examples)269 b(include)g(replacing)g(a)g (default)g(parameter)2767 52358 y(with)397 b(a)f(particular)g(argumen) -31 b(t)397 b(and)e(replacing)i(a)f(default)g(metho)31 b(d)397 b(b)-31 b(y)395 b(pro)-31 b(viding)2767 53713 y(a)370 b(new)f(metho)31 b(d)370 b(with)h(the)e(same)h(name.)0 56003 y Fv(initialization)422 b(metho)35 b(d:)555 b Fn(A)340 b(sp)31 b(ecial)341 b(metho)31 b(d)340 b(that)h(is)f(in)-31 b(v)g(ok)g(ed)342 b(automatically)j(when)2767 57358 y(a)370 b(new)f(ob)61 b(ject)371 b(is)e(created)g(and)h(that)g(initializes)i (the)e(ob)61 b(ject's)370 b(attributes.)p eop %%Page: 156 182 156 181 bop 0 -2070 a Fv(156)24691 b(Classes)425 b(and)f(metho)35 b(ds)p 0 -1627 38191 45 v 0 865 a(op)g(erator)427 b(o)-35 b(v)g(erloading:)554 b Fn(Extending)470 b(built-in)g(op)31 b(erators)468 b(\()p Fk(+)p Fn(,)494 b Fk(-)p Fn(,)f Fk(*)p Fn(,)h Fk(>)p Fn(,)f Fk(<)p Fn(,)h(etc.\))790 b(so)2767 2220 y(that)371 b(they)e(w)-31 b(ork)370 b(with)h (user-de\257ned)d(t)-31 b(yp)31 b(es.)0 4461 y Fv(dot)425 b(pro)35 b(duct:)555 b Fn(An)247 b(op)31 b(eration)249 b(de\257ned)e(in)g(linear)h(algebra)h(that)f(m)-31 b(ultiplies)250 b(t)-31 b(w)g(o)249 b Fk(Point)p Fn(s)2767 5815 y(and)370 b(yields)g(a)f(n)-31 b(umeric)370 b(v)-61 b(alue.)0 8056 y Fv(scalar)424 b(m)-35 b(ultiplication:)551 b Fn(An)371 b(op)31 b(eration)373 b(de\257ned)d(in)h(linear)h(algebra)g(that)g(m) -31 b(ultiplies)2767 9411 y(eac)g(h)370 b(of)g(the)f(co)31 b(ordinates)370 b(of)g(a)g Fk(Point)f Fn(b)-31 b(y)370 b(a)f(n)-31 b(umeric)370 b(v)-61 b(alue.)0 11651 y Fv(p)35 b(olymorphic:)554 b Fn(A)395 b(function)i(that)g(can)f(op)31 b(erate)396 b(on)f(more)h(than)g(one)g(t)-31 b(yp)31 b(e.)572 b(If)395 b(all)i(the)2767 13006 y(op)31 b(erations)414 b(in)f(a)g(function)h(can)f(b)31 b(e)412 b(applied)h(to)h(a)f(t)-31 b(yp)31 b(e,)424 b(then)413 b(the)g(function)h(can)2767 14361 y(b)31 b(e)369 b(applied)h(to)g(a)g(t)-31 b(yp)31 b(e.)p eop %%Page: 157 183 157 182 bop 0 9891 a Fi(Chapter)861 b(15)0 16162 y Fo(Sets)1033 b(of)g(ob)172 b(jects)0 23291 y Fl(15.1)1792 b(Comp)50 b(osition)0 25648 y Fn(By)352 b(no)-31 b(w,)357 b(y)-31 b(ou)353 b(ha)-31 b(v)g(e)354 b(seen)d(sev)-31 b(eral)353 b(examples)g(of)g(comp)31 b(osition.)489 b(One)352 b(of)h(the)f (\257rst)g(exam-)0 27003 y(ples)370 b(w)-31 b(as)371 b(using)g(a)f(metho)31 b(d)371 b(in)-31 b(v)g(o)31 b(cation)374 b(as)c(part)h(of)f(an)h(expression.)496 b(Another)371 b(example)0 28358 y(is)478 b(the)g(nested)g(structure)g(of)g(statemen) -31 b(ts;)535 b(y)-31 b(ou)479 b(can)f(put)g(an)h Fk(if)f Fn(statemen)-31 b(t)480 b(within)g(a)0 29713 y Fk(while)370 b Fn(lo)31 b(op,)370 b(within)h(another)f Fk(if)f Fn(statemen)-31 b(t,)372 b(and)e(so)f(on.)0 31736 y(Ha)-31 b(ving)291 b(seen)d(this)g(pattern,)306 b(and)289 b(ha)-31 b(ving)291 b(learned)d(ab)31 b(out)290 b(lists)f(and)g(ob)61 b(jects,)306 b(y)-31 b(ou)290 b(should)0 33091 y(not)h(b)31 b(e)290 b(surprised)f(to)i(learn)g(that)h(y)-31 b(ou)291 b(can)g(create)f (lists)h(of)g(ob)61 b(jects.)468 b(Y)-92 b(ou)291 b(can)f(also)i (create)0 34446 y(ob)61 b(jects)368 b(that)f(con)-31 b(tain)369 b(lists)e(\(as)g(attributes\);)j(y)-31 b(ou)367 b(can)g(create)g(lists)g(that)g(con)-31 b(tain)369 b(lists;)0 35801 y(y)-31 b(ou)370 b(can)f(create)h(ob)61 b(jects)370 b(that)h(con)-31 b(tain)371 b(ob)61 b(jects;)370 b(and)g(so)f(on.)0 37825 y(In)390 b(this)i(c)-31 b(hapter)391 b(and)h(the)f(next,)397 b(w)-31 b(e)392 b(will)g(lo)31 b(ok)393 b(at)e(some)h(examples)g(of)f (these)g(com)-31 b(bina-)0 39180 y(tions,)371 b(using)e Fk(Card)h Fn(ob)61 b(jects)370 b(as)f(an)g(example.)0 43493 y Fl(15.2)1792 b Fe(Card)599 b Fl(ob)100 b(jects)0 45850 y Fn(If)293 b(y)-31 b(ou)294 b(are)f(not)h(familiar)i(with)f (common)g(pla)-31 b(ying)295 b(cards,)309 b(no)-31 b(w)294 b(w)-31 b(ould)295 b(b)31 b(e)293 b(a)h(go)31 b(o)g(d)294 b(time)g(to)0 47205 y(get)346 b(a)g(dec)-31 b(k,)350 b(or)c(else)f(this)g(c)-31 b(hapter)346 b(migh)-31 b(t)348 b(not)e(mak)-31 b(e)346 b(m)-31 b(uc)g(h)346 b(sense.)484 b(There)345 b(are)g(\257ft)-31 b(y-t)g(w)g(o)0 48560 y(cards)402 b(in)i(a)f(dec)-31 b(k,)412 b(eac)-31 b(h)404 b(of)f(whic)-31 b(h)404 b(b)31 b(elongs)404 b(to)g(one)f(of)h(four)f (suits)g(and)g(one)h(of)f(thirteen)0 49915 y(ranks.)476 b(The)320 b(suits)g(are)g(Spades,)330 b(Hearts,)g(Diamonds,)h(and)320 b(Clubs)h(\(in)f(descending)h(order)0 51270 y(in)371 b(bridge\).)497 b(The)371 b(ranks)f(are)h(Ace,)g(2,)g(3,)h(4,)g(5,)f (6,)h(7,)g(8,)f(9,)h(10,)g(Jac)-31 b(k,)372 b(Queen,)f(and)g(King.)0 52625 y(Dep)31 b(ending)437 b(on)f(the)h(game)h(that)f(y)-31 b(ou)438 b(are)e(pla)-31 b(ying,)456 b(the)437 b(rank)f(of)h(Ace)g(ma) -31 b(y)438 b(b)31 b(e)436 b(higher)0 53979 y(than)370 b(King)g(or)f(lo)-31 b(w)g(er)370 b(than)g(2.)0 56003 y(If)506 b(w)-31 b(e)507 b(w)-31 b(an)g(t)508 b(to)g(de\257ne)e(a)h (new)f(ob)61 b(ject)508 b(to)g(represen)-31 b(t)505 b(a)i(pla)-31 b(ying)509 b(card,)541 b(it)507 b(is)g(ob)-31 b(vious)0 57358 y(what)397 b(the)f(attributes)h(should)f(b)31 b(e:)546 b Fk(rank)396 b Fn(and)g Fk(suit)p Fn(.)573 b(It)395 b(is)h(not)h(as)e(ob)-31 b(vious)397 b(what)g(t)-31 b(yp)31 b(e)p eop %%Page: 158 184 158 183 bop 0 -2070 a Fv(158)28170 b(Sets)425 b(of)g(ob)71 b(jects)p 0 -1627 38191 45 v 0 865 a Fn(the)364 b(attributes)h(should)e (b)31 b(e.)491 b(One)363 b(p)31 b(ossibilit)-31 b(y)366 b(is)d(to)h(use)f(strings)h(con)-31 b(taining)366 b(w)-31 b(ords)364 b(lik)-31 b(e)0 2220 y Fk("Spade")263 b Fn(for)g(suits)g (and)g Fk("Queen")g Fn(for)g(ranks.)457 b(One)262 b(problem)i(with)g (this)f(implemen)-31 b(tation)0 3575 y(is)336 b(that)h(it)g(w)-31 b(ould)338 b(not)f(b)31 b(e)335 b(easy)h(to)h(compare)g(cards)f(to)g (see)g(whic)-31 b(h)337 b(had)f(a)h(higher)f(rank)g(or)0 4930 y(suit.)0 7439 y(An)389 b(alternativ)-31 b(e)392 b(is)d(to)h(use)f(in)-31 b(tegers)390 b(to)g Fv(enco)35 b(de)391 b Fn(the)f(ranks)f(and)g(suits.)553 b(By)390 b(\\enco)31 b(de,")0 8794 y(w)-31 b(e)394 b(do)f(not)h(mean)g(what)g (some)g(p)31 b(eople)393 b(think,)401 b(whic)-31 b(h)394 b(is)f(to)h(encrypt)f(or)g(translate)h(in)-31 b(to)0 10149 y(a)465 b(secret)g(co)31 b(de.)780 b(What)466 b(a)f(computer)h (scien)-31 b(tist)467 b(means)e(b)-31 b(y)465 b(\\enco)31 b(de")466 b(is)f(\\to)i(de\257ne)e(a)0 11504 y(mapping)455 b(b)31 b(et)-31 b(w)g(een)455 b(a)e(sequence)g(of)h(n)-31 b(um)g(b)31 b(ers)454 b(and)f(the)h(items)g(I)f(w)-31 b(an)g(t)455 b(to)g(represen)-31 b(t.")0 12859 y(F)-92 b(or)368 b(example:)664 16341 y(Spades)2851 b Fj(7!)1328 b Fn(3)664 17696 y(Hearts)3002 b Fj(7!)1328 b Fn(2)664 19051 y(Diamonds)i Fj(7!)e Fn(1)664 20406 y(Clubs)3405 b Fj(7!)1328 b Fn(0)0 22684 y(An)414 b(ob)-31 b(vious)415 b(feature)g(of)f(this)h(mapping)g(is)f(that)h(the)g(suits)f(map)g(to)h (in)-31 b(tegers)415 b(in)f(order,)0 24039 y(so)330 b(w)-31 b(e)330 b(can)g(compare)h(suits)e(b)-31 b(y)330 b(comparing)i(in)-31 b(tegers.)480 b(The)330 b(mapping)i(for)d(ranks)h(is)g(fairly)0 25394 y(ob)-31 b(vious;)338 b(eac)-31 b(h)320 b(of)h(the)f(n)-31 b(umerical)321 b(ranks)f(maps)g(to)h(the)f(corresp)31 b(onding)320 b(in)-31 b(teger,)331 b(and)320 b(for)0 26749 y(face)370 b(cards:)664 30015 y(Jac)-31 b(k)2236 b Fj(7!)1329 b Fn(11)664 31370 y(Queen)f Fj(7!)h Fn(12)664 32725 y(King)2067 b Fj(7!)1329 b Fn(13)0 35003 y(The)333 b(reason)f(w)-31 b(e)333 b(are)g(using)g(mathematical)j(notation)f(for) e(these)f(mappings)i(is)f(that)g(they)0 36358 y(are)365 b(not)i(part)f(of)g(the)g(Python)h(program.)492 b(They)366 b(are)g(part)g(of)g(the)g(program)g(design,)i(but)0 37713 y(they)361 b(nev)-31 b(er)361 b(app)31 b(ear)361 b(explicitly)j(in)d (the)g(co)31 b(de.)490 b(The)361 b(class)g(de\257nition)i(for)e(the)g Fk(Card)g Fn(t)-31 b(yp)31 b(e)0 39068 y(lo)g(oks)370 b(lik)-31 b(e)370 b(this:)0 41658 y Fk(class)582 b(Card:)1162 43013 y(def)g(__init__\(self,)h(suit=0,)f(rank=0\):)2325 44368 y(self.suit)g(=)f(suit)2325 45723 y(self.rank)h(=)f(rank)0 48313 y Fn(As)346 b(usual,)352 b(w)-31 b(e)348 b(pro)-31 b(vide)347 b(an)g(initialization)352 b(metho)31 b(d)347 b(that)h(tak)-31 b(es)348 b(an)f(optional)i(parameter)0 49668 y(for)369 b(eac)-31 b(h)370 b(attribute.)0 52178 y(T)-92 b(o)370 b(create)f(an)h(ob)61 b(ject)370 b(that)h(represen)-31 b(ts)368 b(the)h(3)h(of)f(Clubs,)h(use)f(this)g(command:)0 54768 y Fk(threeOfClubs)583 b(=)e(Card\(0,)h(3\))0 57358 y Fn(The)369 b(\257rst)g(argumen)-31 b(t,)371 b Fk(0)p Fn(,)f(represen)-31 b(ts)368 b(the)h(suit)h(Clubs.)p eop %%Page: 159 185 159 184 bop 0 -2070 a Fv(15.3)425 b(Class)g(attributes)g(and)g(the)p 16651 -2070 349 45 v 17070 -2070 V 1262 w Fk(str)p 19232 -2070 V 19650 -2070 V 1261 w Fv(metho)35 b(d)11634 b(159)p 0 -1627 38191 45 v 0 865 a Fl(15.3)1792 b(Class)599 b(attributes)h(and) e(the)p 24639 865 493 45 v 25230 865 V 1780 w Fe(str)p 28280 865 V 28872 865 V 1780 w Fl(metho)50 b(d)0 3178 y Fn(In)447 b(order)f(to)i(prin)-31 b(t)447 b Fk(Card)h Fn(ob)61 b(jects)448 b(in)f(a)g(w)-31 b(a)g(y)449 b(that)f(p)31 b(eople)448 b(can)f(easily)h(read,)467 b(w)-31 b(e)447 b(w)-31 b(an)g(t)0 4533 y(to)462 b(map)f(the)g(in)-31 b(teger)462 b(co)31 b(des)461 b(on)-31 b(to)462 b(w)-31 b(ords.)768 b(A)461 b(natural)h(w)-31 b(a)g(y)463 b(to)e(do)g(that)h (is)f(with)h(lists)0 5888 y(of)483 b(strings.)831 b(W)-92 b(e)482 b(assign)g(these)g(lists)h(to)g Fv(class)554 b(attributes)483 b Fn(at)g(the)f(top)h(of)g(the)f(class)0 7243 y(de\257nition:)0 9304 y Fk(class)582 b(Card:)1162 10659 y(suitList)h(=)e(["Clubs",)h("Diamonds",)h("Hearts",)g("Spades"]) 1162 12014 y(rankList)g(=)e(["narf",)h("Ace",)g("2",)g("3",)g("4",)g ("5",)f("6",)h("7",)8136 13369 y("8",)g("9",)g("10",)f("Jack",)i ("Queen",)f("King"])1162 16078 y(#init)g(method)g(omitted)1162 18788 y(def)g(__str__\(self\):)2325 20143 y(return)g (\(self.rankList[self.rank])j(+)c(")g(of)h(")f(+)6974 21498 y(self.suitList[self.suit]\))0 23559 y Fn(A)359 b(class)h(attribute)h(is)e(de\257ned)g(outside)h(of)g(an)-31 b(y)360 b(metho)31 b(d,)363 b(and)d(it)g(can)g(b)31 b(e)359 b(accessed)f(from)0 24914 y(an)-31 b(y)370 b(of)g(the)f(metho)31 b(ds)370 b(in)f(the)h(class.)0 26893 y(Inside)p 3657 26893 349 45 v 4075 26893 V 1558 w Fk(str)p 6237 26893 V 6656 26893 V 837 w Fn(,)811 b(w)-31 b(e)722 b(can)g(use)f Fk(suitList)h Fn(and)g Fk(rankList)h Fn(to)g(map)f(the)g(n)-31 b(umer-)0 28248 y(ical)763 b(v)-61 b(alues)761 b(of)h Fk(suit)g Fn(and)f Fk(rank)h Fn(to)g(strings.)1670 b(F)-92 b(or)760 b(example,)862 b(the)761 b(expression)0 29603 y Fk(self.suitList[self.suit])527 b Fn(means)d(\\use)g(the)g(attribute) h Fk(suit)f Fn(from)h(the)e(ob)61 b(ject)0 30958 y Fk(self)421 b Fn(as)g(an)g(index)h(in)-31 b(to)422 b(the)f(class)g(attribute)i (named)f Fk(suitList)p Fn(,)435 b(and)421 b(select)g(the)h(ap-)0 32313 y(propriate)370 b(string.")0 34293 y(The)k(reason)f(for)h(the)g Fk("narf")g Fn(in)g(the)g(\257rst)f(elemen)-31 b(t)375 b(in)f Fk(rankList)h Fn(is)e(to)h(act)h(as)e(a)h(place)0 35647 y(k)-31 b(eep)31 b(er)396 b(for)g(the)g(zero-eth)g(elemen)-31 b(t)398 b(of)e(the)h(list,)404 b(whic)-31 b(h)397 b(will)h(nev)-31 b(er)395 b(b)31 b(e)396 b(used.)573 b(The)396 b(only)0 37002 y(v)-61 b(alid)424 b(ranks)e(are)h(1)g(to)h(13.)654 b(This)423 b(w)-31 b(asted)424 b(item)g(is)f(not)g(en)-31 b(tirely)425 b(necessary)-92 b(.)652 b(W)-92 b(e)422 b(could)0 38357 y(ha)-31 b(v)g(e)355 b(started)g(at)g(0,)j(as)c(usual,) k(but)c(it)h(is)f(less)g(confusing)h(to)g(enco)31 b(de)354 b(2)g(as)g(2,)k(3)d(as)f(3,)k(and)0 39712 y(so)369 b(on.)0 41692 y(With)h(the)f(metho)31 b(ds)370 b(w)-31 b(e)370 b(ha)-31 b(v)g(e)370 b(so)f(far,)h(w)-31 b(e)369 b(can)h(create)f(and)h (prin)-31 b(t)369 b(cards:)0 43752 y Fk(>>>)582 b(card1)f(=)h(Card\(1,) g(11\))0 45107 y(>>>)g(print)f(card1)0 46462 y(Jack)h(of)f(Diamonds)0 48523 y Fn(Class)419 b(attributes)h(lik)-31 b(e)420 b Fk(suitList)g Fn(are)e(shared)g(b)-31 b(y)419 b(all)h Fk(Card)f Fn(ob)61 b(jects.)642 b(The)419 b(adv)-61 b(an)-31 b(tage)0 49878 y(of)370 b(this)f(is)g(that)i(w)-31 b(e)370 b(can)f(use)g(an)-31 b(y)369 b Fk(Card)h Fn(ob)61 b(ject)371 b(to)f(access)e(the)i(class)f(attributes:)0 51938 y Fk(>>>)582 b(card2)f(=)h(Card\(1,)g(3\))0 53293 y(>>>)g(print)f(card2)0 54648 y(3)g(of)h(Diamonds)0 56003 y(>>>)g(print)f(card2.suitList[1])0 57358 y(Diamonds)p eop %%Page: 160 186 160 185 bop 0 -2070 a Fv(160)28170 b(Sets)425 b(of)g(ob)71 b(jects)p 0 -1627 38191 45 v 0 865 a Fn(The)335 b(disadv)-61 b(an)-31 b(tage)337 b(is)d(that)i(if)f(w)-31 b(e)335 b(mo)31 b(dify)336 b(a)f(class)g(attribute,)343 b(it)336 b(a\256ects)e(ev)-31 b(ery)335 b(instance)0 2220 y(of)411 b(the)g(class.)616 b(F)-92 b(or)410 b(example,)423 b(if)411 b(w)-31 b(e)411 b(decide)g(that)g(\\Jac)-31 b(k)412 b(of)f(Diamonds")h (should)f(really)0 3575 y(b)31 b(e)369 b(called)h(\\Jac)-31 b(k)370 b(of)g(Swirly)g(Whales,")h(w)-31 b(e)369 b(could)h(do)g(this:)0 5926 y Fk(>>>)582 b(card1.suitList[1])h(=)f("Swirly)g(Whales")0 7281 y(>>>)g(print)f(card1)0 8636 y(Jack)h(of)f(Swirly)h(Whales)0 10986 y Fn(The)369 b(problem)h(is)f(that)i Fm(al)57 b(l)368 b Fn(of)i(the)f(Diamonds)h(just)g(b)31 b(ecame)369 b(Swirly)h(Whales:)0 13337 y Fk(>>>)582 b(print)f(card2)0 14692 y(3)g(of)h(Swirly)g(Whales)0 17043 y Fn(It)369 b(is)g(usually)i(not)f(a)f(go)31 b(o)g(d)370 b(idea)g(to)g(mo)31 b(dify)370 b(class)g(attributes.)0 21868 y Fl(15.4)1792 b(Comparing)599 b(cards)0 24513 y Fn(F)-92 b(or)277 b(primitiv)-31 b(e)281 b(t)-31 b(yp)31 b(es,)297 b(there)277 b(are)h(conditional)k(op)31 b(erators)278 b(\()p Fk(<)p Fn(,)297 b Fk(>)p Fn(,)g Fk(==)p Fn(,)g(etc.\))463 b(that)279 b(compare)0 25868 y(v)-61 b(alues)394 b(and)f(determine)i (when)e(one)h(is)g(greater)g(than,)400 b(less)394 b(than,)400 b(or)394 b(equal)g(to)h(another.)0 27223 y(F)-92 b(or)312 b(user-de\257ned)f(t)-31 b(yp)31 b(es,)324 b(w)-31 b(e)313 b(can)g(o)-31 b(v)g(erride)313 b(the)f(b)31 b(eha)-31 b(vior)314 b(of)e(the)h(built-in)h(op)31 b(erators)313 b(b)-31 b(y)0 28578 y(pro)g(viding)396 b(a)e(metho)31 b(d)395 b(named)p 13609 28578 349 45 v 14027 28578 V 1231 w Fk(cmp)p 16189 28578 V 16608 28578 V 837 w Fn(.)567 b(By)394 b(con)-31 b(v)g(en)g(tion,)p 25535 28578 V 25953 28578 V 1240 w Fk(cmp)p 28115 28578 V 28533 28578 V 1231 w Fn(tak)g(es)395 b(t)-31 b(w)g(o)395 b(parame-)0 29933 y(ters,)330 b Fk(self)320 b Fn(and)g Fk(other)p Fn(,)331 b(and)320 b(returns)f(1)h(if)g(the)g(\257rst)g(ob)61 b(ject)321 b(is)f(greater,)330 b(-1)321 b(if)f(the)g(second)0 31288 y(ob)61 b(ject)371 b(is)e(greater,)h(and)f(0)h(if)f(they)h(are)f (equal)h(to)g(eac)-31 b(h)370 b(other.)0 33557 y(Some)308 b(t)-31 b(yp)31 b(es)307 b(are)g(completely)j(ordered,)319 b(whic)-31 b(h)308 b(means)g(that)g(y)-31 b(ou)308 b(can)f(compare)h (an)-31 b(y)308 b(t)-31 b(w)g(o)0 34912 y(elemen)g(ts)432 b(and)f(tell)h(whic)-31 b(h)432 b(is)f(bigger.)678 b(F)-92 b(or)431 b(example,)448 b(the)431 b(in)-31 b(tegers)431 b(and)h(the)f(\260oating-)0 36267 y(p)31 b(oin)-31 b(t)394 b(n)-31 b(um)g(b)31 b(ers)393 b(are)g(completely)i(ordered.)564 b(Some)393 b(sets)g(are)g(unordered,)399 b(whic)-31 b(h)394 b(means)0 37622 y(that)340 b(there)e(is)h(no)g(meaningful)i(w)-31 b(a)g(y)340 b(to)f(sa)-31 b(y)339 b(that)h(one)f(elemen)-31 b(t)340 b(is)f(bigger)g(than)h(another.)0 38977 y(F)-92 b(or)329 b(example,)340 b(the)331 b(fruits)f(are)g(unordered,)338 b(whic)-31 b(h)331 b(is)f(wh)-31 b(y)331 b(y)-31 b(ou)331 b(cannot)h(compare)f(apples)0 40332 y(and)369 b(oranges.)0 42602 y(The)388 b(set)g(of)g(pla)-31 b(ying)390 b(cards)d(is)h (partially)i(ordered,)i(whic)-31 b(h)389 b(means)f(that)h(sometimes)g (y)-31 b(ou)0 43957 y(can)447 b(compare)h(cards)e(and)i(sometimes)g (not.)727 b(F)-92 b(or)446 b(example,)469 b(y)-31 b(ou)447 b(kno)-31 b(w)449 b(that)f(the)f(3)g(of)0 45312 y(Clubs)391 b(is)f(higher)h(than)h(the)e(2)h(of)g(Clubs,)397 b(and)391 b(the)g(3)g(of)g(Diamonds)g(is)g(higher)f(than)i(the)0 46667 y(3)361 b(of)g(Clubs.)491 b(But)361 b(whic)-31 b(h)362 b(is)e(b)31 b(etter,)363 b(the)f(3)f(of)g(Clubs)g(or)g(the)g(2) g(of)g(Diamonds?)490 b(One)361 b(has)0 48022 y(a)369 b(higher)h(rank,)g(but)f(the)h(other)f(has)g(a)h(higher)f(suit.)0 50291 y(In)287 b(order)g(to)h(mak)-31 b(e)289 b(cards)e(comparable,)306 b(y)-31 b(ou)288 b(ha)-31 b(v)g(e)289 b(to)f(decide)g(whic)-31 b(h)288 b(is)f(more)h(imp)31 b(ortan)-31 b(t,)0 51646 y(rank)350 b(or)h(suit.)487 b(T)-92 b(o)350 b(b)31 b(e)350 b(honest,)355 b(the)c(c)-31 b(hoice)351 b(is)g(arbitrary)-92 b(.)486 b(F)-92 b(or)350 b(the)h(sak)-31 b(e)351 b(of)f(c)-31 b(ho)31 b(osing,)356 b(w)-31 b(e)0 53001 y(will)371 b(sa)-31 b(y)370 b(that)h(suit)f(is)g(more)g(imp)31 b(ortan)-31 b(t,)372 b(b)31 b(ecause)369 b(a)h(new)g(dec)-31 b(k)370 b(of)g(cards)f(comes)h(sorted)0 54356 y(with)g(all)h(the)e(Clubs)h (together,)h(follo)-31 b(w)g(ed)372 b(b)-31 b(y)369 b(all)i(the)e (Diamonds,)i(and)e(so)g(on.)0 56626 y(With)h(that)g(decided,)g(w)-31 b(e)370 b(can)f(write)p 16124 56626 V 16542 56626 V 1207 w Fk(cmp)p 18704 56626 V 19122 56626 V 837 w Fn(:)p eop %%Page: 161 187 161 186 bop 0 -2070 a Fv(15.5)425 b(Dec)-35 b(ks)30330 b(161)p 0 -1627 38191 45 v 0 865 a Fk(def)582 b(__cmp__\(self,)h (other\):)1162 2220 y(#)f(check)f(the)h(suits)1162 3575 y(if)g(self.suit)g(>)g(other.suit:)g(return)g(1)1162 4930 y(if)g(self.suit)g(<)g(other.suit:)g(return)g(-1)1162 6285 y(#)g(suits)f(are)h(the)g(same...)g(check)g(ranks)1162 7640 y(if)g(self.rank)g(>)g(other.rank:)g(return)g(1)1162 8995 y(if)g(self.rank)g(<)g(other.rank:)g(return)g(-1)1162 10350 y(#)g(ranks)f(are)h(the)g(same...)g(it's)g(a)f(tie)1162 11705 y(return)h(0)0 13722 y Fn(In)369 b(this)g(ordering,)h(Aces)f(app) 31 b(ear)369 b(lo)-31 b(w)g(er)371 b(than)f(Deuces)e(\(2s\).)2767 15716 y Fm(As)429 b(an)h(exer)-57 b(cise,)438 b(mo)-57 b(dify)p 14315 15716 349 45 v 14733 15716 V 1268 w Fk(cmp)p 16895 15716 V 17314 15716 V 1267 w Fm(so)428 b(that)h(A)-57 b(c)g(es)430 b(ar)-57 b(e)429 b(r)-57 b(anke)g(d)431 b(higher)e(than)2767 17070 y(Kings.)0 21262 y Fl(15.5)1792 b(Dec)-50 b(ks)0 23532 y Fn(No)-31 b(w)388 b(that)g(w)-31 b(e)388 b(ha)-31 b(v)g(e)387 b(ob)61 b(jects)388 b(to)g(represen)-31 b(t)386 b Fk(Card)p Fn(s,)392 b(the)387 b(next)g(logical)j(step)d(is)g (to)g(de\257ne)0 24887 y(a)337 b(class)f(to)h(represen)-31 b(t)336 b(a)g Fk(Deck)p Fn(.)483 b(Of)336 b(course,)343 b(a)336 b(dec)-31 b(k)337 b(is)f(made)h(up)g(of)g(cards,)342 b(so)337 b(eac)-31 b(h)337 b Fk(Deck)0 26242 y Fn(ob)61 b(ject)371 b(will)g(con)-31 b(tain)371 b(a)e(list)h(of)g(cards)f(as)g (an)g(attribute.)0 28179 y(The)f(follo)-31 b(wing)370 b(is)e(a)f(class)h(de\257nition)g(for)g(the)f Fk(Deck)h Fn(class.)492 b(The)368 b(initialization)k(metho)31 b(d)0 29534 y(creates)369 b(the)h(attribute)g Fk(cards)g Fn(and)g(generates)f (the)h(standard)f(set)g(of)h(\257ft)-31 b(y-t)g(w)g(o)372 b(cards:)0 31552 y Fk(class)582 b(Deck:)1162 32906 y(def)g (__init__\(self\):)2325 34261 y(self.cards)g(=)g([])2325 35616 y(for)f(suit)h(in)f(range\(4\):)3487 36971 y(for)g(rank)h(in)g (range\(1,)g(14\):)4649 38326 y(self.cards.append\(Card\(suit,)k (rank\)\))0 40344 y Fn(The)475 b(easiest)h(w)-31 b(a)g(y)476 b(to)g(p)31 b(opulate)477 b(the)e(dec)-31 b(k)475 b(is)g(with)i(a)e (nested)g(lo)31 b(op.)811 b(The)476 b(outer)f(lo)31 b(op)0 41699 y(en)-31 b(umerates)289 b(the)g(suits)f(from)h(0)g(to)h(3.)466 b(The)288 b(inner)h(lo)31 b(op)289 b(en)-31 b(umerates)289 b(the)g(ranks)f(from)h(1)g(to)0 43054 y(13.)481 b(Since)334 b(the)f(outer)h(lo)31 b(op)334 b(iterates)g(four)f(times,)342 b(and)333 b(the)h(inner)f(lo)31 b(op)334 b(iterates)g(thirteen)0 44409 y(times,)309 b(the)292 b(total)i(n)-31 b(um)g(b)31 b(er)292 b(of)g(times)h(the)f(b)31 b(o)g(dy)292 b(is)f(executed)i(is)e (\257ft)-31 b(y-t)g(w)g(o)295 b(\(thirteen)e(times)0 45764 y(four\).)572 b(Eac)-31 b(h)396 b(iteration)i(creates)d(a)h(new)g (instance)g(of)g Fk(Card)g Fn(with)g(the)g(curren)-31 b(t)395 b(suit)h(and)0 47119 y(rank,)370 b(and)f(app)31 b(ends)369 b(that)h(card)f(to)h(the)g Fk(cards)f Fn(list.)0 49055 y(The)g Fk(append)h Fn(metho)31 b(d)370 b(w)-31 b(orks)370 b(on)f(lists)h(but)g(not,)g(of)g(course,)f(tuples.)0 53247 y Fl(15.6)1792 b(Prin)-50 b(ting)600 b(the)e(dec)-50 b(k)0 55517 y Fn(As)424 b(usual,)439 b(when)424 b(w)-31 b(e)425 b(de\257ne)f(a)g(new)h(t)-31 b(yp)31 b(e)425 b(of)f(ob)61 b(ject)426 b(w)-31 b(e)425 b(w)-31 b(an)g(t)426 b(a)e(metho)31 b(d)425 b(that)h(prin)-31 b(ts)0 56872 y(the)397 b(con)-31 b(ten)g(ts)398 b(of)f(an)g(ob)61 b(ject.)576 b(T)-92 b(o)397 b(prin)-31 b(t)398 b(a)f Fk(Deck)p Fn(,)404 b(w)-31 b(e)397 b(tra)-31 b(v)g(erse)397 b(the)g(list)g(and)g(prin)-31 b(t)397 b(eac)-31 b(h)0 58227 y Fk(Card)p Fn(:)p eop %%Page: 162 188 162 187 bop 0 -2070 a Fv(162)28170 b(Sets)425 b(of)g(ob)71 b(jects)p 0 -1627 38191 45 v 0 865 a Fk(class)582 b(Deck:)1162 2220 y(...)1162 3575 y(def)g(printDeck\(self\):)2325 4930 y(for)f(card)h(in)f(self.cards:)3487 6285 y(print)h(card)0 8655 y Fn(Here,)442 b(and)428 b(from)h(no)-31 b(w)428 b(on,)443 b(the)428 b(ellipsis)h(\()p Fk(...)p Fn(\))669 b(indicates)429 b(that)g(w)-31 b(e)428 b(ha)-31 b(v)g(e)429 b(omitted)h(the)0 10010 y(other)369 b(metho)31 b(ds)370 b(in)g(the)f(class.)0 12299 y(As)380 b(an)g(alternativ)-31 b(e)383 b(to)d Fk(printDeck)p Fn(,)385 b(w)-31 b(e)380 b(could)h(write)g(a)p 24477 12299 349 45 v 24895 12299 V 1217 w Fk(str)p 27057 12299 V 27476 12299 V 1217 w Fn(metho)31 b(d)381 b(for)f(the)h Fk(Deck)0 13654 y Fn(class.)808 b(The)475 b(adv)-61 b(an)-31 b(tage)476 b(of)p 12490 13654 V 12909 13654 V 1312 w Fk(str)p 15070 13654 V 15489 13654 V 1312 w Fn(is)e(that)i(it)f(is)f(more)h(\260exible.)809 b(Rather)475 b(than)g(just)0 15009 y(prin)-31 b(ting)509 b(the)f(con)-31 b(ten)g(ts)509 b(of)g(the)f(ob)61 b(ject,)544 b(it)508 b(generates)h(a)f(string)g(represen)-31 b(tation)509 b(that)0 16364 y(other)469 b(parts)f(of)h(the)g(program)h(can)f (manipulate)i(b)31 b(efore)468 b(prin)-31 b(ting,)496 b(or)468 b(store)g(for)h(later)0 17718 y(use.)0 20007 y(Here)263 b(is)g(a)g(v)-31 b(ersion)264 b(of)p 9213 20007 V 9632 20007 V 1100 w Fk(str)p 11793 20007 V 12212 20007 V 1100 w Fn(that)h(returns)d(a)h(string)h(represen)-31 b(tation)264 b(of)g(a)f Fk(Deck)p Fn(.)458 b(T)-92 b(o)264 b(add)0 21362 y(a)381 b(bit)g(of)h(pizzazz,)i(it)e(arranges)e(the)h (cards)f(in)h(a)g(cascade)g(where)g(eac)-31 b(h)381 b(card)f(is)h (inden)-31 b(ted)0 22717 y(one)369 b(space)g(more)h(than)g(the)f (previous)h(card:)0 25087 y Fk(class)582 b(Deck:)1162 26442 y(...)1162 27797 y(def)g(__str__\(self\):)2325 29152 y(s)f(=)g("")2325 30507 y(for)g(i)g(in)h (range\(len\(self.cards\)\):)3487 31862 y(s)f(=)g(s)h(+)f(")g("*i)h(+)f (str\(self.cards[i]\))j(+)d("\\n")2325 33217 y(return)h(s)0 35587 y Fn(This)706 b(example)i(demonstrates)f(sev)-31 b(eral)706 b(features.)1504 b(First,)790 b(instead)707 b(of)g(tra)-31 b(v)g(ersing)0 36942 y Fk(self.cards)493 b Fn(and)g(assigning)h(eac)-31 b(h)492 b(card)g(to)h(a)g(v)-61 b(ariable,)524 b(w)-31 b(e)493 b(are)f(using)g Fk(i)g Fn(as)g(a)h(lo)31 b(op)0 38297 y(v)-61 b(ariable)370 b(and)g(an)f(index)h(in)-31 b(to)370 b(the)g(list)g(of)g(cards.)0 40586 y(Second,)395 b(w)-31 b(e)390 b(are)g(using)f(the)h(string)g(m) -31 b(ultiplication)395 b(op)31 b(erator)390 b(to)g(inden)-31 b(t)390 b(eac)-31 b(h)390 b(card)g(b)-31 b(y)0 41941 y(one)381 b(more)h(space)f(than)g(the)h(last.)529 b(The)381 b(expression)g Fk(")581 b("*i)382 b Fn(yields)f(a)h(n)-31 b(um)g(b)31 b(er)381 b(of)g(spaces)0 43296 y(equal)370 b(to)g(the)g(curren)-31 b(t)368 b(v)-61 b(alue)370 b(of)g Fk(i)p Fn(.)0 45585 y(Third,)382 b(instead)e(of)g(using)g(the)f Fk(print)h Fn(command)g(to)g(prin)-31 b(t)380 b(the)f(cards,)j(w)-31 b(e)380 b(use)e(the)i Fk(str)0 46940 y Fn(function.)482 b(P)-31 b(assing)332 b(an)g(ob)61 b(ject)333 b(as)e(an)h(argumen)-31 b(t)333 b(to)g Fk(str)e Fn(is)h(equiv)-61 b(alen)-31 b(t)333 b(to)f(in)-31 b(v)g(oking)335 b(the)p 0 48295 V 418 48295 V 767 48295 a Fk(str)p 2580 48295 V 2999 48295 V 1206 w Fn(metho)31 b(d)371 b(on)e(the)g(ob)61 b(ject.)0 50584 y(Finally)-92 b(,)305 b(w)-31 b(e)287 b(are)f(using)g(the)h(v)-61 b(ariable)287 b Fk(s)g Fn(as)f(an)g Fv(accum)-35 b(ulator)p Fn(.)465 b(Initially)-92 b(,)306 b Fk(s)286 b Fn(is)g(the)h(empt)-31 b(y)0 51938 y(string.)479 b(Eac)-31 b(h)327 b(time)h(through)f(the)f(lo)31 b(op,)337 b(a)326 b(new)h(string)g(is)f(generated)h(and)g(concatenated)0 53293 y(with)417 b(the)g(old)f(v)-61 b(alue)417 b(of)f Fk(s)g Fn(to)h(get)g(the)f(new)g(v)-61 b(alue.)634 b(When)416 b(the)g(lo)31 b(op)417 b(ends,)427 b Fk(s)416 b Fn(con)-31 b(tains)0 54648 y(the)369 b(complete)i(string)f(represen)-31 b(tation)370 b(of)g(the)f Fk(Deck)p Fn(,)h(whic)-31 b(h)371 b(lo)31 b(oks)370 b(lik)-31 b(e)370 b(this:)p eop %%Page: 163 189 163 188 bop 0 -2070 a Fv(15.7)425 b(Sh)-35 b(u\262ing)425 b(the)g(dec)-35 b(k)23622 b(163)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(deck)f(=)h(Deck\(\))0 2220 y(>>>)g(print)f(deck)0 3575 y(Ace)h(of)f(Clubs)581 4930 y(2)g(of)h(Clubs)1162 6285 y(3)g(of)f(Clubs)1743 7640 y(4)h(of)f(Clubs)2325 8995 y(5)g(of)g(Clubs)2906 10350 y(6)g(of)g(Clubs)3487 11705 y(7)g(of)h(Clubs)4068 13059 y(8)f(of)h(Clubs)4649 14414 y(9)f(of)h(Clubs)5230 15769 y(10)g(of)f(Clubs)5811 17124 y(Jack)h(of)g(Clubs)6393 18479 y(Queen)g(of)f(Clubs)6974 19834 y(King)h(of)f(Clubs)7555 21189 y(Ace)h(of)f(Diamonds)0 23911 y Fn(And)312 b(so)g(on.)474 b(Ev)-31 b(en)313 b(though)h(the)e (result)h(app)31 b(ears)311 b(on)i(52)g(lines,)325 b(it)313 b(is)f(one)g(long)i(string)f(that)0 25266 y(con)-31 b(tains)371 b(newlines.)0 31204 y Fl(15.7)1792 b(Sh)-50 b(u\262ing)599 b(the)g(dec)-50 b(k)0 34369 y Fn(If)304 b(a)h(dec)-31 b(k)305 b(is)f(p)31 b(erfectly)306 b(sh)-31 b(u\262ed,)318 b(then)304 b(an)-31 b(y)306 b(card)e(is)h(equally)h(lik)-31 b(ely)306 b(to)g(app)31 b(ear)304 b(an)-31 b(ywhere)0 35724 y(in)369 b(the)h(dec)-31 b(k,)370 b(and)f(an)-31 b(y)370 b(lo)31 b(cation)372 b(in)d(the)h(dec)-31 b(k)369 b(is)g(equally)i(lik)-31 b(ely)371 b(to)f(con)-31 b(tain)371 b(an)-31 b(y)370 b(card.)0 38365 y(T)-92 b(o)269 b(sh)-31 b(u\262e)268 b(the)h(dec)-31 b(k,)289 b(w)-31 b(e)269 b(will)h(use)d(the)i Fk(randrange)g Fn(function)h(from)f(the)g Fk(random)f Fn(mo)31 b(dule.)0 39720 y(With)402 b(t)-31 b(w)g(o)403 b(in)-31 b(teger)402 b(argumen)-31 b(ts,)412 b Fk(a)401 b Fn(and)h Fk(b)p Fn(,)409 b Fk(randrange)403 b Fn(c)-31 b(ho)31 b(oses)401 b(a)h(random)g(in)-31 b(teger)403 b(in)0 41075 y(the)448 b(range)g Fk(a)581 b(<=)h(x)f(<)h(b)p Fn(.)728 b(Since)448 b(the)g(upp)31 b(er)447 b(b)31 b(ound)448 b(is)g(strictly)h(less)e(than)h Fk(b)p Fn(,)468 b(w)-31 b(e)449 b(can)0 42430 y(use)392 b(the)i(length)g(of)f(a)h(list)f(as)g (the)h(second)e(parameter,)401 b(and)393 b(w)-31 b(e)393 b(are)g(guaran)-31 b(teed)394 b(to)g(get)0 43785 y(a)367 b(legal)i(index.)492 b(F)-92 b(or)366 b(example,)k(this)d(expression)f (c)-31 b(ho)31 b(oses)367 b(the)g(index)h(of)f(a)g(random)h(card)0 45140 y(in)h(a)h(dec)-31 b(k:)0 47862 y Fk(random.randrange\(0,)584 b(len\(self.cards\)\))0 50584 y Fn(An)425 b(easy)h(w)-31 b(a)g(y)426 b(to)g(sh)-31 b(u\262e)425 b(the)h(dec)-31 b(k)425 b(is)g(b)-31 b(y)426 b(tra)-31 b(v)g(ersing)426 b(the)g(cards)e(and)i(sw)-31 b(apping)426 b(eac)-31 b(h)0 51938 y(card)391 b(with)i(a)f(randomly)h(c)-31 b(hosen)392 b(one.)561 b(It)391 b(is)h(p)31 b(ossible)392 b(that)h(the)f(card)f (will)i(b)31 b(e)392 b(sw)-31 b(app)31 b(ed)0 53293 y(with)414 b(itself,)426 b(but)413 b(that)i(is)d(\257ne.)625 b(In)412 b(fact,)426 b(if)413 b(w)-31 b(e)414 b(precluded)f(that)h(p)31 b(ossibilit)-31 b(y)-92 b(,)426 b(the)414 b(order)0 54648 y(of)370 b(the)f(cards)g(w)-31 b(ould)370 b(b)31 b(e)369 b(less)g(than)h(en)-31 b(tirely)370 b(random:)p eop %%Page: 164 190 164 189 bop 0 -2070 a Fv(164)28170 b(Sets)425 b(of)g(ob)71 b(jects)p 0 -1627 38191 45 v 0 865 a Fk(class)582 b(Deck:)1162 2220 y(...)1162 3575 y(def)g(shuffle\(self\):)2325 4930 y(import)g(random)2325 6285 y(nCards)g(=)f(len\(self.cards\))2325 7640 y(for)g(i)g(in)h(range\(nCards\):)3487 8995 y(j)f(=)g (random.randrange\(i,)j(nCards\))3487 10350 y(self.cards[i],)f (self.cards[j])g(=)f(self.cards[j],)h(self.cards[i])0 12495 y Fn(Rather)321 b(than)h(assume)g(that)g(there)f(are)g(\257ft)-31 b(y-t)g(w)g(o)325 b(cards)320 b(in)i(the)f(dec)-31 b(k,)332 b(w)-31 b(e)322 b(get)g(the)f(actual)0 13850 y(length)370 b(of)g(the)g(list)g(and)f(store)g(it)h(in)g Fk(nCards)p Fn(.)0 15915 y(F)-92 b(or)342 b(eac)-31 b(h)344 b(card)f(in)h(the)f (dec)-31 b(k,)349 b(w)-31 b(e)344 b(c)-31 b(ho)31 b(ose)343 b(a)h(random)g(card)f(from)h(among)h(the)e(cards)g(that)0 17270 y(ha)-31 b(v)g(en't)362 b(b)31 b(een)359 b(sh)-31 b(u\262ed)360 b(y)-31 b(et.)490 b(Then)360 b(w)-31 b(e)360 b(sw)-31 b(ap)360 b(the)g(curren)-31 b(t)360 b(card)f(\()p Fk(i)p Fn(\))i(with)g(the)f(selected)0 18624 y(card)369 b(\()p Fk(j)p Fn(\).)494 b(T)-92 b(o)369 b(sw)-31 b(ap)370 b(the)g(cards)e(w)-31 b(e)370 b(use)e(a)i(tuple)g(assignmen)-31 b(t,)371 b(as)e(in)h(Section)g(9.2:)0 20770 y Fk(self.cards[i],)583 b(self.cards[j])g(=)f(self.cards[j],)h(self.cards[i])2767 23209 y Fm(As)508 b(an)g(exer)-57 b(cise,)538 b(r)-57 b(ewrite)508 b(this)g(line)h(of)g(c)-57 b(o)g(de)509 b(without)e(using)i(a)f(se)-57 b(quenc)g(e)2767 24564 y(assignment.)0 28934 y Fl(15.8)1792 b(Remo)-50 b(ving)599 b(and)f(dealing)g(cards)0 31332 y Fn(Another)388 b(metho)31 b(d)389 b(that)g(w)-31 b(ould)389 b(b)31 b(e)387 b(useful)h(for)g(the)g Fk(Deck)g Fn(class)g(is)g Fk(removeCard)p Fn(,)394 b(whic)-31 b(h)0 32687 y(tak)g(es)365 b(a)e(card)h(as)g(a)f(parameter,)k(remo)-31 b(v)g(es)364 b(it,)i(and)e(returns)e(true)i(\(1\))h(if)f(the)g(card)f (w)-31 b(as)365 b(in)0 34042 y(the)k(dec)-31 b(k)370 b(and)f(false)h(\(0\))h(otherwise:)0 36188 y Fk(class)582 b(Deck:)1162 37542 y(...)1162 38897 y(def)g(removeCard\(self,)h (card\):)2325 40252 y(if)e(card)h(in)f(self.cards:)3487 41607 y(self.cards.remove\(card\))3487 42962 y(return)h(1)2325 44317 y(else:)3487 45672 y(return)g(0)0 47818 y Fn(The)407 b Fk(in)g Fn(op)31 b(erator)408 b(returns)e(true)g(if)i(the)f(\257rst)f (op)31 b(erand)407 b(is)g(in)g(the)h(second,)416 b(whic)-31 b(h)408 b(m)-31 b(ust)0 49173 y(b)31 b(e)401 b(a)g(list)h(or)f(a)h (tuple.)589 b(If)401 b(the)h(\257rst)e(op)31 b(erand)401 b(is)h(an)f(ob)61 b(ject,)411 b(Python)403 b(uses)d(the)h(ob)61 b(ject's)p 0 50527 349 45 v 418 50527 V 767 50527 a Fk(cmp)p 2580 50527 V 2999 50527 V 1245 w Fn(metho)31 b(d)408 b(to)h(determine)f(equalit)-31 b(y)410 b(with)f(items)g(in)e(the)h (list.)609 b(Since)408 b(the)p 34843 50527 V 35261 50527 V 1245 w Fk(cmp)p 37423 50527 V 37841 50527 V 0 51882 a Fn(in)428 b(the)g Fk(Card)h Fn(class)f(c)-31 b(hec)g(ks)428 b(for)g(deep)f(equalit)-31 b(y)-92 b(,)446 b(the)428 b Fk(removeCard)h Fn(metho)31 b(d)429 b(c)-31 b(hec)g(ks)428 b(for)0 53237 y(deep)369 b(equalit)-31 b(y)-92 b(.)0 55302 y(T)g(o)323 b(deal)g(cards,)331 b(w)-31 b(e)323 b(w)-31 b(an)g(t)324 b(to)f(remo)-31 b(v)g(e)323 b(and)f(return)g(the)g (top)h(card.)477 b(The)322 b(list)i(metho)31 b(d)323 b Fk(pop)0 56657 y Fn(pro)-31 b(vides)370 b(a)f(con)-31 b(v)g(enien)g(t)371 b(w)-31 b(a)g(y)371 b(to)f(do)f(that:)p eop %%Page: 165 191 165 190 bop 0 -2070 a Fv(15.9)425 b(Glossary)28784 b(165)p 0 -1627 38191 45 v 0 865 a Fk(class)582 b(Deck:)1162 2220 y(...)1162 3575 y(def)g(popCard\(self\):)2325 4930 y(return)g(self.cards.pop\(\))0 7176 y Fn(Actually)-92 b(,)394 b Fk(pop)387 b Fn(remo)-31 b(v)g(es)388 b(the)f Fm(last)f Fn(card)h(in)g(the)h(list,)393 b(so)387 b(w)-31 b(e)387 b(are)g(in)h(e\256ect)f(dealing)h(from)0 8531 y(the)369 b(b)31 b(ottom)372 b(of)d(the)h(dec)-31 b(k.)0 10696 y(One)324 b(more)h(op)31 b(eration)327 b(that)f(w)-31 b(e)325 b(are)f(lik)-31 b(ely)327 b(to)f(w)-31 b(an)g(t)326 b(is)f(the)g(b)31 b(o)g(olean)325 b(function)i Fk(isEmpty)p Fn(,)0 12051 y(whic)-31 b(h)370 b(returns)e(true)h(if)h(the)f(dec)-31 b(k)370 b(con)-31 b(tains)371 b(no)e(cards:)0 14297 y Fk(class)582 b(Deck:)1162 15652 y(...)1162 17007 y(def)g (isEmpty\(self\):)2325 18362 y(return)g(\(len\(self.cards\))h(==)f(0\)) 0 22954 y Fl(15.9)1792 b(Glossary)0 25119 y Fv(enco)35 b(de:)555 b Fn(T)-92 b(o)294 b(represen)-31 b(t)293 b(one)h(set)f(of)h (v)-61 b(alues)294 b(using)g(another)g(set)g(of)g(v)-61 b(alues)294 b(b)-31 b(y)294 b(construct-)2767 26474 y(ing)370 b(a)g(mapping)h(b)31 b(et)-31 b(w)g(een)370 b(them.)0 28714 y Fv(class)424 b(attribute:)554 b Fn(A)329 b(v)-61 b(ariable)330 b(that)g(is)f(de\257ned)g(inside)g(a)h(class)f (de\257nition)i(but)e(outside)2767 30069 y(an)-31 b(y)356 b(metho)31 b(d.)489 b(Class)356 b(attributes)h(are)e(accessible)g(from) h(an)-31 b(y)356 b(metho)31 b(d)356 b(in)f(the)h(class)2767 31424 y(and)370 b(are)f(shared)f(b)-31 b(y)370 b(all)g(instances)g(of)g (the)f(class.)0 33665 y Fv(accum)-35 b(ulator:)553 b Fn(A)360 b(v)-61 b(ariable)361 b(used)f(in)g(a)h(lo)31 b(op)361 b(to)g(accum)-31 b(ulate)362 b(a)f(series)e(of)i(v)-61 b(alues,)362 b(suc)-31 b(h)2767 35020 y(as)337 b(b)-31 b(y)336 b(concatenating)k(them)d(on)-31 b(to)337 b(a)g(string)g(or)f (adding)h(them)g(to)g(a)g(running)g(sum.)p eop %%Page: 166 192 166 191 bop 0 -2070 a Fv(166)28170 b(Sets)425 b(of)g(ob)71 b(jects)p 0 -1627 38191 45 v eop %%Page: 167 193 167 192 bop 0 9795 a Fi(Chapter)861 b(16)0 15968 y Fo(Inheritance)0 23001 y Fl(16.1)1792 b(Inheritance)0 25261 y Fn(The)392 b(language)j(feature)e(most)g(often)g(asso)31 b(ciated)393 b(with)h(ob)61 b(ject-orien)-31 b(ted)395 b(programming)0 26616 y(is)284 b Fv(inheritance)p Fn(.)465 b(Inheritance)285 b(is)g(the)f(abilit)-31 b(y)288 b(to)d(de\257ne)f(a)h(new)g(class)f (that)i(is)e(a)h(mo)31 b(di\257ed)0 27971 y(v)-31 b(ersion)370 b(of)f(an)h(existing)h(class.)0 29898 y(The)433 b(primary)h(adv)-61 b(an)-31 b(tage)435 b(of)f(this)f(feature)h(is)f(that)h(y)-31 b(ou)434 b(can)f(add)h(new)f(metho)31 b(ds)434 b(to)g(a)0 31253 y(class)473 b(without)i(mo)31 b(difying)475 b(the)f(existing)g (class.)804 b(It)473 b(is)g(called)h(\\inheritance")h(b)31 b(ecause)0 32608 y(the)424 b(new)h(class)f(inherits)g(all)i(of)e(the)h (metho)31 b(ds)424 b(of)h(the)f(existing)i(class.)658 b(Extending)426 b(this)0 33963 y(metaphor,)522 b(the)491 b(existing)h(class)e(is)g(sometimes)i(called)g(the)e Fv(paren)-35 b(t)491 b Fn(class.)856 b(The)491 b(new)0 35318 y(class)369 b(ma)-31 b(y)371 b(b)31 b(e)368 b(called)j(the)e Fv(c)-35 b(hild)368 b Fn(class)h(or)g(sometimes)i(\\sub)31 b(class.")0 37245 y(Inheritance)449 b(is)g(a)g(p)31 b(o)-31 b(w)g(erful)450 b(feature.)733 b(Some)449 b(programs)h(that)g(w)-31 b(ould)450 b(b)31 b(e)448 b(complicated)0 38600 y(without)416 b(inheritance)e(can)g(b)31 b(e)413 b(written)i(concisely)f(and)g (simply)h(with)g(it.)626 b(Also,)426 b(inheri-)0 39955 y(tance)385 b(can)g(facilitate)j(co)31 b(de)384 b(reuse,)k(since)c(y) -31 b(ou)386 b(can)e(customize)i(the)f(b)31 b(eha)-31 b(vior)385 b(of)g(paren)-31 b(t)0 41310 y(classes)309 b(without)j(ha)-31 b(ving)311 b(to)f(mo)31 b(dify)311 b(them.)473 b(In)309 b(some)h(cases,)321 b(the)310 b(inheritance)g (structure)0 42665 y(re\260ects)419 b(the)h(natural)g(structure)f(of)h (the)g(problem,)433 b(whic)-31 b(h)421 b(mak)-31 b(es)420 b(the)g(program)g(easier)0 44020 y(to)370 b(understand.)0 45947 y(On)430 b(the)g(other)h(hand,)446 b(inheritance)432 b(can)e(mak)-31 b(e)432 b(programs)e(di\261cult)i(to)f(read.)676 b(When)430 b(a)0 47302 y(metho)31 b(d)432 b(is)f(in)-31 b(v)g(ok)g(ed,)450 b(it)432 b(is)f(sometimes)i(not)f(clear)f(where)g (to)h(\257nd)f(its)h(de\257nition.)681 b(The)0 48656 y(relev)-61 b(an)-31 b(t)270 b(co)31 b(de)269 b(ma)-31 b(y)270 b(b)31 b(e)268 b(scattered)h(among)i(sev)-31 b(eral)269 b(mo)31 b(dules.)460 b(Also,)290 b(man)-31 b(y)270 b(of)g(the)f(things)0 50011 y(that)276 b(can)f(b)31 b(e)275 b(done)g(using)g(inheritance)i(can)e(b)31 b(e)274 b(done)h(as)g(elegan)-31 b(tly)278 b(\(or)d(more)g(so\))h(without)0 51366 y(it.)690 b(If)434 b(the)h(natural)h(structure)e(of)h(the)g (problem)g(do)31 b(es)434 b(not)h(lend)g(itself)h(to)f(inheritance,)0 52721 y(this)370 b(st)-31 b(yle)370 b(of)f(programming)j(can)d(do)h (more)f(harm)h(than)g(go)31 b(o)g(d.)0 54648 y(In)355 b(this)g(c)-31 b(hapter)356 b(w)-31 b(e)355 b(will)i(demonstrate)g(the) e(use)g(of)g(inheritance)i(as)e(part)g(of)h(a)f(program)0 56003 y(that)310 b(pla)-31 b(ys)311 b(the)e(card)g(game)h(Old)g(Maid.) 473 b(One)309 b(of)h(our)f(goals)h(is)g(to)g(write)g(co)31 b(de)309 b(that)h(could)0 57358 y(b)31 b(e)369 b(reused)f(to)i (implemen)-31 b(t)371 b(other)f(card)f(games.)p eop %%Page: 168 194 168 193 bop 0 -2070 a Fv(168)29953 b(Inheritance)p 0 -1627 38191 45 v 0 865 a Fl(16.2)1792 b(A)598 b(hand)h(of)e(cards)0 3449 y Fn(F)-92 b(or)458 b(almost)i(an)-31 b(y)460 b(card)e(game,)483 b(w)-31 b(e)459 b(need)g(to)g(represen)-31 b(t)458 b(a)h(hand)g(of)g (cards.)761 b(A)458 b(hand)h(is)0 4804 y(similar)290 b(to)f(a)f(dec)-31 b(k,)306 b(of)288 b(course.)466 b(Both)289 b(are)f(made)h(up)f(of)h(a)f(set)h(of)g(cards,)304 b(and)289 b(b)31 b(oth)288 b(require)0 6159 y(op)31 b(erations)433 b(lik)-31 b(e)433 b(adding)g(and)g(remo)-31 b(ving)433 b(cards.)681 b(Also,)449 b(w)-31 b(e)432 b(migh)-31 b(t)434 b(lik)-31 b(e)433 b(the)f(abilit)-31 b(y)435 b(to)0 7514 y(sh)-31 b(u\262e)369 b(b)31 b(oth)370 b(dec)-31 b(ks)369 b(and)g(hands.)0 9740 y(A)377 b(hand)f(is)h(also)g(di\256eren)-31 b(t)377 b(from)g(a)g(dec)-31 b(k.)515 b(Dep)31 b(ending)377 b(on)f(the)h(game)h(b)31 b(eing)377 b(pla)-31 b(y)g(ed,)380 b(w)-31 b(e)0 11095 y(migh)g(t)417 b(w)-31 b(an)g(t)418 b(to)e(p)31 b(erform)415 b(some)h(op)31 b(erations)417 b(on)f(hands)f(that)i(don't)g(mak)-31 b(e)416 b(sense)f(for)h(a)0 12450 y(dec)-31 b(k.)583 b(F)-92 b(or)398 b(example,)409 b(in)399 b(p)31 b(ok)-31 b(er)399 b(w)-31 b(e)400 b(migh)-31 b(t)401 b(classify)f(a)g(hand)f(\(straigh)-31 b(t,)409 b(\260ush,)e(etc.\))583 b(or)0 13805 y(compare)326 b(it)g(with)h (another)f(hand.)478 b(In)325 b(bridge,)335 b(w)-31 b(e)326 b(migh)-31 b(t)327 b(w)-31 b(an)g(t)328 b(to)e(compute)g(a)g(score)f (for)0 15159 y(a)369 b(hand)h(in)f(order)g(to)h(mak)-31 b(e)370 b(a)g(bid.)0 17385 y(This)392 b(situation)h(suggests)f(the)f (use)g(of)h(inheritance.)560 b(If)391 b Fk(Hand)h Fn(is)f(a)h(sub)31 b(class)391 b(of)g Fk(Deck)p Fn(,)398 b(it)0 18740 y(will)371 b(ha)-31 b(v)g(e)370 b(all)h(the)e(metho)31 b(ds)370 b(of)f Fk(Deck)p Fn(,)h(and)g(new)f(metho)31 b(ds)370 b(can)g(b)31 b(e)368 b(added.)0 20966 y(In)h(the)g(class)g (de\257nition,)j(the)d(name)h(of)g(the)f(paren)-31 b(t)370 b(class)f(app)31 b(ears)369 b(in)g(paren)-31 b(theses:)0 23273 y Fk(class)582 b(Hand\(Deck\):)1162 24628 y(pass)0 26935 y Fn(This)293 b(statemen)-31 b(t)295 b(indicates)f(that)g(the)f (new)g Fk(Hand)h Fn(class)e(inherits)i(from)f(the)g(existing)i Fk(Deck)0 28290 y Fn(class.)0 30516 y(The)306 b Fk(Hand)g Fn(constructor)h(initializes)h(the)e(attributes)i(for)e(the)g(hand,)319 b(whic)-31 b(h)307 b(are)e Fk(name)i Fn(and)0 31871 y Fk(cards)p Fn(.)475 b(The)317 b(string)f Fk(name)g Fn(iden)-31 b(ti\257es)317 b(this)g(hand,)327 b(probably)317 b(b)-31 b(y)316 b(the)h(name)f(of)h(the)f(pla)-31 b(y)g(er)0 33226 y(that)434 b(holds)e(it.)684 b(The)432 b(name)h(is)g(an)f (optional)j(parameter)f(with)f(the)g(empt)-31 b(y)433 b(string)g(as)g(a)0 34581 y(default)446 b(v)-61 b(alue.)719 b Fk(cards)445 b Fn(is)f(the)h(list)h(of)f(cards)f(in)g(the)h(hand,)464 b(initialized)448 b(to)d(the)g(empt)-31 b(y)0 35936 y(list:)0 38243 y Fk(class)582 b(Hand\(Deck\):)1162 39598 y(def)g (__init__\(self,)h(name=""\):)2325 40953 y(self.cards)f(=)g([])2325 42308 y(self.name)g(=)f(name)0 44615 y Fn(F)-92 b(or)333 b(just)h(ab)31 b(out)334 b(an)-31 b(y)335 b(card)e(game,)343 b(it)334 b(is)g(necessary)f(to)h(add)g(and)g(remo)-31 b(v)g(e)334 b(cards)f(from)i(the)0 45970 y(dec)-31 b(k.)493 b(Remo)-31 b(ving)370 b(cards)e(is)g(already)h(tak)-31 b(en)370 b(care)e(of,)h(since)f Fk(Hand)h Fn(inherits)g Fk(removeCard)0 47324 y Fn(from)h Fk(Deck)p Fn(.)493 b(But)369 b(w)-31 b(e)370 b(ha)-31 b(v)g(e)370 b(to)g(write)g Fk(addCard)p Fn(:)0 49631 y Fk(class)582 b(Hand\(Deck\):)1162 50986 y(...)1162 52341 y(def)g(addCard\(self,card\))i(:)2325 53696 y(self.cards.append\(card\))0 56003 y Fn(Again,)k(the)544 b(ellipsis)g(indicates)g(that)g(w)-31 b(e)544 b(ha)-31 b(v)g(e)544 b(omitted)h(other)e(metho)31 b(ds.)1015 b(The)543 b(list)0 57358 y Fk(append)370 b Fn(metho)31 b(d)370 b(adds)f(the)g(new)h(card)f(to)h(the)f(end)g(of)h(the)f(list)h(of)g (cards.)p eop %%Page: 169 195 169 194 bop 0 -2070 a Fv(16.3)425 b(Dealing)g(cards)26022 b(169)p 0 -1627 38191 45 v 0 865 a Fl(16.3)1792 b(Dealing)599 b(cards)0 3681 y Fn(No)-31 b(w)310 b(that)f(w)-31 b(e)309 b(ha)-31 b(v)g(e)310 b(a)f Fk(Hand)f Fn(class,)322 b(w)-31 b(e)309 b(w)-31 b(an)g(t)310 b(to)f(deal)g(cards)f(from)h(the)g Fk(Deck)g Fn(in)-31 b(to)310 b(hands.)0 5035 y(It)374 b(is)g(not)h(immediately)j(ob)-31 b(vious)375 b(whether)g(this)f(metho) 31 b(d)375 b(should)g(go)g(in)f(the)g Fk(Hand)h Fn(class)0 6390 y(or)314 b(in)g(the)h Fk(Deck)f Fn(class,)326 b(but)314 b(since)g(it)h(op)31 b(erates)314 b(on)h(a)f(single)h(dec)-31 b(k)315 b(and)f(\(p)31 b(ossibly\))316 b(sev)-31 b(eral)0 7745 y(hands,)370 b(it)f(is)h(more)f(natural)i(to)e(put)h(it)g(in)f Fk(Deck)p Fn(.)0 10137 y Fk(deal)397 b Fn(should)h(b)31 b(e)396 b(fairly)j(general,)405 b(since)397 b(di\256eren)-31 b(t)397 b(games)h(will)h(ha)-31 b(v)g(e)398 b(di\256eren)-31 b(t)397 b(require-)0 11492 y(men)-31 b(ts.)737 b(W)-92 b(e)449 b(ma)-31 b(y)452 b(w)-31 b(an)g(t)452 b(to)f(deal)g(out)g(the)g (en)-31 b(tire)451 b(dec)-31 b(k)450 b(at)h(once)g(or)f(add)g(one)h (card)f(to)0 12846 y(eac)-31 b(h)370 b(hand.)0 15238 y Fk(deal)413 b Fn(tak)-31 b(es)414 b(t)-31 b(w)g(o)414 b(parameters,)425 b(a)413 b(list)h(\(or)f(tuple\))h(of)f(hands)g(and)g (the)g(total)i(n)-31 b(um)g(b)31 b(er)412 b(of)0 16593 y(cards)390 b(to)h(deal.)558 b(If)390 b(there)h(are)f(not)h(enough)h (cards)e(in)g(the)h(dec)-31 b(k,)397 b(the)391 b(metho)31 b(d)391 b(deals)g(out)0 17948 y(all)370 b(of)g(the)g(cards)e(and)i (stops:)0 20420 y Fk(class)582 b(Deck)g(:)1162 21775 y(...)1162 23130 y(def)g(deal\(self,)h(hands,)f(nCards=999\):)2325 24485 y(nHands)g(=)f(len\(hands\))2325 25840 y(for)g(i)g(in)h (range\(nCards\):)3487 27195 y(if)f(self.isEmpty\(\):)j(break)2325 b(#)581 b(break)h(if)g(out)f(of)h(cards)3487 28549 y(card)g(=)f (self.popCard\(\))4070 b(#)581 b(take)h(the)g(top)f(card)3487 29904 y(hand)h(=)f(hands[i)h(\045)f(nHands])2326 b(#)581 b(whose)h(turn)g(is)f(next?)3487 31259 y(hand.addCard\(card\))5814 b(#)581 b(add)h(the)g(card)f(to)h(the)f(hand)0 33732 y Fn(The)310 b(second)g(parameter,)322 b Fk(nCards)p Fn(,)h(is)310 b(optional;)333 b(the)310 b(default)h(is)e(a)h(large)h(n) -31 b(um)g(b)31 b(er,)322 b(whic)-31 b(h)0 35087 y(e\256ectiv)g(ely)371 b(means)e(that)i(all)f(of)g(the)f(cards)g(in)g(the)h(dec)-31 b(k)369 b(will)i(get)f(dealt.)0 37478 y(The)428 b(lo)31 b(op)429 b(v)-61 b(ariable)428 b Fk(i)g Fn(go)31 b(es)428 b(from)g(0)g(to)g Fk(nCards-1)p Fn(.)669 b(Eac)-31 b(h)429 b(time)g(through)f(the)g(lo)31 b(op,)444 b(a)0 38833 y(card)437 b(is)f(remo)-31 b(v)g(ed)438 b(from)f(the)g(dec)-31 b(k)437 b(using)g(the)g(list)h(metho)31 b(d)437 b Fk(pop)p Fn(,)455 b(whic)-31 b(h)437 b(remo)-31 b(v)g(es)438 b(and)0 40188 y(returns)368 b(the)i(last)g(item)g(in)g(the)f(list.)0 42579 y(The)346 b(mo)31 b(dulus)347 b(op)31 b(erator)346 b(\()p Fk(\045)p Fn(\))h(allo)-31 b(ws)348 b(us)e(to)h(deal)f(cards)g (in)g(a)g(round)g(robin)h(\(one)f(card)g(at)0 43934 y(a)391 b(time)h(to)f(eac)-31 b(h)391 b(hand\).)558 b(When)390 b Fk(i)g Fn(is)h(equal)g(to)h(the)f(n)-31 b(um)g(b)31 b(er)390 b(of)h(hands)g(in)f(the)h(list,)398 b(the)0 45289 y(expression)369 b Fk(i)581 b(\045)h(nHands)369 b Fn(wraps)h(around)f(to)h(the)f(b)31 b(eginning)371 b(of)f(the)f(list)h(\(index)g(0\).)0 50478 y Fl(16.4)1792 b(Prin)-50 b(ting)600 b(a)d(Hand)0 53293 y Fn(T)-92 b(o)401 b(prin)-31 b(t)401 b(the)g(con)-31 b(ten)g(ts)402 b(of)g(a)f(hand,)409 b(w)-31 b(e)401 b(can)g(tak)-31 b(e)402 b(adv)-61 b(an)-31 b(tage)403 b(of)e(the)g Fk(printDeck)h Fn(and)p 0 54648 349 45 v 418 54648 V 767 54648 a Fk(str)p 2580 54648 V 2999 54648 V 1206 w Fn(metho)31 b(ds)370 b(inherited)g(from)g Fk(Deck)p Fn(.)493 b(F)-92 b(or)368 b(example:)p eop %%Page: 170 196 170 195 bop 0 -2070 a Fv(170)29953 b(Inheritance)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(deck)f(=)h(Deck\(\))0 2220 y(>>>)g(deck.shuffle\(\))0 3575 y(>>>)g(hand)f(=)h (Hand\("frank"\))0 4930 y(>>>)g(deck.deal\([hand],)h(5\))0 6285 y(>>>)f(print)f(hand)0 7640 y(Hand)h(frank)g(contains)0 8995 y(2)f(of)h(Spades)581 10350 y(3)f(of)h(Spades)1162 11705 y(4)g(of)f(Spades)1743 13059 y(Ace)h(of)f(Hearts)2325 14414 y(9)g(of)g(Clubs)0 17499 y Fn(It's)369 b(not)h(a)g(great)g(hand,) g(but)f(it)h(has)f(the)h(makings)g(of)g(a)f(straigh)-31 b(t)371 b(\260ush.)0 20502 y(Although)469 b(it)g(is)e(con)-31 b(v)g(enien)g(t)470 b(to)e(inherit)h(the)f(existing)h(metho)31 b(ds,)493 b(there)467 b(is)h(additional)0 21857 y(information)390 b(in)d(a)g Fk(Hand)g Fn(ob)61 b(ject)389 b(w)-31 b(e)387 b(migh)-31 b(t)389 b(w)-31 b(an)g(t)388 b(to)g(include)g(when)f(w)-31 b(e)387 b(prin)-31 b(t)387 b(one.)546 b(T)-92 b(o)0 23212 y(do)407 b(that,)418 b(w)-31 b(e)407 b(can)g(pro)-31 b(vide)407 b(a)p 13068 23212 349 45 v 13486 23212 V 1244 w Fk(str)p 15648 23212 V 16067 23212 V 1244 w Fn(metho)31 b(d)407 b(in)g(the)g Fk(Hand)g Fn(class)g(that)h(o)-31 b(v)g(errides)407 b(the)0 24566 y(one)369 b(in)h(the)f Fk(Deck)h Fn(class:)0 27651 y Fk(class)582 b(Hand\(Deck\))1162 29006 y(...)1162 30360 y(def)g(__str__\(self\):)2325 31715 y(s)f(=)g("Hand)h(")f(+)h(self.name)2325 33070 y(if)f(self.isEmpty\(\):)3487 34425 y(return)h(s)f(+)h(")f(is)g (empty\\n")2325 35780 y(else:)3487 37135 y(return)h(s)f(+)h(")f (contains\\n")i(+)e(Deck.__str__\(self\))0 40219 y Fn(Initially)-92 b(,)317 b Fk(s)301 b Fn(is)g(a)g(string)g(that)h(iden)-31 b(ti\257es)302 b(the)f(hand.)470 b(If)300 b(the)i(hand)e(is)h(empt)-31 b(y)-92 b(,)316 b(the)301 b(program)0 41574 y(app)31 b(ends)369 b(the)g(w)-31 b(ords)370 b Fk(is)581 b(empty)370 b Fn(and)f(returns)f(the)i(result.)0 44577 y(Otherwise,)351 b(the)345 b(program)h(app)31 b(ends)344 b(the)i(w)-31 b(ord)345 b Fk(contains)h Fn(and)g(the)f(string)g(represen)-31 b(ta-)0 45932 y(tion)434 b(of)f(the)f Fk(Deck)p Fn(,)450 b(computed)433 b(b)-31 b(y)433 b(in)-31 b(v)g(oking)435 b(the)p 22012 45932 V 22430 45932 V 1270 w Fk(str)p 24592 45932 V 25010 45932 V 1269 w Fn(metho)31 b(d)434 b(in)e(the)h Fk(Deck)g Fn(class)0 47287 y(on)369 b Fk(self)p Fn(.)0 50290 y(It)495 b(ma)-31 b(y)495 b(seem)g(o)31 b(dd)494 b(to)i(send)e Fk(self)p Fn(,)526 b(whic)-31 b(h)496 b(refers)d(to)j (the)e(curren)-31 b(t)495 b Fk(Hand)p Fn(,)526 b(to)496 b(a)f Fk(Deck)0 51645 y Fn(metho)31 b(d,)441 b(un)-31 b(til)426 b(y)-31 b(ou)426 b(remem)-31 b(b)31 b(er)425 b(that)i(a)e Fk(Hand)h Fn(is)f(a)g(kind)h(of)g Fk(Deck)p Fn(.)661 b Fk(Hand)425 b Fn(ob)61 b(jects)427 b(can)0 53000 y(do)356 b(ev)-31 b(erything)358 b Fk(Deck)f Fn(ob)61 b(jects)357 b(can,)i(so)d(it)h(is)f(legal)i(to)f(send)f(a)g Fk(Hand)h Fn(to)g(a)f Fk(Deck)h Fn(metho)31 b(d.)0 56003 y(In)504 b(general,)540 b(it)505 b(is)f(alw)-31 b(a)g(ys)507 b(legal)f(to)f(use)f(an)h(instance)g(of)g(a)g(sub)31 b(class)504 b(in)g(place)i(of)f(an)0 57358 y(instance)370 b(of)g(a)f(paren)-31 b(t)370 b(class.)p eop %%Page: 171 197 171 196 bop 0 -2070 a Fv(16.5)425 b(The)g Fk(CardGame)h Fv(class)23376 b(171)p 0 -1627 38191 45 v 0 865 a Fl(16.5)1792 b(The)599 b Fe(CardGame)h Fl(class)0 3215 y Fn(The)360 b Fk(CardGame)g Fn(class)g(tak)-31 b(es)360 b(care)g(of)g(some)g(basic) g(c)-31 b(hores)359 b(common)i(to)g(all)f(games,)j(suc)-31 b(h)0 4570 y(as)369 b(creating)i(the)e(dec)-31 b(k)369 b(and)h(sh)-31 b(u\262ing)370 b(it:)0 6666 y Fk(class)582 b(CardGame:)1162 8021 y(def)g(__init__\(self\):)2325 9376 y(self.deck)g(=)f(Deck\(\))2325 10731 y(self.deck.shuffle\(\))0 12828 y Fn(This)420 b(is)g(the)g(\257rst)f(case)h(w)-31 b(e)420 b(ha)-31 b(v)g(e)421 b(seen)e(where)h(the)g(initialization)425 b(metho)31 b(d)420 b(p)31 b(erforms)420 b(a)0 14183 y(signi\257can)-31 b(t)371 b(computation,)i(b)31 b(ey)-31 b(ond)370 b(initializing)j (attributes.)0 16199 y(T)-92 b(o)430 b(implemen)-31 b(t)431 b(sp)31 b(eci\257c)429 b(games,)445 b(w)-31 b(e)429 b(can)h(inherit)g (from)f Fk(CardGame)h Fn(and)f(add)h(features)0 17554 y(for)369 b(the)h(new)f(game.)494 b(As)369 b(an)g(example,)i(w)-31 b(e'll)372 b(write)e(a)f(sim)-31 b(ulation)372 b(of)e(Old)f(Maid.)0 19570 y(The)472 b(ob)61 b(ject)472 b(of)g(Old)g(Maid)f(is)h(to)g(get)g (rid)f(of)h(cards)e(in)i(y)-31 b(our)472 b(hand.)799 b(Y)-92 b(ou)471 b(do)h(this)g(b)-31 b(y)0 20924 y(matc)g(hing)401 b(cards)d(b)-31 b(y)399 b(rank)f(and)h(color.)581 b(F)-92 b(or)398 b(example,)408 b(the)399 b(4)f(of)h(Clubs)g(matc)-31 b(hes)400 b(the)f(4)0 22279 y(of)427 b(Spades)e(since)h(b)31 b(oth)427 b(suits)f(are)g(blac)-31 b(k.)664 b(The)427 b(Jac)-31 b(k)426 b(of)h(Hearts)f(matc)-31 b(hes)427 b(the)g(Jac)-31 b(k)426 b(of)0 23634 y(Diamonds)370 b(since)f(b)31 b(oth)370 b(are)f(red.)0 25650 y(T)-92 b(o)427 b(b)31 b(egin)426 b(the)g(game,)442 b(the)427 b(Queen)e(of)i(Clubs)f(is)g (remo)-31 b(v)g(ed)427 b(from)g(the)f(dec)-31 b(k)426 b(so)g(that)i(the)0 27005 y(Queen)390 b(of)g(Spades)g(has)f(no)i(matc) -31 b(h.)556 b(The)390 b(\257ft)-31 b(y-one)391 b(remaining)h(cards)d (are)h(dealt)h(to)g(the)0 28360 y(pla)-31 b(y)g(ers)345 b(in)h(a)f(round)f(robin.)485 b(After)345 b(the)g(deal,)351 b(all)346 b(pla)-31 b(y)g(ers)346 b(matc)-31 b(h)346 b(and)f(discard)g(as)g(man)-31 b(y)0 29715 y(cards)369 b(as)g(p)31 b(ossible.)0 31731 y(When)432 b(no)h(more)h(matc)-31 b(hes)434 b(can)f(b)31 b(e)432 b(made,)450 b(pla)-31 b(y)434 b(b)31 b(egins.)684 b(In)432 b(turn,)449 b(eac)-31 b(h)434 b(pla)-31 b(y)g(er)434 b(pic)-31 b(ks)0 33086 y(a)528 b(card)f(\(without)j(lo)31 b(oking\))530 b(from)e(the)g (closest)g(neigh)-31 b(b)31 b(or)528 b(to)g(the)g(left)g(who)g(still)h (has)0 34441 y(cards.)1034 b(If)550 b(the)g(c)-31 b(hosen)550 b(card)g(matc)-31 b(hes)551 b(a)f(card)g(in)g(the)g(pla)-31 b(y)g(er's)551 b(hand,)596 b(the)550 b(pair)g(is)0 35795 y(remo)-31 b(v)g(ed.)860 b(Otherwise,)522 b(the)492 b(card)f(is)g (added)g(to)h(the)f(pla)-31 b(y)g(er's)493 b(hand.)858 b(Ev)-31 b(en)g(tually)495 b(all)0 37150 y(p)31 b(ossible)532 b(matc)-31 b(hes)532 b(are)f(made,)573 b(lea)-31 b(ving)534 b(only)e(the)g(Queen)f(of)g(Spades)h(in)f(the)h(loser's)0 38505 y(hand.)0 40521 y(In)382 b(our)g(computer)g(sim)-31 b(ulation)386 b(of)c(the)h(game,)k(the)382 b(computer)h(pla)-31 b(ys)383 b(all)g(hands.)532 b(Unfor-)0 41876 y(tunately)-92 b(,)490 b(some)465 b(n)-31 b(uances)464 b(of)h(the)f(real)h(game)g(are) f(lost.)779 b(In)464 b(a)g(real)h(game,)489 b(the)465 b(pla)-31 b(y)g(er)0 43231 y(with)395 b(the)g(Old)f(Maid)h(go)31 b(es)394 b(to)h(some)g(e\256ort)f(to)h(get)g(their)f(neigh)-31 b(b)31 b(or)395 b(to)g(pic)-31 b(k)395 b(that)h(card,)0 44586 y(b)-31 b(y)374 b(displa)-31 b(ying)376 b(it)e(a)g(little)i(more) e(prominen)-31 b(tly)-92 b(,)377 b(or)c(p)31 b(erhaps)373 b(failing)j(to)e(displa)-31 b(y)375 b(it)g(more)0 45941 y(prominen)-31 b(tly)-92 b(,)381 b(or)376 b(ev)-31 b(en)376 b(failing)j(to)e(fail)h(to)f(displa)-31 b(y)378 b(that)f(card)f(more)h (prominen)-31 b(tly)-92 b(.)516 b(The)0 47296 y(computer)370 b(simply)g(pic)-31 b(ks)370 b(a)f(neigh)-31 b(b)31 b(or's)370 b(card)f(at)h(random.)0 51597 y Fl(16.6)1792 b Fe(OldMaidHand)601 b Fl(class)0 53947 y Fn(A)307 b(hand)h(for)f(pla)-31 b(ying)309 b(Old)f(Maid)f(requires)g(some)g(abilities)j(b)31 b(ey)-31 b(ond)307 b(the)h(general)g(abilities)0 55302 y(of)445 b(a)g Fk(Hand)p Fn(.)720 b(W)-92 b(e)444 b(will)j(de\257ne)d (a)h(new)g(class,)464 b Fk(OldMaidHand)p Fn(,)i(that)446 b(inherits)f(from)h Fk(Hand)0 56657 y Fn(and)369 b(pro)-31 b(vides)370 b(an)f(additional)k(metho)31 b(d)370 b(called)g Fk(removeMatches)p Fn(:)p eop %%Page: 172 198 172 197 bop 0 -2070 a Fv(172)29953 b(Inheritance)p 0 -1627 38191 45 v 0 865 a Fk(class)582 b(OldMaidHand\(Hand\):)1162 2220 y(def)g(removeMatches\(self\):)2325 3575 y(count)f(=)h(0)2325 4930 y(originalCards)h(=)e(self.cards[:])2325 6285 y(for)g(card)h(in)f (originalCards:)3487 7640 y(match)h(=)f(Card\(3)h(-)f(card.suit,)i (card.rank\))3487 8995 y(if)e(match)h(in)g(self.cards:)4649 10350 y(self.cards.remove\(card\))4649 11705 y (self.cards.remove\(match\))4649 13059 y(print)g("Hand)g(\045s:)g (\045s)f(matches)h(\045s")g(\045)f(\(self.name,card,match\))4649 14414 y(count)h(=)f(count)h(+)g(1)2325 15769 y(return)g(count)0 18077 y Fn(W)-92 b(e)338 b(start)i(b)-31 b(y)339 b(making)j(a)d(cop)-31 b(y)340 b(of)g(the)f(list)h(of)g(cards,)345 b(so)339 b(that)h(w)-31 b(e)340 b(can)f(tra)-31 b(v)g(erse)340 b(the)f(cop)-31 b(y)0 19432 y(while)456 b(remo)-31 b(ving)457 b(cards)d(from)h(the)g(original.)752 b(Since)455 b Fk(self.cards)h Fn(is)f(mo)31 b(di\257ed)456 b(in)f(the)0 20787 y(lo)31 b(op,)500 b(w)-31 b(e)474 b(don't)g(w)-31 b(an)g(t)474 b(to)g(use)e(it)i(to)g(con)-31 b(trol)474 b(the)f(tra)-31 b(v)g(ersal.)805 b(Python)474 b(can)f(get)h(quite)0 22142 y(confused)369 b(if)h(it)g(is)f(tra)-31 b(v)g(ersing)370 b(a)g(list)g(that)g(is)f(c)-31 b(hanging!)0 24369 y(F)-92 b(or)497 b(eac)-31 b(h)499 b(card)f(in)g(the)g(hand,)531 b(w)-31 b(e)499 b(\257gure)e(out)i(what)g(the)g(matc)-31 b(hing)500 b(card)e(is)g(and)g(go)0 25724 y(lo)31 b(oking)313 b(for)e(it.)473 b(The)311 b(matc)-31 b(h)312 b(card)f(has)f(the)h(same) g(rank)g(and)g(the)g(other)g(suit)g(of)g(the)g(same)0 27079 y(color.)579 b(The)398 b(expression)g Fk(3)581 b(-)g(card.suit)399 b Fn(turns)e(a)h(Club)h(\(suit)f(0\))h(in)-31 b(to)399 b(a)f(Spade)g(\(suit)0 28434 y(3\))459 b(and)f(a)g(Diamond)h (\(suit)f(1\))h(in)-31 b(to)459 b(a)f(Heart)h(\(suit)f(2\).)759 b(Y)-92 b(ou)458 b(should)h(satisfy)f(y)-31 b(ourself)0 29789 y(that)412 b(the)f(opp)31 b(osite)412 b(op)31 b(erations)412 b(also)g(w)-31 b(ork.)619 b(If)410 b(the)h(matc)-31 b(h)413 b(card)d(is)h(also)h(in)f(the)g(hand,)0 31144 y(b)31 b(oth)370 b(cards)e(are)h(remo)-31 b(v)g(ed.)0 33371 y(The)369 b(follo)-31 b(wing)373 b(example)e(demonstrates)f(ho)-31 b(w)370 b(to)g(use)f Fk(removeMatches)p Fn(:)0 35679 y Fk(>>>)582 b(game)f(=)h(CardGame\(\))0 37034 y(>>>)g(hand)f(=)h (OldMaidHand\("frank"\))0 38389 y(>>>)g(game.deck.deal\([hand],)i(13\)) 0 39744 y(>>>)e(print)f(hand)0 41099 y(Hand)h(frank)g(contains)0 42454 y(Ace)g(of)f(Spades)581 43809 y(2)g(of)h(Diamonds)1162 45164 y(7)g(of)f(Spades)1743 46519 y(8)h(of)f(Clubs)2325 47874 y(6)g(of)g(Hearts)2906 49229 y(8)g(of)g(Spades)3487 50584 y(7)g(of)h(Clubs)4068 51938 y(Queen)g(of)f(Clubs)4649 53293 y(7)g(of)h(Diamonds)5230 54648 y(5)g(of)f(Clubs)5811 56003 y(Jack)h(of)g(Diamonds)6393 57358 y(10)f(of)h(Diamonds)6974 58713 y(10)f(of)h(Hearts)p eop %%Page: 173 199 173 198 bop 0 -2070 a Fv(16.7)425 b Fk(OldMaidGame)h Fv(class)24234 b(173)p 0 -1627 38191 45 v 0 2220 a Fk(>>>)582 b(hand.removeMatches\(\))0 3575 y(Hand)g(frank:)g(7)f(of)h(Spades)g (matches)g(7)f(of)h(Clubs)0 4930 y(Hand)g(frank:)g(8)f(of)h(Spades)g (matches)g(8)f(of)h(Clubs)0 6285 y(Hand)g(frank:)g(10)f(of)h(Diamonds)g (matches)g(10)g(of)f(Hearts)0 7640 y(>>>)h(print)f(hand)0 8995 y(Hand)h(frank)g(contains)0 10350 y(Ace)g(of)f(Spades)581 11705 y(2)g(of)h(Diamonds)1162 13059 y(6)g(of)f(Hearts)1743 14414 y(Queen)h(of)g(Clubs)2325 15769 y(7)f(of)g(Diamonds)2906 17124 y(5)g(of)g(Clubs)3487 18479 y(Jack)h(of)f(Diamonds)0 20627 y Fn(Notice)366 b(that)f(there)f(is)g(no)p 11400 20627 349 45 v 11819 20627 V 1202 w Fk(init)p 14562 20627 V 14980 20627 V 1201 w Fn(metho)31 b(d)365 b(for)g(the)f Fk(OldMaidHand)i Fn(class.)491 b(W)-92 b(e)363 b(inherit)0 21982 y(it)370 b(from)g Fk(Hand)p Fn(.)0 26355 y Fl(16.7)1792 b Fe(OldMaidGame)601 b Fl(class)0 28755 y Fn(No)-31 b(w)426 b(w)-31 b(e)424 b(can)h(turn)f(our)g(atten)-31 b(tion)427 b(to)f(the)e(game)i(itself.)659 b Fk(OldMaidGame)426 b Fn(is)e(a)h(sub)31 b(class)0 30110 y(of)465 b Fk(CardGame)g Fn(with)g(a)f(new)h(metho)31 b(d)465 b(called)g Fk(play)g Fn(that)g(tak)-31 b(es)465 b(a)f(list)h(of)g(pla)-31 b(y)g(ers)465 b(as)f(a)0 31465 y(parameter.)0 33532 y(Since)p 2952 33532 V 3370 33532 V 1198 w Fk(init)p 6113 33532 V 6531 33532 V 1198 w Fn(is)360 b(inherited)h(from)h Fk(CardGame)p Fn(,)h(a)e(new)g Fk(OldMaidGame)h Fn(ob)61 b(ject)362 b(con)-31 b(tains)0 34887 y(a)369 b(new)h(sh)-31 b(u\262ed)369 b(dec)-31 b(k:)0 37034 y Fk(class)582 b (OldMaidGame\(CardGame\):)1162 38389 y(def)g(play\(self,)h(names\):) 2325 39744 y(#)e(remove)h(Queen)g(of)f(Clubs)2325 41099 y(self.deck.removeCard\(Card\(0,12\)\))2325 43809 y(#)g(make)h(a)f (hand)h(for)f(each)h(player)2325 45164 y(self.hands)g(=)g([])2325 46519 y(for)f(name)h(in)f(names)h(:)3487 47874 y (self.hands.append\(OldMaidHand\(name\)\))2325 50584 y(#)f(deal)h(the)f(cards)2325 51938 y(self.deck.deal\(self.hands\))2325 53293 y(print)g("----------)i(Cards)f(have)g(been)g(dealt")2325 54648 y(self.printHands\(\))p eop %%Page: 174 200 174 199 bop 0 -2070 a Fv(174)29953 b(Inheritance)p 0 -1627 38191 45 v 2325 865 a Fk(#)581 b(remove)h(initial)g(matches)2325 2220 y(matches)g(=)f(self.removeAllMatches\(\))2325 3575 y(print)g("----------)i(Matches)f(discarded,)h(play)f(begins")2325 4930 y(self.printHands\(\))2325 7640 y(#)f(play)h(until)g(all)f(50)h (cards)f(are)h(matched)2325 8995 y(turn)f(=)h(0)2325 10350 y(numHands)g(=)f(len\(self.hands\))2325 11705 y(while)g(matches)i (<)e(25:)3487 13059 y(matches)h(=)f(matches)i(+)e (self.playOneTurn\(turn\))3487 14414 y(turn)h(=)f(\(turn)h(+)f(1\))h (\045)f(numHands)2325 17124 y(print)g("----------)i(Game)f(is)f(Over") 2325 18479 y(self.printHands\(\))0 20677 y Fn(Some)954 b(of)h(the)f(steps)f(of)h(the)g(game)h(ha)-31 b(v)g(e)954 b(b)31 b(een)954 b(separated)g(in)-31 b(to)955 b(metho)31 b(ds.)0 22032 y Fk(removeAllMatches)439 b Fn(tra)-31 b(v)g(erses)436 b(the)h(list)g(of)g(hands)g(and)f(in)-31 b(v)g(ok)g(es)438 b Fk(removeMatches)h Fn(on)0 23387 y(eac)-31 b(h:)0 25585 y Fk(class)582 b(OldMaidGame\(CardGame\):)1162 26940 y(...)1162 28295 y(def)g(removeAllMatches\(self\):)2325 29650 y(count)f(=)h(0)2325 31005 y(for)f(hand)h(in)f(self.hands:)3487 32360 y(count)h(=)f(count)h(+)f(hand.removeMatches\(\))2325 33715 y(return)h(count)2767 36304 y Fm(As)417 b(an)h(exer)-57 b(cise,)424 b(write)417 b Fk(printHands)i Fm(which)e(tr)-57 b(averses)417 b Fk(self.hands)i Fm(and)2767 37659 y(prints)396 b(e)-57 b(ach)397 b(hand.)0 40167 y Fk(count)338 b Fn(is)g(an)g(accum) -31 b(ulator)340 b(that)f(adds)f(up)f(the)h(n)-31 b(um)g(b)31 b(er)338 b(of)h(matc)-31 b(hes)338 b(in)g(eac)-31 b(h)339 b(hand)f(and)0 41522 y(returns)368 b(the)i(total.)0 43639 y(When)462 b(the)g(total)j(n)-31 b(um)g(b)31 b(er)462 b(of)h(matc)-31 b(hes)464 b(reac)-31 b(hes)462 b(t)-31 b(w)g(en)g(t)g(y-\257v)g(e,)489 b(\257ft)-31 b(y)463 b(cards)f(ha)-31 b(v)g(e)463 b(b)31 b(een)0 44994 y(remo)-31 b(v)g(ed)388 b(from)f(the)g(hands,)k(whic)-31 b(h)388 b(means)f(that)h(only)f(one)g(card)g(is)f(left)i(and)f(the)g(game)0 46349 y(is)369 b(o)-31 b(v)g(er.)0 48466 y(The)449 b(v)-61 b(ariable)449 b Fk(turn)g Fn(k)-31 b(eeps)449 b(trac)-31 b(k)449 b(of)g(whic)-31 b(h)450 b(pla)-31 b(y)g(er's)450 b(turn)e(it)h(is.)731 b(It)449 b(starts)f(at)i(0)f(and)0 49821 y(increases)457 b(b)-31 b(y)457 b(one)g(eac)-31 b(h)458 b(time;)503 b(when)457 b(it)h(reac)-31 b(hes)457 b Fk(numHands)p Fn(,)480 b(the)458 b(mo)31 b(dulus)457 b(op)31 b(erator)0 51176 y(wraps)369 b(it)h(bac)-31 b(k)370 b(around)f(to)h(0.)0 53293 y(The)476 b(metho)31 b(d)476 b Fk(playOneTurn)h Fn(tak)-31 b(es)476 b(a)g(parameter)g(that)h (indicates)f(whose)g(turn)f(it)h(is.)0 54648 y(The)369 b(return)g(v)-61 b(alue)370 b(is)f(the)g(n)-31 b(um)g(b)31 b(er)369 b(of)h(matc)-31 b(hes)370 b(made)g(during)g(this)f(turn:)p eop %%Page: 175 201 175 200 bop 0 -2070 a Fv(16.7)425 b Fk(OldMaidGame)h Fv(class)24234 b(175)p 0 -1627 38191 45 v 0 865 a Fk(class)582 b(OldMaidGame\(CardGame\):)1162 2220 y(...)1162 3575 y(def)g(playOneTurn\(self,)i(i\):)2325 4930 y(if)d (self.hands[i].isEmpty\(\):)3487 6285 y(return)h(0)2325 7640 y(neighbor)g(=)f(self.findNeighbor\(i\))2325 8995 y(pickedCard)h(=)g(self.hands[neighbor].popCard\(\))2325 10350 y(self.hands[i].addCard\(pickedCard\))2325 11705 y(print)f("Hand",)i(self.hands[i].name,)h("picked",)e(pickedCard)2325 13059 y(count)f(=)h(self.hands[i].removeMatches\(\))2325 14414 y(self.hands[i].shuffle\(\))2325 15769 y(return)g(count)0 17960 y Fn(If)442 b(a)g(pla)-31 b(y)g(er's)444 b(hand)e(is)g(empt)-31 b(y)-92 b(,)462 b(that)443 b(pla)-31 b(y)g(er)443 b(is)f(out)h(of)g (the)f(game,)462 b(so)442 b(he)g(or)g(she)f(do)31 b(es)0 19315 y(nothing)371 b(and)e(returns)f(0.)0 21424 y(Otherwise,)384 b(a)c(turn)g(consists)h(of)f(\257nding)h(the)g(\257rst)e(pla)-31 b(y)g(er)381 b(on)g(the)f(left)h(that)h(has)e(cards,)0 22779 y(taking)334 b(one)d(card)h(from)g(the)g(neigh)-31 b(b)31 b(or,)340 b(and)332 b(c)-31 b(hec)g(king)333 b(for)e(matc)-31 b(hes.)481 b(Before)332 b(returning,)0 24134 y(the)369 b(cards)g(in)h(the)f(hand)g(are)g(sh)-31 b(u\262ed)370 b(so)f(that)h(the)g(next)f(pla)-31 b(y)g(er's)371 b(c)-31 b(hoice)370 b(is)f(random.)0 26244 y(The)491 b(metho)31 b(d)492 b Fk(findNeighbor)h Fn(starts)e(with)h(the)g(pla)-31 b(y)g(er)492 b(to)g(the)f(immediate)j(left)e(and)0 27599 y(con)-31 b(tin)g(ues)370 b(around)g(the)f(circle)h(un)-31 b(til)370 b(it)g(\257nds)f(a)g(pla)-31 b(y)g(er)371 b(that)f(still)h (has)e(cards:)0 29789 y Fk(class)582 b(OldMaidGame\(CardGame\):)1162 31144 y(...)1162 32499 y(def)g(findNeighbor\(self,)i(i\):)2325 33854 y(numHands)e(=)f(len\(self.hands\))2325 35209 y(for)g(next)h(in)f (range\(1,numHands\):)3487 36564 y(neighbor)h(=)g(\(i)f(+)g(next\))h (\045)f(numHands)3487 37919 y(if)g(not)h (self.hands[neighbor].isEmpty\(\):)4649 39274 y(return)g(neighbor)0 41464 y Fn(If)358 b Fk(findNeighbor)h Fn(ev)-31 b(er)358 b(w)-31 b(en)g(t)359 b(all)g(the)f(w)-31 b(a)g(y)360 b(around)e(the)g(circle)g(without)i(\257nding)f(cards,)0 42819 y(it)331 b(w)-31 b(ould)331 b(return)f Fk(None)g Fn(and)h(cause)f(an)g(error)f(elsewhere)h(in)h(the)f(program.)480 b(F)-92 b(ortunately)g(,)0 44174 y(w)-31 b(e)460 b(can)h(pro)-31 b(v)g(e)460 b(that)h(that)g(will)h(nev)-31 b(er)460 b(happ)31 b(en)459 b(\(as)i(long)g(as)f(the)g(end)f(of)i(the)f(game)h(is)0 45529 y(detected)370 b(correctly\).)0 47638 y(W)-92 b(e)368 b(ha)-31 b(v)g(e)371 b(omitted)g(the)e Fk(printHands)i Fn(metho)31 b(d.)493 b(Y)-92 b(ou)370 b(can)f(write)h(that)h(one)e(y) -31 b(ourself.)0 49748 y(The)377 b(follo)-31 b(wing)380 b(output)e(is)f(from)g(a)g(truncated)g(form)g(of)g(the)g(game)h(where)f (only)g(the)g(top)0 51103 y(\257fteen)301 b(cards)f(\(tens)h(and)g (higher\))g(w)-31 b(ere)301 b(dealt)h(to)f(three)g(pla)-31 b(y)g(ers.)470 b(With)301 b(this)g(small)h(dec)-31 b(k,)0 52458 y(pla)g(y)370 b(stops)g(after)f(sev)-31 b(en)369 b(matc)-31 b(hes)371 b(instead)f(of)f(t)-31 b(w)g(en)g(t)g(y-\257v)g (e.)0 54648 y Fk(>>>)582 b(import)g(cards)0 56003 y(>>>)g(game)f(=)h (cards.OldMaidGame\(\))0 57358 y(>>>)g (game.play\(["Allen","Jeff","Chris"]\))p eop %%Page: 176 202 176 201 bop 0 -2070 a Fv(176)29953 b(Inheritance)p 0 -1627 38191 45 v 0 865 a Fk(----------)583 b(Cards)f(have)f(been)h (dealt)0 2220 y(Hand)g(Allen)g(contains)0 3575 y(King)g(of)f(Hearts)581 4930 y(Jack)h(of)f(Clubs)1162 6285 y(Queen)h(of)g(Spades)1743 7640 y(King)g(of)g(Spades)2325 8995 y(10)f(of)g(Diamonds)0 11705 y(Hand)h(Jeff)f(contains)0 13059 y(Queen)h(of)f(Hearts)581 14414 y(Jack)h(of)f(Spades)1162 15769 y(Jack)h(of)f(Hearts)1743 17124 y(King)h(of)g(Diamonds)2325 18479 y(Queen)f(of)h(Diamonds)0 21189 y(Hand)g(Chris)g(contains)0 22544 y(Jack)g(of)f(Diamonds)581 23899 y(King)h(of)f(Clubs)1162 25254 y(10)h(of)f(Spades)1743 26609 y(10)h(of)f(Hearts)2325 27964 y(10)g(of)g(Clubs)0 30673 y(Hand)h(Jeff:)g(Queen)g(of)f(Hearts)h(matches)g(Queen)g(of)g (Diamonds)0 32028 y(Hand)g(Chris:)g(10)f(of)h(Spades)g(matches)g(10)f (of)h(Clubs)0 33383 y(----------)h(Matches)f(discarded,)g(play)g (begins)0 34738 y(Hand)g(Allen)g(contains)0 36093 y(King)g(of)f(Hearts) 581 37448 y(Jack)h(of)f(Clubs)1162 38803 y(Queen)h(of)g(Spades)1743 40158 y(King)g(of)g(Spades)2325 41513 y(10)f(of)g(Diamonds)0 44223 y(Hand)h(Jeff)f(contains)0 45578 y(Jack)h(of)f(Spades)581 46933 y(Jack)h(of)f(Hearts)1162 48287 y(King)h(of)f(Diamonds)0 50997 y(Hand)h(Chris)g(contains)0 52352 y(Jack)g(of)f(Diamonds)581 53707 y(King)h(of)f(Clubs)1162 55062 y(10)h(of)f(Hearts)p eop %%Page: 177 203 177 202 bop 0 -2070 a Fv(16.8)425 b(Glossary)28784 b(177)p 0 -1627 38191 45 v 0 865 a Fk(Hand)582 b(Allen)g(picked)g(King)f(of)h (Diamonds)0 2220 y(Hand)g(Allen:)g(King)g(of)f(Hearts)h(matches)g(King) g(of)f(Diamonds)0 3575 y(Hand)h(Jeff)f(picked)i(10)e(of)g(Hearts)0 4930 y(Hand)h(Chris)g(picked)g(Jack)f(of)h(Clubs)0 6285 y(Hand)g(Allen)g(picked)g(Jack)f(of)h(Hearts)0 7640 y(Hand)g(Jeff)f (picked)i(Jack)e(of)h(Diamonds)0 8995 y(Hand)g(Chris)g(picked)g(Queen)g (of)f(Spades)0 10350 y(Hand)h(Allen)g(picked)g(Jack)f(of)h(Diamonds)0 11705 y(Hand)g(Allen:)g(Jack)g(of)f(Hearts)h(matches)g(Jack)g(of)f (Diamonds)0 13059 y(Hand)h(Jeff)f(picked)i(King)e(of)h(Clubs)0 14414 y(Hand)g(Chris)g(picked)g(King)f(of)h(Spades)0 15769 y(Hand)g(Allen)g(picked)g(10)f(of)h(Hearts)0 17124 y(Hand)g(Allen:)g(10)f(of)h(Diamonds)g(matches)g(10)g(of)f(Hearts)0 18479 y(Hand)h(Jeff)f(picked)i(Queen)e(of)h(Spades)0 19834 y(Hand)g(Chris)g(picked)g(Jack)f(of)h(Spades)0 21189 y(Hand)g(Chris:)g(Jack)g(of)f(Clubs)h(matches)g(Jack)g(of)f (Spades)0 22544 y(Hand)h(Jeff)f(picked)i(King)e(of)h(Spades)0 23899 y(Hand)g(Jeff:)g(King)f(of)h(Clubs)g(matches)g(King)g(of)f (Spades)0 25254 y(----------)i(Game)e(is)h(Over)0 26609 y(Hand)g(Allen)g(is)f(empty)0 29319 y(Hand)h(Jeff)f(contains)0 30673 y(Queen)h(of)f(Spades)0 33383 y(Hand)h(Chris)g(is)f(empty)0 36984 y Fn(So)369 b(Je\256)g(loses.)0 41495 y Fl(16.8)1792 b(Glossary)0 43660 y Fv(inheritance:)554 b Fn(The)407 b(abilit)-31 b(y)410 b(to)d(de\257ne)g(a)g(new)h(class)f(that)h(is)f(a) g(mo)31 b(di\257ed)408 b(v)-31 b(ersion)407 b(of)h(a)2767 45015 y(previously)370 b(de\257ned)f(class.)0 47256 y Fv(paren)-35 b(t)425 b(class:)553 b Fn(The)369 b(class)g(from)h(whic) -31 b(h)370 b(a)g(c)-31 b(hild)370 b(class)f(inherits.)0 49496 y Fv(c)-35 b(hild)423 b(class:)553 b Fn(A)275 b(new)g(class)g (created)g(b)-31 b(y)275 b(inheriting)h(from)g(an)f(existing)h(class;) 307 b(also)276 b(called)2767 50851 y(a)370 b(\\sub)31 b(class.")p eop %%Page: 178 204 178 203 bop 0 -2070 a Fv(178)29953 b(Inheritance)p 0 -1627 38191 45 v eop %%Page: 179 205 179 204 bop 0 9966 a Fi(Chapter)861 b(17)0 16311 y Fo(Link)-86 b(ed)1033 b(lists)0 23515 y Fl(17.1)1792 b(Em)-50 b(b)50 b(edded)600 b(references)0 25947 y Fn(W)-92 b(e)315 b(ha)-31 b(v)g(e)317 b(seen)e(examples)i(of)f(attributes)i(that)f(refer)e(to)h (other)g(ob)61 b(jects,)329 b(whic)-31 b(h)316 b(w)-31 b(e)317 b(called)0 27302 y Fv(em)-35 b(b)35 b(edded)646 b(references)562 b Fn(\(see)e(Section)i(12.8\).)1068 b(A)560 b(common)h(data)h(structure,)608 b(the)0 28657 y Fv(link)-35 b(ed)424 b(list)p Fn(,)369 b(tak)-31 b(es)370 b(adv)-61 b(an)-31 b(tage)371 b(of)f(this)f(feature.)0 30755 y(Link)-31 b(ed)339 b(lists)h(are)e(made)i(up)e(of)h Fv(no)35 b(des)p Fn(,)347 b(where)339 b(eac)-31 b(h)339 b(no)31 b(de)339 b(con)-31 b(tains)340 b(a)f(reference)f(to)i(the)0 32110 y(next)385 b(no)31 b(de)384 b(in)h(the)g(list.)540 b(In)384 b(addition,)391 b(eac)-31 b(h)385 b(no)31 b(de)384 b(con)-31 b(tains)386 b(a)f(unit)g(of)g(data)h(called)g(the)0 33465 y Fv(cargo)p Fn(.)0 35563 y(A)350 b(link)-31 b(ed)352 b(list)f(is)f(considered)g(a)g Fv(recursiv)-35 b(e)403 b(data)g(structure)351 b Fn(b)31 b(ecause)350 b(it)h(has)f(a)g(recur-)0 36918 y(siv)-31 b(e)370 b(de\257nition.)2767 39373 y(A)g(link)-31 b(ed)370 b(list)g(is)f(either:)4096 41552 y Fj(\262)554 b Fn(the)369 b(empt)-31 b(y)371 b(list,)f(represen)-31 b(ted)368 b(b)-31 b(y)370 b Fk(None)p Fn(,)g(or)4096 43288 y Fj(\262)554 b Fn(a)349 b(no)31 b(de)350 b(that)h(con)-31 b(tains)351 b(a)e(cargo)i(ob)61 b(ject)350 b(and)g(a)g(reference)e(to)j (a)e(link)-31 b(ed)5203 44643 y(list.)0 47097 y(Recursiv)g(e)369 b(data)h(structures)f(lend)g(themselv)-31 b(es)370 b(to)g(recursiv)-31 b(e)369 b(metho)31 b(ds.)0 51515 y Fl(17.2)1792 b(The)599 b Fe(Node)g Fl(class)0 53947 y Fn(As)306 b(usual)g(when)g(writing)i(a)e (new)g(class,)319 b(w)-31 b(e'll)308 b(start)e(with)i(the)e (initialization)311 b(and)p 34843 53947 349 45 v 35261 53947 V 1143 w Fk(str)p 37423 53947 V 37841 53947 V 0 55302 a Fn(metho)31 b(ds)319 b(so)g(that)h(w)-31 b(e)319 b(can)g(test)h(the)f(basic)g(mec)-31 b(hanism)320 b(of)g(creating)g (and)f(displa)-31 b(ying)321 b(the)0 56657 y(new)369 b(t)-31 b(yp)31 b(e:)p eop %%Page: 180 206 180 205 bop 0 -2070 a Fv(180)29898 b(Link)-35 b(ed)424 b(lists)p 0 -1627 38191 45 v 0 865 a Fk(class)582 b(Node:)1162 2220 y(def)g(__init__\(self,)h(cargo=None,)g(next=None\):)2325 3575 y(self.cargo)f(=)g(cargo)2325 4930 y(self.next)1163 b(=)582 b(next)1162 7640 y(def)g(__str__\(self\):)2325 8995 y(return)g(str\(self.cargo\))0 11399 y Fn(As)334 b(usual,)342 b(the)335 b(parameters)f(for)h(the)f(initialization)340 b(metho)31 b(d)335 b(are)f(optional.)484 b(By)334 b(default,)0 12754 y(b)31 b(oth)370 b(the)f(cargo)h(and)f(the)h(link,)h Fk(next)p Fn(,)f(are)f(set)g(to)h Fk(None)p Fn(.)0 15077 y(The)294 b(string)g(represen)-31 b(tation)295 b(of)f(a)g(no)31 b(de)294 b(is)g(just)f(the)h(string)h(represen)-31 b(tation)294 b(of)h(the)f(cargo.)0 16432 y(Since)376 b(an)-31 b(y)377 b(v)-61 b(alue)376 b(can)h(b)31 b(e)375 b(passed)h(to)g(the)h Fk(str)f Fn(function,)j(w)-31 b(e)377 b(can)f(store)g(an)-31 b(y)377 b(v)-61 b(alue)376 b(in)h(a)0 17787 y(list.)0 20110 y(T)-92 b(o)370 b(test)f(the)h(implemen)-31 b(tation)373 b(so)c(far,)h(w)-31 b(e)370 b(can)f(create)h(a)f Fk(Node)h Fn(and)f(prin)-31 b(t)370 b(it:)0 22514 y Fk(>>>)582 b(node)f(=)h(Node\("test"\))0 23869 y(>>>)g(print)f(node)0 25224 y(test)0 27628 y Fn(T)-92 b(o)370 b(mak)-31 b(e)370 b(it)g(in)-31 b(teresting,)371 b(w)-31 b(e)370 b(need)f(a)g(list)h (with)h(more)e(than)h(one)g(no)31 b(de:)0 30032 y Fk(>>>)582 b(node1)f(=)h(Node\(1\))0 31387 y(>>>)g(node2)f(=)h(Node\(2\))0 32742 y(>>>)g(node3)f(=)h(Node\(3\))0 35146 y Fn(This)418 b(co)31 b(de)418 b(creates)g(three)g(no)31 b(des,)430 b(but)418 b(w)-31 b(e)419 b(don't)g(ha)-31 b(v)g(e)419 b(a)f(list)h(y)-31 b(et)419 b(b)31 b(ecause)417 b(the)h(no)31 b(des)0 36501 y(are)369 b(not)h Fv(link)-35 b(ed)p Fn(.)492 b(The)369 b(state)i(diagram)f(lo)31 b(oks)370 b(lik)-31 b(e)371 b(this:)2206 37880 y 19997655 4999413 0 0 19997655 4999413 startTexFig 2206 37880 a %%BeginDocument: illustrations/link1.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: link1.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 16:22:43 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 304 76 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 76 moveto 0 0 lineto 304 0 lineto 304 76 lineto closepath clip newpath -89.0 100.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 3225 975 m 4800 975 l 4800 1650 l 3225 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1500 975 m 3075 975 l 3075 1650 l 1500 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 4950 975 m 6525 975 l 6525 1650 l 4950 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 4215 1477 m 4215 1417 l 4063 1417 l 4183 1447 l 4063 1477 l cp eoclip n 3825 1447 m 4200 1447 l gs col0 s gr gr % arrowhead n 4063 1477 m 4183 1447 l 4063 1417 l col0 s % Polyline gs clippath 4215 1177 m 4215 1117 l 4063 1117 l 4183 1147 l 4063 1177 l cp eoclip n 3825 1147 m 4200 1147 l gs col0 s gr gr % arrowhead n 4063 1177 m 4183 1147 l 4063 1117 l col0 s % Polyline gs clippath 3345 990 m 3405 990 l 3405 838 l 3375 958 l 3345 838 l cp eoclip n 3375 600 m 3375 975 l gs col0 s gr gr % arrowhead n 3345 838 m 3375 958 l 3405 838 l col0 s % Polyline gs clippath 2490 1477 m 2490 1417 l 2338 1417 l 2458 1447 l 2338 1477 l cp eoclip n 2100 1447 m 2475 1447 l gs col0 s gr gr % arrowhead n 2338 1477 m 2458 1447 l 2338 1417 l col0 s % Polyline gs clippath 2490 1177 m 2490 1117 l 2338 1117 l 2458 1147 l 2338 1177 l cp eoclip n 2100 1147 m 2475 1147 l gs col0 s gr gr % arrowhead n 2338 1177 m 2458 1147 l 2338 1117 l col0 s % Polyline gs clippath 1620 990 m 1680 990 l 1680 838 l 1650 958 l 1620 838 l cp eoclip n 1650 600 m 1650 975 l gs col0 s gr gr % arrowhead n 1620 838 m 1650 958 l 1680 838 l col0 s % Polyline gs clippath 5940 1477 m 5940 1417 l 5788 1417 l 5908 1447 l 5788 1477 l cp eoclip n 5550 1447 m 5925 1447 l gs col0 s gr gr % arrowhead n 5788 1477 m 5908 1447 l 5788 1417 l col0 s % Polyline gs clippath 5940 1177 m 5940 1117 l 5788 1117 l 5908 1147 l 5788 1177 l cp eoclip n 5550 1147 m 5925 1147 l gs col0 s gr gr % arrowhead n 5788 1177 m 5908 1147 l 5788 1117 l col0 s % Polyline gs clippath 5070 990 m 5130 990 l 5130 838 l 5100 958 l 5070 838 l cp eoclip n 5100 600 m 5100 975 l gs col0 s gr gr % arrowhead n 5070 838 m 5100 958 l 5130 838 l col0 s /Helvetica ff 165.00 scf sf 3750 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3750 1500 m gs 1 -1 sc (next) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4275 1200 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 3225 525 m gs 1 -1 sc (node2) col0 sh gr /Helvetica ff 165.00 scf sf 4275 1500 m gs 1 -1 sc (None) col0 sh gr /Helvetica ff 165.00 scf sf 2025 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1500 m gs 1 -1 sc (next) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1200 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 1500 525 m gs 1 -1 sc (node1) col0 sh gr /Helvetica ff 165.00 scf sf 2550 1500 m gs 1 -1 sc (None) col0 sh gr /Helvetica ff 165.00 scf sf 5475 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 5475 1500 m gs 1 -1 sc (next) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 6000 1200 m gs 1 -1 sc (3) col0 sh gr /Helvetica ff 165.00 scf sf 4950 525 m gs 1 -1 sc (node3) col0 sh gr /Helvetica ff 165.00 scf sf 6000 1500 m gs 1 -1 sc (None) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 48485 a Fn(T)-92 b(o)412 b(link)f(the)h(no)31 b(des,)421 b(w)-31 b(e)412 b(ha)-31 b(v)g(e)412 b(to)g(mak)-31 b(e)412 b(the)f(\257rst)f(no)31 b(de)411 b(refer)g(to)g(the)h(second)e(and)i (the)0 49840 y(second)369 b(no)31 b(de)369 b(refer)f(to)i(the)g(third:) 0 52244 y Fk(>>>)582 b(node1.next)g(=)g(node2)0 53599 y(>>>)g(node2.next)g(=)g(node3)0 56003 y Fn(The)328 b(reference)e(of)i (the)f(third)h(no)31 b(de)327 b(is)h Fk(None)p Fn(,)336 b(whic)-31 b(h)329 b(indicates)f(that)h(it)f(is)f(the)h(end)f(of)h(the) 0 57358 y(list.)494 b(No)-31 b(w)370 b(the)f(state)h(diagram)h(lo)31 b(oks)370 b(lik)-31 b(e)371 b(this:)p eop %%Page: 181 207 181 206 bop 0 -2070 a Fv(17.3)425 b(Lists)f(as)h(collections)23252 b(181)p 0 -1627 38191 45 v 2206 -242 a 19997655 4999413 0 0 19997655 4999413 startTexFig 2206 -242 a %%BeginDocument: illustrations/link2.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: link2.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 16:23:10 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 304 76 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 76 moveto 0 0 lineto 304 0 lineto 304 76 lineto closepath clip newpath -89.0 100.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 4950 975 m 6525 975 l 6525 1650 l 4950 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 3225 975 m 4575 975 l 4575 1650 l 3225 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1500 975 m 2850 975 l 2850 1650 l 1500 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 3240 1477 m 3240 1417 l 3088 1417 l 3208 1447 l 3088 1477 l cp eoclip n 2100 1447 m 3225 1447 l gs col0 s gr gr % arrowhead n 3088 1477 m 3208 1447 l 3088 1417 l col0 s % Polyline gs clippath 2490 1177 m 2490 1117 l 2338 1117 l 2458 1147 l 2338 1177 l cp eoclip n 2100 1147 m 2475 1147 l gs col0 s gr gr % arrowhead n 2338 1177 m 2458 1147 l 2338 1117 l col0 s % Polyline gs clippath 1620 990 m 1680 990 l 1680 838 l 1650 958 l 1620 838 l cp eoclip n 1650 600 m 1650 975 l gs col0 s gr gr % arrowhead n 1620 838 m 1650 958 l 1680 838 l col0 s % Polyline gs clippath 4965 1469 m 4964 1409 l 4812 1410 l 4933 1440 l 4813 1470 l cp eoclip n 3825 1447 m 4950 1440 l gs col0 s gr gr % arrowhead n 4813 1470 m 4933 1440 l 4812 1410 l col0 s % Polyline gs clippath 4215 1177 m 4215 1117 l 4063 1117 l 4183 1147 l 4063 1177 l cp eoclip n 3825 1147 m 4200 1147 l gs col0 s gr gr % arrowhead n 4063 1177 m 4183 1147 l 4063 1117 l col0 s % Polyline gs clippath 3345 990 m 3405 990 l 3405 838 l 3375 958 l 3345 838 l cp eoclip n 3375 600 m 3375 975 l gs col0 s gr gr % arrowhead n 3345 838 m 3375 958 l 3405 838 l col0 s % Polyline gs clippath 5940 1477 m 5940 1417 l 5788 1417 l 5908 1447 l 5788 1477 l cp eoclip n 5550 1447 m 5925 1447 l gs col0 s gr gr % arrowhead n 5788 1477 m 5908 1447 l 5788 1417 l col0 s % Polyline gs clippath 5940 1177 m 5940 1117 l 5788 1117 l 5908 1147 l 5788 1177 l cp eoclip n 5550 1147 m 5925 1147 l gs col0 s gr gr % arrowhead n 5788 1177 m 5908 1147 l 5788 1117 l col0 s % Polyline gs clippath 5070 990 m 5130 990 l 5130 838 l 5100 958 l 5070 838 l cp eoclip n 5100 600 m 5100 975 l gs col0 s gr gr % arrowhead n 5070 838 m 5100 958 l 5130 838 l col0 s /Helvetica ff 165.00 scf sf 2025 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1500 m gs 1 -1 sc (next) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1200 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 1500 525 m gs 1 -1 sc (node1) col0 sh gr /Helvetica ff 165.00 scf sf 3750 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3750 1500 m gs 1 -1 sc (next) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4275 1200 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 3225 525 m gs 1 -1 sc (node2) col0 sh gr /Helvetica ff 165.00 scf sf 5475 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 5475 1500 m gs 1 -1 sc (next) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 6000 1200 m gs 1 -1 sc (3) col0 sh gr /Helvetica ff 165.00 scf sf 4950 525 m gs 1 -1 sc (node3) col0 sh gr /Helvetica ff 165.00 scf sf 6000 1500 m gs 1 -1 sc (None) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 10774 a Fn(No)-31 b(w)440 b(y)-31 b(ou)440 b(kno)-31 b(w)440 b(ho)-31 b(w)440 b(to)g(create)f(no)31 b(des)438 b(and)i(link)g(them)f(in)-31 b(to)441 b(lists.)702 b(What)440 b(migh)-31 b(t)440 b(b)31 b(e)0 12129 y(less)369 b(clear)g(at)h(this)g (p)31 b(oin)-31 b(t)370 b(is)f(wh)-31 b(y)-92 b(.)0 18345 y Fl(17.3)1792 b(Lists)600 b(as)e(collections)0 21640 y Fn(Lists)364 b(are)g(useful)g(b)31 b(ecause)364 b(they)h(pro)-31 b(vide)365 b(a)f(w)-31 b(a)g(y)366 b(to)f(assem)-31 b(ble)365 b(m)-31 b(ultiple)367 b(ob)61 b(jects)365 b(in)-31 b(to)366 b(a)0 22995 y(single)409 b(en)-31 b(tit)g(y)-92 b(,)420 b(sometimes)409 b(called)h(a)e Fv(collection)p Fn(.)609 b(In)408 b(the)g(example,)420 b(the)408 b(\257rst)f(no)31 b(de)408 b(of)0 24350 y(the)369 b(list)i(serv)-31 b(es)368 b(as)h(a)g(reference)g(to)h(the)f(en)-31 b(tire)370 b(list.)0 27083 y(T)-92 b(o)455 b(pass)f(the)h(list)g(as)g(a)g(parameter,)477 b(w)-31 b(e)455 b(only)g(ha)-31 b(v)g(e)456 b(to)f(pass)f(a)h (reference)e(to)j(the)e(\257rst)0 28438 y(no)31 b(de.)472 b(F)-92 b(or)307 b(example,)321 b(the)308 b(function)g Fk(printList)h Fn(tak)-31 b(es)308 b(a)g(single)g(no)31 b(de)307 b(as)g(an)h(argumen)-31 b(t.)0 29793 y(Starting)371 b(with)f(the)g(head)f(of)h(the)f(list,)i(it)f(prin)-31 b(ts)369 b(eac)-31 b(h)370 b(no)31 b(de)369 b(un)-31 b(til)371 b(it)f(gets)f(to)h(the)g(end:)0 32608 y Fk(def)582 b(printList\(node\):)1162 33963 y(while)g(node:)2325 35318 y(print)f(node,)2325 36672 y(node)g(=)h(node.next)1162 38027 y(print)0 40842 y Fn(T)-92 b(o)370 b(in)-31 b(v)g(ok)g(e)371 b(this)e(metho)31 b(d,)371 b(w)-31 b(e)370 b(pass)e(a)i(reference)e(to) i(the)g(\257rst)e(no)31 b(de:)0 43657 y Fk(>>>)582 b (printList\(node1\))0 45012 y(1)f(2)h(3)0 47826 y Fn(Inside)398 b Fk(printList)i Fn(w)-31 b(e)400 b(ha)-31 b(v)g(e)400 b(a)f(reference)f(to)h(the)g(\257rst)f(no)31 b(de)399 b(of)h(the)f(list,)407 b(but)399 b(there)g(is)0 49181 y(no)368 b(v)-61 b(ariable)369 b(that)g(refers)d(to)i(the)g(other)g(no) 31 b(des.)492 b(W)-92 b(e)367 b(ha)-31 b(v)g(e)369 b(to)f(use)f(the)h Fk(next)g Fn(v)-61 b(alue)368 b(from)0 50536 y(eac)-31 b(h)370 b(no)31 b(de)369 b(to)h(get)g(to)g(the)f(next)h(no)31 b(de.)0 53270 y(T)-92 b(o)393 b(tra)-31 b(v)g(erse)392 b(a)g(link)-31 b(ed)394 b(list,)399 b(it)393 b(is)f(common)h(to)g(use)f (a)g(lo)31 b(op)393 b(v)-61 b(ariable)393 b(lik)-31 b(e)393 b Fk(node)g Fn(to)g(refer)0 54625 y(to)370 b(eac)-31 b(h)370 b(of)f(the)h(no)31 b(des)369 b(in)g(succession.)0 57358 y(This)h(diagram)g(sho)-31 b(ws)370 b(the)f(v)-61 b(alue)370 b(of)g Fk(list)f Fn(and)h(the)f(v)-61 b(alues)369 b(that)i Fk(node)e Fn(tak)-31 b(es)371 b(on:)p eop %%Page: 182 208 182 207 bop 0 -2070 a Fv(182)29898 b(Link)-35 b(ed)424 b(lists)p 0 -1627 38191 45 v 2206 -242 a 19997655 7301775 0 0 19997655 7301775 startTexFig 2206 -242 a %%BeginDocument: illustrations/link3.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: link3.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Tue Dec 11 10:59:36 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 304 111 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 111 moveto 0 0 lineto 304 0 lineto 304 111 lineto closepath clip newpath -89.0 135.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 4950 975 m 6525 975 l 6525 1650 l 4950 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 3225 975 m 4575 975 l 4575 1650 l 3225 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1500 975 m 2850 975 l 2850 1650 l 1500 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 1620 990 m 1680 990 l 1680 838 l 1650 958 l 1620 838 l cp eoclip n 1650 600 m 1650 975 l gs col0 s gr gr % arrowhead n 1620 838 m 1650 958 l 1680 838 l col0 s /Helvetica ff 165.00 scf sf 1500 525 m gs 1 -1 sc (node1) col0 sh gr % Polyline gs clippath 3240 1477 m 3240 1417 l 3088 1417 l 3208 1447 l 3088 1477 l cp eoclip n 2100 1447 m 3225 1447 l gs col0 s gr gr % arrowhead n 3088 1477 m 3208 1447 l 3088 1417 l col0 s % Polyline gs clippath 2490 1177 m 2490 1117 l 2338 1117 l 2458 1147 l 2338 1177 l cp eoclip n 2100 1147 m 2475 1147 l gs col0 s gr gr % arrowhead n 2338 1177 m 2458 1147 l 2338 1117 l col0 s % Polyline gs clippath 4965 1469 m 4964 1409 l 4812 1410 l 4933 1440 l 4813 1470 l cp eoclip n 3825 1447 m 4950 1440 l gs col0 s gr gr % arrowhead n 4813 1470 m 4933 1440 l 4812 1410 l col0 s % Polyline gs clippath 4215 1177 m 4215 1117 l 4063 1117 l 4183 1147 l 4063 1177 l cp eoclip n 3825 1147 m 4200 1147 l gs col0 s gr gr % arrowhead n 4063 1177 m 4183 1147 l 4063 1117 l col0 s % Polyline gs clippath 3345 990 m 3405 990 l 3405 838 l 3375 958 l 3345 838 l cp eoclip n 3375 600 m 3375 975 l gs col0 s gr gr % arrowhead n 3345 838 m 3375 958 l 3405 838 l col0 s % Polyline gs clippath 5940 1477 m 5940 1417 l 5788 1417 l 5908 1447 l 5788 1477 l cp eoclip n 5550 1447 m 5925 1447 l gs col0 s gr gr % arrowhead n 5788 1477 m 5908 1447 l 5788 1417 l col0 s % Polyline gs clippath 5940 1177 m 5940 1117 l 5788 1117 l 5908 1147 l 5788 1177 l cp eoclip n 5550 1147 m 5925 1147 l gs col0 s gr gr % arrowhead n 5788 1177 m 5908 1147 l 5788 1117 l col0 s % Polyline gs clippath 5070 990 m 5130 990 l 5130 838 l 5100 958 l 5070 838 l cp eoclip n 5100 600 m 5100 975 l gs col0 s gr gr % arrowhead n 5070 838 m 5100 958 l 5130 838 l col0 s % Polyline gs clippath 4977 1669 m 4948 1616 l 4815 1689 l 4935 1658 l 4844 1741 l cp eoclip n 4125 2100 m 4950 1650 l gs col0 s gr gr % arrowhead n 4844 1741 m 4935 1658 l 4815 1689 l col0 s % Polyline [15 45] 45 sd n 3675 2100 m 2850 1650 l gs col0 s gr [] 0 sd % Polyline [15 45] 45 sd n 3900 2100 m 3900 1650 l gs col0 s gr [] 0 sd /Helvetica ff 165.00 scf sf 2025 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1500 m gs 1 -1 sc (y) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1200 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 3750 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3750 1500 m gs 1 -1 sc (y) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4275 1200 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 3225 525 m gs 1 -1 sc (node2) col0 sh gr /Helvetica ff 165.00 scf sf 5475 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 5475 1500 m gs 1 -1 sc (y) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 6000 1200 m gs 1 -1 sc (3) col0 sh gr /Helvetica ff 165.00 scf sf 4950 525 m gs 1 -1 sc (node3) col0 sh gr /Helvetica ff 165.00 scf sf 6000 1500 m gs 1 -1 sc (None) col0 sh gr /Helvetica ff 165.00 scf sf 3750 2250 m gs 1 -1 sc (node) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 2767 14398 a Fm(By)464 b(c)-57 b(onvention,)482 b(lists)463 b(ar)-57 b(e)463 b(often)h(printe)-57 b(d)464 b(in)g(br)-57 b(ackets)463 b(with)f(c)-57 b(ommas)464 b(b)-57 b(e-)2767 15753 y(twe)g(en)662 b(the)f(elements,)728 b(as)660 b(in)i Fk([1,)582 b(2,)f(3])p Fm(.)1305 b(As)661 b(an)g(exer)-57 b(cise,)728 b(mo)-57 b(dify)2767 17108 y Fk(printList)398 b Fm(so)d(that)g(it)i(gener)-57 b(ates)396 b(output)f(in)i(this)f (format.)0 21532 y Fl(17.4)1792 b(Lists)600 b(and)e(recursion)0 23969 y Fn(It)418 b(is)g(natural)i(to)f(express)e(man)-31 b(y)419 b(list)g(op)31 b(erations)419 b(using)g(recursiv)-31 b(e)417 b(metho)31 b(ds.)641 b(F)-92 b(or)417 b(ex-)0 25324 y(ample,)371 b(the)e(follo)-31 b(wing)373 b(is)c(a)h(recursiv)-31 b(e)368 b(algorithm)k(for)e(prin)-31 b(ting)370 b(a)g(list)g(bac)-31 b(kw)g(ards:)1353 27793 y(1.)554 b(Separate)348 b(the)f(list)h(in)-31 b(to)349 b(t)-31 b(w)g(o)348 b(pieces:)482 b(the)347 b(\257rst)f(no)31 b(de)347 b(\(called)i(the)e(head\);)355 b(and)348 b(the)2767 29148 y(rest)369 b(\(called)i(the)e(tail\).)1353 31330 y(2.)554 b(Prin)-31 b(t)371 b(the)e(tail)i(bac)-31 b(kw)g(ard.)1353 33513 y(3.)554 b(Prin)-31 b(t)371 b(the)e(head.)0 35982 y(Of)450 b(course,)469 b(Step)450 b(2,)471 b(the)450 b(recursiv)-31 b(e)449 b(call,)471 b(assumes)450 b(that)g(w)-31 b(e)451 b(ha)-31 b(v)g(e)450 b(a)g(w)-31 b(a)g(y)451 b(of)f(prin)-31 b(ting)0 37337 y(a)462 b(list)g(bac)-31 b(kw)g(ard.)772 b(But)462 b(if)g(w)-31 b(e)462 b(assume)g(that)h(the)f (recursiv)-31 b(e)461 b(call)i(w)-31 b(orks|the)462 b(leap)g(of)0 38692 y(faith|then)371 b(w)-31 b(e)370 b(can)f(con)-31 b(vince)371 b(ourselv)-31 b(es)369 b(that)h(this)g(algorithm)i(w)-31 b(orks.)0 40795 y(All)504 b(w)-31 b(e)504 b(need)e(are)h(a)h(base)f (case)f(and)i(a)f(w)-31 b(a)g(y)505 b(of)e(pro)-31 b(ving)505 b(that)f(for)f(an)-31 b(y)504 b(list,)538 b(w)-31 b(e)503 b(will)0 42150 y(ev)-31 b(en)g(tually)305 b(get)f(to)g(the)f(base)f (case.)471 b(Giv)-31 b(en)303 b(the)g(recursiv)-31 b(e)302 b(de\257nition)j(of)e(a)g(list,)318 b(a)303 b(natural)0 43505 y(base)369 b(case)g(is)g(the)h(empt)-31 b(y)370 b(list,)h(represen)-31 b(ted)368 b(b)-31 b(y)369 b Fk(None)p Fn(:)0 45689 y Fk(def)582 b(printBackward\(list\):)1162 47044 y(if)g(list)f(==)h(None:)g(return)1162 48399 y(head)g(=)f(list) 1162 49754 y(tail)h(=)f(list.next)1162 51109 y(printBackward\(tail\)) 1162 52464 y(print)h(head,)0 54648 y Fn(The)388 b(\257rst)f(line)i (handles)f(the)g(base)g(case)g(b)-31 b(y)388 b(doing)h(nothing.)550 b(The)388 b(next)g(t)-31 b(w)g(o)390 b(lines)e(split)0 56003 y(the)434 b(list)h(in)-31 b(to)435 b Fk(head)f Fn(and)g Fk(tail)p Fn(.)687 b(The)434 b(last)g(t)-31 b(w)g(o)436 b(lines)e(prin)-31 b(t)434 b(the)g(list.)688 b(The)434 b(comma)h(at)0 57358 y(the)369 b(end)g(of)h(the)g(last)g (line)g(k)-31 b(eeps)369 b(Python)h(from)g(prin)-31 b(ting)370 b(a)g(newline)g(after)g(eac)-31 b(h)370 b(no)31 b(de.)p eop %%Page: 183 209 183 208 bop 0 -2070 a Fv(17.5)425 b(In\257nite)g(lists)26926 b(183)p 0 -1627 38191 45 v 0 865 a Fn(W)-92 b(e)368 b(in)-31 b(v)g(ok)g(e)372 b(this)d(metho)31 b(d)370 b(as)f(w)-31 b(e)370 b(in)-31 b(v)g(ok)g(ed)371 b Fk(printList)p Fn(:)0 3078 y Fk(>>>)582 b(printBackward\(node1\))0 4433 y(3)f(2)h(1)0 6645 y Fn(The)369 b(result)h(is)f(a)g(bac)-31 b(kw)g(ard)371 b(list.)0 8777 y(Y)-92 b(ou)421 b(migh)-31 b(t)423 b(w)-31 b(onder)421 b(wh)-31 b(y)422 b Fk(printList)g Fn(and)f Fk(printBackward)h Fn(are)f(functions)h(and)f(not)0 10132 y(metho)31 b(ds)336 b(in)f(the)g Fk(Node)h Fn(class.)481 b(The)335 b(reason)g(is)g(that)i(w)-31 b(e)335 b(w)-31 b(an)g(t)337 b(to)f(use)e Fk(None)i Fn(to)g(represen)-31 b(t)0 11487 y(the)398 b(empt)-31 b(y)399 b(list)g(and)f(it)g(is)g(not)g (legal)i(to)e(in)-31 b(v)g(ok)g(e)400 b(a)e(metho)31 b(d)399 b(on)f Fk(None)p Fn(.)579 b(This)398 b(limitation)0 12842 y(mak)-31 b(es)515 b(it)h(a)-31 b(wkw)g(ard)516 b(to)g(write)f(list-manipulating)520 b(co)31 b(de)514 b(in)h(a)g(clean)g(ob)61 b(ject-orien)-31 b(ted)0 14197 y(st)g(yle.)0 16328 y(Can)378 b(w)-31 b(e)378 b(pro)-31 b(v)g(e)378 b(that)g Fk(printBackward)h Fn(will)g(alw)-31 b(a)g(ys)380 b(terminate?)518 b(In)377 b(other)g(w)-31 b(ords,)380 b(will)0 17683 y(it)415 b(alw)-31 b(a)g(ys)417 b(reac)-31 b(h)415 b(the)f(base)h(case?)628 b(In)414 b(fact,)427 b(the)415 b(answ)-31 b(er)415 b(is)f(no.)629 b(Some)415 b(lists)g(will)i(mak)-31 b(e)0 19038 y(this)370 b(metho)31 b(d)370 b(crash.)0 23502 y Fl(17.5)1792 b(In\257nite)599 b(lists)0 25967 y Fn(There)332 b(is)g(nothing)i(to)f(prev)-31 b(en)g(t)333 b(a)g(no)31 b(de)332 b(from)h(referring)f(bac)-31 b(k)333 b(to)g(an)f(earlier)h(no)31 b(de)332 b(in)h(the)0 27322 y(list,)419 b(including)410 b(itself.)610 b(F)-92 b(or)407 b(example,)420 b(this)408 b(\257gure)g(sho)-31 b(ws)409 b(a)f(list)h(with)g(t)-31 b(w)g(o)410 b(no)31 b(des,)418 b(one)0 28677 y(of)370 b(whic)-31 b(h)370 b(refers)e(to)i(itself:)8706 29841 y 12301189 6183485 0 0 12301189 6183485 startTexFig 8706 29841 a %%BeginDocument: illustrations/link4.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: link4.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 16:55:09 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 187 94 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 94 moveto 0 0 lineto 187 0 lineto 187 94 lineto closepath clip newpath -89.0 118.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 3225 975 m 4575 975 l 4575 1650 l 3225 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1500 975 m 2850 975 l 2850 1650 l 1500 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Arc n 3812.5 1687.5 262.8 -87.3 87.3 arc gs col0 s gr % Arc gs clippath 3553 1631 m 3493 1638 l 3511 1788 l 3527 1666 l 3571 1781 l cp eoclip n 3787.5 1687.5 265.2 81.9 -171.9 arc gs col0 s gr gr % arrowhead n 3571 1781 m 3527 1666 l 3511 1788 l col0 s % Polyline gs clippath 2490 1177 m 2490 1117 l 2338 1117 l 2458 1147 l 2338 1177 l cp eoclip n 2100 1147 m 2475 1147 l gs col0 s gr gr % arrowhead n 2338 1177 m 2458 1147 l 2338 1117 l col0 s % Polyline gs clippath 4215 1177 m 4215 1117 l 4063 1117 l 4183 1147 l 4063 1177 l cp eoclip n 3825 1147 m 4200 1147 l gs col0 s gr gr % arrowhead n 4063 1177 m 4183 1147 l 4063 1117 l col0 s % Polyline gs clippath 1620 990 m 1680 990 l 1680 838 l 1650 958 l 1620 838 l cp eoclip n 1650 600 m 1650 975 l gs col0 s gr gr % arrowhead n 1620 838 m 1650 958 l 1680 838 l col0 s % Polyline gs clippath 3240 1477 m 3240 1417 l 3088 1417 l 3208 1447 l 3088 1477 l cp eoclip n 2100 1447 m 3225 1447 l gs col0 s gr gr % arrowhead n 3088 1477 m 3208 1447 l 3088 1417 l col0 s /Helvetica ff 165.00 scf sf 2025 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1500 m gs 1 -1 sc (next) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1200 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 3750 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3750 1500 m gs 1 -1 sc (next) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4275 1200 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 1500 525 m gs 1 -1 sc (list) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 42255 a Fn(If)702 b(w)-31 b(e)703 b(in)-31 b(v)g(ok)g(e)705 b Fk(printList)e Fn(on)g(this)g(list,)787 b(it)703 b(will)i(lo)31 b(op)703 b(forev)-31 b(er.)1493 b(If)702 b(w)-31 b(e)703 b(in)-31 b(v)g(ok)g(e)0 43610 y Fk(printBackward)p Fn(,)450 b(it)433 b(will)h(recurse)d(in\257nitely)-92 b(.)683 b(This)433 b(sort)f(of)h(b)31 b(eha)-31 b(vior)433 b(mak)-31 b(es)433 b(in\257nite)0 44965 y(lists)370 b(di\261cult)h(to)f(w)-31 b(ork)370 b(with.)0 47097 y(Nev)-31 b(ertheless,)434 b(they)422 b(are)e(o)31 b(ccasionally)424 b(useful.)648 b(F)-92 b(or)420 b(example,)435 b(w)-31 b(e)422 b(migh)-31 b(t)423 b(represen)-31 b(t)420 b(a)0 48452 y(n)-31 b(um)g(b)31 b(er)273 b(as)h(a)g(list)g(of)g(digits)h(and)e(use)g(an)h(in\257nite)h (list)f(to)g(represen)-31 b(t)273 b(a)h(rep)31 b(eating)274 b(fraction.)0 50584 y(Regardless,)814 b(it)725 b(is)g(problematic)i (that)f(w)-31 b(e)725 b(cannot)h(pro)-31 b(v)g(e)725 b(that)h Fk(printList)g Fn(and)0 51938 y Fk(printBackward)411 b Fn(terminate.)614 b(The)410 b(b)31 b(est)408 b(w)-31 b(e)410 b(can)f(do)h(is)f(the)g(h)-31 b(yp)31 b(othetical)412 b(statemen)-31 b(t,)0 53293 y(\\If)378 b(the)h(list)g(con)-31 b(tains)379 b(no)f(lo)31 b(ops,)382 b(then)c(these)g(metho)31 b(ds)379 b(will)g(terminate.")522 b(This)378 b(sort)g(of)0 54648 y(claim)h(is)f(called)g(a)g Fv(precondition)p Fn(.)519 b(It)378 b(imp)31 b(oses)378 b(a)g(constrain)-31 b(t)379 b(on)f(one)f(of)h(the)g(parame-)0 56003 y(ters)344 b(and)h(describ)31 b(es)344 b(the)h(b)31 b(eha)-31 b(vior)345 b(of)h(the)f(metho)31 b(d)345 b(if)h(the)f(constrain)-31 b(t)346 b(is)f(satis\257ed.)485 b(Y)-92 b(ou)0 57358 y(will)371 b(see)e(more)g(examples)h(so)31 b(on.)p eop %%Page: 184 210 184 209 bop 0 -2070 a Fv(184)29898 b(Link)-35 b(ed)424 b(lists)p 0 -1627 38191 45 v 0 865 a Fl(17.6)1792 b(The)599 b(fundamen)-50 b(tal)599 b(am)-50 b(biguit)g(y)600 b(theorem)0 3252 y Fn(One)369 b(part)g(of)h Fk(printBackward)h Fn(migh)-31 b(t)371 b(ha)-31 b(v)g(e)370 b(raised)f(an)h(ey)-31 b(ebro)g(w:)2325 5387 y Fk(head)581 b(=)h(list)2325 6742 y(tail)f(=)h(list.next)0 8877 y Fn(After)473 b(the)g(\257rst)f(assignmen)-31 b(t,)501 b Fk(head)473 b Fn(and)g Fk(list)g Fn(ha)-31 b(v)g(e)474 b(the)e(same)i(t)-31 b(yp)31 b(e)473 b(and)g(the)g(same)0 10232 y(v)-61 b(alue.)493 b(So)370 b(wh)-31 b(y)370 b(did)f(w)-31 b(e)370 b(create)f(a)h(new)f(v)-61 b(ariable?)0 12285 y(The)361 b(reason)f(is)h(that)h(the)f(t)-31 b(w)g(o)362 b(v)-61 b(ariables)361 b(pla)-31 b(y)362 b(di\256eren)-31 b(t)361 b(roles.)490 b(W)-92 b(e)359 b(think)j(of)f Fk(head)g Fn(as)g(a)0 13640 y(reference)353 b(to)i(a)g(single)g(no)31 b(de,)357 b(and)e(w)-31 b(e)355 b(think)g(of)f Fk(list)h Fn(as)f(a)h(reference)e(to)i(the)f(\257rst)g(no)31 b(de)0 14995 y(of)340 b(a)h(list.)484 b(These)339 b(\\roles")i(are)f(not)h (part)f(of)h(the)f(program;)351 b(they)340 b(are)g(in)g(the)g(mind)h (of)g(the)0 16350 y(programmer.)0 18404 y(In)309 b(general)h(w)-31 b(e)310 b(can't)g(tell)h(b)-31 b(y)309 b(lo)31 b(oking)312 b(at)e(a)g(program)g(what)g(role)g(a)g(v)-61 b(ariable)310 b(pla)-31 b(ys.)474 b(This)0 19759 y(am)-31 b(biguit)g(y)437 b(can)d(b)31 b(e)434 b(useful,)451 b(but)434 b(it)g(can)h(also)f(mak) -31 b(e)435 b(programs)g(di\261cult)g(to)g(read.)687 b(W)-92 b(e)0 21114 y(often)346 b(use)f(v)-61 b(ariable)346 b(names)g(lik)-31 b(e)346 b Fk(node)g Fn(and)f Fk(list)h Fn(to)g(do)31 b(cumen)-31 b(t)346 b(ho)-31 b(w)347 b(w)-31 b(e)345 b(in)-31 b(tend)347 b(to)f(use)0 22469 y(a)369 b(v)-61 b(ariable)371 b(and)e(sometimes)i(create)e(additional)j(v)-61 b(ariables)370 b(to)g(disam)-31 b(biguate.)0 24522 y(W)-92 b(e)348 b(could)h(ha)-31 b(v)g(e)350 b(written)g Fk(printBackward)g Fn(without)h Fk(head)e Fn(and)g Fk(tail)p Fn(,)354 b(whic)-31 b(h)350 b(mak)-31 b(es)349 b(it)0 25877 y(more)369 b(concise)h(but)f(p) 31 b(ossibly)370 b(less)f(clear:)0 28012 y Fk(def)582 b(printBackward\(list\))i(:)1162 29367 y(if)e(list)f(==)h(None)g(:)f (return)1162 30722 y(printBackward\(list.next\))1162 32077 y(print)h(list,)0 34211 y Fn(Lo)31 b(oking)443 b(at)f(the)g(t)-31 b(w)g(o)443 b(function)f(calls,)461 b(w)-31 b(e)442 b(ha)-31 b(v)g(e)442 b(to)g(remem)-31 b(b)31 b(er)442 b(that)g Fk(printBackward)0 35566 y Fn(treats)468 b(its)g(argumen)-31 b(t)470 b(as)d(a)i(collection)h(and)e Fk(print)g Fn(treats)h(its)f(argumen)-31 b(t)469 b(as)f(a)g(single)0 36921 y(ob)61 b(ject.)0 38975 y(The)315 b Fv(fundamen)-35 b(tal)362 b(am)-35 b(biguit)g(y)360 b(theorem)316 b Fn(describ)31 b(es)314 b(the)h(am)-31 b(biguit)g(y)318 b(that)e(is)e(inher-)0 40330 y(en)-31 b(t)370 b(in)f(a)h(reference)e(to)i(a)f(no)31 b(de:)2767 42657 y Fv(A)447 b(v)-71 b(ariable)447 b(that)g(refers)h(to) f(a)g(no)35 b(de)448 b(migh)-35 b(t)446 b(treat)i(the)f(no)35 b(de)448 b(as)f(a)2767 44012 y(single)425 b(ob)71 b(ject)425 b(or)g(as)g(the)g(\257rst)g(in)f(a)g(list)g(of)h(no)35 b(des.)0 48366 y Fl(17.7)1792 b(Mo)50 b(difying)598 b(lists)0 50754 y Fn(There)339 b(are)g(t)-31 b(w)g(o)340 b(w)-31 b(a)g(ys)340 b(to)g(mo)31 b(dify)341 b(a)e(link)-31 b(ed)340 b(list.)483 b(Ob)-31 b(viously)-92 b(,)347 b(w)-31 b(e)340 b(can)f(c)-31 b(hange)340 b(the)f(cargo)0 52108 y(of)374 b(one)f(of)g(the)h(no)31 b(des,)374 b(but)f(the)h(more)f(in)-31 b(teresting)375 b(op)31 b(erations)374 b(are)f(the)g(ones)g(that)h (add,)0 53463 y(remo)-31 b(v)g(e,)371 b(or)e(reorder)f(the)h(no)31 b(des.)0 55517 y(As)425 b(an)g(example,)440 b(let's)426 b(write)g(a)f(metho)31 b(d)426 b(that)g(remo)-31 b(v)g(es)425 b(the)g(second)g(no)31 b(de)425 b(in)g(the)g(list)0 56872 y(and)369 b(returns)g(a)g(reference)f(to)i(the)g(remo)-31 b(v)g(ed)370 b(no)31 b(de:)p eop %%Page: 185 211 185 210 bop 0 -2070 a Fv(17.8)425 b(W)-106 b(rapp)35 b(ers)426 b(and)f(help)35 b(ers)21304 b(185)p 0 -1627 38191 45 v 0 865 a Fk(def)582 b(removeSecond\(list\):)1162 2220 y(if)g(list)f(==)h(None:)g(return)1162 3575 y(first)g(=)f(list) 1162 4930 y(second)h(=)g(list.next)1162 6285 y(#)g(make)f(the)h(first)g (node)g(refer)f(to)h(the)g(third)1162 7640 y(first.next)h(=)e (second.next)1162 8995 y(#)h(separate)g(the)g(second)g(node)f(from)h (the)g(rest)f(of)h(the)f(list)1162 10350 y(second.next)i(=)e(None)1162 11705 y(return)h(second)0 13909 y Fn(Again,)349 b(w)-31 b(e)342 b(are)f(using)g(temp)31 b(orary)342 b(v)-61 b(ariables)342 b(to)g(mak)-31 b(e)343 b(the)e(co)31 b(de)342 b(more)f(readable.)484 b(Here)0 15264 y(is)369 b(ho)-31 b(w)370 b(to)g(use)f(this)g(metho)31 b(d:)0 17468 y Fk(>>>)582 b(printList\(node1\))0 18823 y(1)f(2)h(3)0 20178 y(>>>)g(removed)g(=)f(removeSecond\(node1\))0 21533 y(>>>)h(printList\(removed\))0 22888 y(2)0 24243 y(>>>)g(printList\(node1\))0 25598 y(1)f(3)0 27802 y Fn(This)370 b(state)g(diagram)h(sho)-31 b(ws)369 b(the)g(e\256ect)h(of) f(the)h(op)31 b(eration:)2206 29181 y 19997655 6183485 0 0 19997655 6183485 startTexFig 2206 29181 a %%BeginDocument: illustrations/link5.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: link5.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Thu Dec 6 16:26:17 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 304 94 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 94 moveto 0 0 lineto 304 0 lineto 304 94 lineto closepath clip newpath -89.0 118.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 4950 975 m 6525 975 l 6525 1650 l 4950 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 3225 975 m 4575 975 l 4575 1650 l 3225 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1500 975 m 2850 975 l 2850 1650 l 1500 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Arc gs clippath 4976 1670 m 4950 1616 l 4813 1682 l 4935 1657 l 4840 1736 l cp eoclip n 3707.2 -771.0 2721.3 126.2 62.8 arcn gs col0 s gr gr % arrowhead n 4840 1736 m 4935 1657 l 4813 1682 l col0 s % Polyline gs clippath 2490 1177 m 2490 1117 l 2338 1117 l 2458 1147 l 2338 1177 l cp eoclip n 2100 1147 m 2475 1147 l gs col0 s gr gr % arrowhead n 2338 1177 m 2458 1147 l 2338 1117 l col0 s % Polyline [15 45] 45 sd n 3825 1447 m 4950 1440 l gs col0 s gr [] 0 sd % Polyline gs clippath 4215 1177 m 4215 1117 l 4063 1117 l 4183 1147 l 4063 1177 l cp eoclip n 3825 1147 m 4200 1147 l gs col0 s gr gr % arrowhead n 4063 1177 m 4183 1147 l 4063 1117 l col0 s % Polyline gs clippath 3345 990 m 3405 990 l 3405 838 l 3375 958 l 3345 838 l cp eoclip n 3375 600 m 3375 975 l gs col0 s gr gr % arrowhead n 3345 838 m 3375 958 l 3405 838 l col0 s % Polyline gs clippath 5940 1477 m 5940 1417 l 5788 1417 l 5908 1447 l 5788 1477 l cp eoclip n 5550 1447 m 5925 1447 l gs col0 s gr gr % arrowhead n 5788 1477 m 5908 1447 l 5788 1417 l col0 s % Polyline gs clippath 5940 1177 m 5940 1117 l 5788 1117 l 5908 1147 l 5788 1177 l cp eoclip n 5550 1147 m 5925 1147 l gs col0 s gr gr % arrowhead n 5788 1177 m 5908 1147 l 5788 1117 l col0 s % Polyline gs clippath 1620 990 m 1680 990 l 1680 838 l 1650 958 l 1620 838 l cp eoclip n 1650 600 m 1650 975 l gs col0 s gr gr % arrowhead n 1620 838 m 1650 958 l 1680 838 l col0 s % Polyline [15 45] 45 sd n 2100 1447 m 3225 1447 l gs col0 s gr [] 0 sd /Helvetica ff 165.00 scf sf 2025 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1500 m gs 1 -1 sc (next) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1200 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 3750 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3750 1500 m gs 1 -1 sc (next) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4275 1200 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 3225 525 m gs 1 -1 sc (second) col0 sh gr /Helvetica ff 165.00 scf sf 5475 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 5475 1500 m gs 1 -1 sc (next) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 6000 1200 m gs 1 -1 sc (3) col0 sh gr /Helvetica ff 165.00 scf sf 6000 1500 m gs 1 -1 sc (None) col0 sh gr /Helvetica ff 165.00 scf sf 1500 525 m gs 1 -1 sc (first) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 41587 a Fn(What)370 b(happ)31 b(ens)368 b(if)i(y)-31 b(ou)370 b(in)-31 b(v)g(ok)g(e)371 b(this)f(metho)31 b(d)370 b(and)f(pass)g(a)g(list)i(with)f(only)g(one)g(elemen)-31 b(t)0 42942 y(\(a)428 b Fv(singleton)p Fn(\)?)666 b(What)428 b(happ)31 b(ens)426 b(if)h(y)-31 b(ou)428 b(pass)e(the)i(empt)-31 b(y)428 b(list)f(as)g(an)g(argumen)-31 b(t?)667 b(Is)0 44297 y(there)306 b(a)h(precondition)i(for)d(this)i(metho)31 b(d?)472 b(If)306 b(so,)320 b(\257x)306 b(the)h(metho)31 b(d)308 b(to)f(handle)h(a)f(violation)0 45652 y(of)370 b(the)f(precondition)i(in)e(a)h(reasonable)g(w)-31 b(a)g(y)-92 b(.)0 50104 y Fl(17.8)1792 b(W)-149 b(rapp)50 b(ers)599 b(and)f(help)50 b(ers)0 52561 y Fn(It)412 b(is)f(often)i(useful)f(to)h (divide)f(a)g(list)h(op)31 b(eration)413 b(in)-31 b(to)413 b(t)-31 b(w)g(o)414 b(metho)31 b(ds.)621 b(F)-92 b(or)411 b(example,)424 b(to)0 53916 y(prin)-31 b(t)367 b(a)g(list)h(bac)-31 b(kw)g(ard)368 b(in)g(the)f(con)-31 b(v)g(en)g(tional)370 b(list)e(format)g Fk([3,)582 b(2,)f(1])367 b Fn(w)-31 b(e)367 b(can)g(use)g(the)0 55271 y Fk(printBackward)335 b Fn(metho)31 b(d)335 b(to)f(prin)-31 b(t)334 b Fk(3,)581 b(2,)341 b Fn(but)334 b(w)-31 b(e)334 b(need)f(a)h(separate)g(metho)31 b(d)334 b(to)g(prin)-31 b(t)0 56626 y(the)369 b(brac)-31 b(k)g(ets)370 b(and)g(the)f(\257rst)g(no)31 b(de.)492 b(Let's)370 b(call)g(it)g Fk(printBackwardNicely)p Fn(:)p eop %%Page: 186 212 186 211 bop 0 -2070 a Fv(186)29898 b(Link)-35 b(ed)424 b(lists)p 0 -1627 38191 45 v 0 865 a Fk(def)582 b (printBackwardNicely\(list\))i(:)1162 2220 y(print)e("[",)1162 3575 y(if)g(list)f(!=)h(None)g(:)2325 4930 y(head)f(=)h(list)2325 6285 y(tail)f(=)h(list.next)2325 7640 y(printBackward\(tail\))2325 8995 y(print)f(head,)1162 10350 y(print)h("]",)0 12546 y Fn(Again,)523 b(it)491 b(is)f(a)h(go)31 b(o)g(d)491 b(idea)h(to)f(c)-31 b(hec)g(k)491 b(metho)31 b(ds)491 b(lik)-31 b(e)491 b(this)g(to)h(see)d(if)i(they)g(w)-31 b(ork)492 b(with)0 13901 y(sp)31 b(ecial)370 b(cases)e(lik)-31 b(e)371 b(an)e(empt)-31 b(y)371 b(list)f(or)f(a)g(singleton.)0 16017 y(When)1119 b(w)-31 b(e)1120 b(use)f(this)h(metho)31 b(d)1120 b(elsewhere)f(in)h(the)g(program,)1308 b(w)-31 b(e)1120 b(in)-31 b(v)g(ok)g(e)0 17372 y Fk(printBackwardNicely)673 b Fn(directly)-92 b(,)747 b(and)670 b(it)i(in)-31 b(v)g(ok)g(es)672 b Fk(printBackward)g Fn(on)e(our)g(b)31 b(e-)0 18727 y(half.)968 b(In)527 b(that)i(sense,)566 b Fk(printBackwardNicely)530 b Fn(acts)e(as)f(a)h Fv(wrapp)35 b(er)p Fn(,)569 b(and)528 b(it)g(uses)0 20082 y Fk(printBackward)371 b Fn(as)e(a)g Fv(help)35 b(er)p Fn(.)0 24524 y Fl(17.9)1792 b(The)599 b Fe(LinkedList)h Fl(class)0 26973 y Fn(There)348 b(are)f(some)i (subtle)f(problems)g(with)h(the)g(w)-31 b(a)g(y)349 b(w)-31 b(e)348 b(ha)-31 b(v)g(e)349 b(b)31 b(een)348 b(implemen)-31 b(ting)351 b(lists.)0 28328 y(In)453 b(a)i(rev)-31 b(ersal)454 b(of)g(cause)g(and)g(e\256ect,)475 b(w)-31 b(e'll)456 b(prop)31 b(ose)454 b(an)g(alternativ)-31 b(e)457 b(implemen)-31 b(tation)0 29683 y(\257rst)369 b(and)g(then)g(explain)i(what)g (problems)e(it)h(solv)-31 b(es.)0 31799 y(First,)404 b(w)-31 b(e'll)400 b(create)d(a)h(new)f(class)g(called)i Fk(LinkedList)p Fn(.)578 b(Its)397 b(attributes)h(are)f(an)h(in)-31 b(teger)0 33154 y(that)292 b(con)-31 b(tains)293 b(the)e(length)h(of)g (the)f(list)h(and)f(a)g(reference)g(to)g(the)h(\257rst)e(no)31 b(de.)467 b Fk(LinkedList)0 34509 y Fn(ob)61 b(jects)370 b(serv)-31 b(e)369 b(as)g(handles)h(for)f(manipulating)k(lists)c(of)h Fk(Node)g Fn(ob)61 b(jects:)0 36705 y Fk(class)582 b(LinkedList)h(:) 1162 38060 y(def)f(__init__\(self\))h(:)2325 39415 y(self.length)f(=)g (0)2325 40770 y(self.head)1744 b(=)582 b(None)0 42967 y Fn(One)314 b(nice)h(thing)g(ab)31 b(out)315 b(the)g Fk(LinkedList)g Fn(class)g(is)f(that)h(it)g(pro)-31 b(vides)315 b(a)g(natural)g(place)g(to)0 44322 y(put)267 b(wrapp)31 b(er)267 b(functions)i(lik)-31 b(e)268 b Fk(printBackwardNicely)p Fn(,)291 b(whic)-31 b(h)268 b(w)-31 b(e)268 b(can)f(mak)-31 b(e)268 b(a)g(metho)31 b(d)0 45677 y(of)370 b(the)f Fk(LinkedList)i Fn(class:)0 47874 y Fk(class)582 b(LinkedList:)1162 49229 y(...)1162 50584 y(def)g(printBackward\(self\):)2325 51938 y(print)f("[",)2325 53293 y(if)g(self.head)i(!=)e(None:)3487 54648 y(self.head.printBackward\(\))2325 56003 y(print)g("]",)p eop %%Page: 187 213 187 212 bop 0 -2070 a Fv(17.10)426 b(In)-35 b(v)-71 b(arian)-35 b(ts)27416 b(187)p 0 -1627 38191 45 v 0 865 a Fk(class)582 b(Node:)1162 2220 y(...)1162 3575 y(def)g(printBackward\(self\):)2325 4930 y(if)f(self.next)i(!=)e(None:)3487 6285 y(tail)h(=)f(self.next) 3487 7640 y(tail.printBackward\(\))2325 8995 y(print)g(self.cargo,)0 11201 y Fn(Just)373 b(to)i(mak)-31 b(e)374 b(things)h(confusing,)h(w) -31 b(e)374 b(renamed)g Fk(printBackwardNicely)p Fn(.)508 b(No)-31 b(w)375 b(there)0 12556 y(are)476 b(t)-31 b(w)g(o)479 b(metho)31 b(ds)477 b(named)g Fk(printBackward)p Fn(:)709 b(one)477 b(in)g(the)g Fk(Node)g Fn(class)f(\(the)h(help)31 b(er\);)0 13911 y(and)488 b(one)f(in)h(the)g Fk(LinkedList)h Fn(class)e(\(the)h(wrapp)31 b(er\).)848 b(When)487 b(the)g(wrapp)31 b(er)487 b(in)-31 b(v)g(ok)g(es)0 15266 y Fk(self.head.printBackward)p Fn(,)448 b(it)430 b(is)f(in)-31 b(v)g(oking)431 b(the)f(help)31 b(er,)444 b(b)31 b(ecause)428 b Fk(self.head)j Fn(is)e(a)0 16621 y Fk(Node)370 b Fn(ob)61 b(ject.)0 18746 y(Another)485 b(b)31 b(ene\257t)485 b(of)h(the)f Fk(LinkedList)h Fn(class)f(is)g (that)h(it)g(mak)-31 b(es)486 b(it)f(easier)g(to)h(add)f(or)0 20101 y(remo)-31 b(v)g(e)542 b(the)g(\257rst)e(elemen)-31 b(t)543 b(of)f(a)f(list.)1010 b(F)-92 b(or)540 b(example,)586 b Fk(addFirst)542 b Fn(is)f(a)h(metho)31 b(d)542 b(for)0 21456 y Fk(LinkedList)p Fn(s;)638 b(it)548 b(tak)-31 b(es)548 b(an)g(item)g(of)g(cargo)g(as)f(an)h(argumen)-31 b(t)549 b(and)e(puts)g(it)i(at)f(the)0 22811 y(b)31 b(eginning)371 b(of)e(the)h(list:)0 25018 y Fk(class)582 b(LinkedList:)1162 26372 y(...)1162 27727 y(def)g(addFirst\(self,)h(cargo\):)2325 29082 y(node)e(=)h(Node\(cargo\))2325 30437 y(node.next)g(=)f (self.head)2325 31792 y(self.head)h(=)f(node)2325 33147 y(self.length)h(=)g(self.length)g(+)g(1)0 35354 y Fn(As)404 b(usual,)413 b(y)-31 b(ou)405 b(should)f(c)-31 b(hec)g(k)404 b(co)31 b(de)404 b(lik)-31 b(e)405 b(this)f(to)h(see)e(if)i(it)f (handles)g(the)g(sp)31 b(ecial)405 b(cases.)0 36709 y(F)-92 b(or)368 b(example,)j(what)g(happ)31 b(ens)369 b(if)g(the)h(list)g(is)f (initially)k(empt)-31 b(y?)0 41164 y Fl(17.10)1792 b(In)-50 b(v)-100 b(arian)-50 b(ts)0 43623 y Fn(Some)419 b(lists)h(are)e(\\w)-31 b(ell)421 b(formed";)445 b(others)419 b(are)f(not.)642 b(F)-92 b(or)418 b(example,)433 b(if)420 b(a)f(list)g(con)-31 b(tains)421 b(a)0 44978 y(lo)31 b(op,)407 b(it)400 b(will)g(cause)e (man)-31 b(y)400 b(of)f(our)g(metho)31 b(ds)399 b(to)g(crash,)406 b(so)398 b(w)-31 b(e)399 b(migh)-31 b(t)401 b(w)-31 b(an)g(t)400 b(to)f(require)0 46333 y(that)314 b(lists)g(con)-31 b(tain)315 b(no)e(lo)31 b(ops.)475 b(Another)313 b(requiremen)-31 b(t)314 b(is)f(that)i(the)e Fk(length)h Fn(v)-61 b(alue)313 b(in)h(the)0 47688 y Fk(LinkedList)370 b Fn(ob)61 b(ject)371 b(should)f(b)31 b(e)368 b(equal)i(to)g(the)g(actual)h(n)-31 b(um)g(b)31 b(er)369 b(of)h(no)31 b(des)368 b(in)i(the)f(list.)0 49813 y(Requiremen)-31 b(ts)398 b(lik)-31 b(e)398 b(these)f(are)g (called)h Fv(in)-35 b(v)-71 b(arian)-35 b(ts)396 b Fn(b)31 b(ecause,)404 b(ideally)-92 b(,)406 b(they)398 b(should)f(b)31 b(e)0 51168 y(true)449 b(of)g(ev)-31 b(ery)449 b(ob)61 b(ject)450 b(all)g(the)f(time.)732 b(Sp)31 b(ecifying)450 b(in)-31 b(v)-61 b(arian)-31 b(ts)451 b(for)d(ob)61 b(jects)450 b(is)f(a)g(useful)0 52523 y(programming)520 b(practice)f(b)31 b(ecause)518 b(it)h(mak)-31 b(es)519 b(it)g(easier)f(to)h(pro)-31 b(v)g(e)519 b(the)f(correctness)f(of)0 53878 y(co)31 b(de,)370 b(c)-31 b(hec)g(k)369 b(the)h(in)-31 b(tegrit)g(y)371 b(of)f(data)h(structures,)d(and)i(detect)g(errors.)0 56003 y(One)382 b(thing)i(that)g(is)f(sometimes)h(confusing)g(ab)31 b(out)384 b(in)-31 b(v)-61 b(arian)-31 b(ts)384 b(is)f(that)h(there)e (are)h(times)0 57358 y(when)535 b(they)g(are)f(violated.)992 b(F)-92 b(or)533 b(example,)578 b(in)535 b(the)g(middle)h(of)f Fk(addFirst)p Fn(,)577 b(after)535 b(w)-31 b(e)p eop %%Page: 188 214 188 213 bop 0 -2070 a Fv(188)29898 b(Link)-35 b(ed)424 b(lists)p 0 -1627 38191 45 v 0 865 a Fn(ha)-31 b(v)g(e)416 b(added)e(the)h(no)31 b(de)415 b(but)g(b)31 b(efore)414 b(w)-31 b(e)415 b(ha)-31 b(v)g(e)416 b(incremen)-31 b(ted)415 b Fk(length)p Fn(,)428 b(the)414 b(in)-31 b(v)-61 b(arian)-31 b(t)417 b(is)0 2220 y(violated.)908 b(This)507 b(kind)g(of)h(violation) i(is)c(acceptable;)578 b(in)507 b(fact,)543 b(it)507 b(is)g(often)h(imp)31 b(ossible)0 3575 y(to)471 b(mo)31 b(dify)471 b(an)f(ob)61 b(ject)472 b(without)g(violating)h(an)d(in)-31 b(v)-61 b(arian)-31 b(t)472 b(for)e(at)h(least)g(a)f(little)i(while.)0 4930 y(Normally)-92 b(,)355 b(w)-31 b(e)349 b(require)f(that)i(ev)-31 b(ery)348 b(metho)31 b(d)349 b(that)h(violates)g(an)f(in)-31 b(v)-61 b(arian)-31 b(t)350 b(m)-31 b(ust)349 b(restore)0 6285 y(the)369 b(in)-31 b(v)-61 b(arian)-31 b(t.)0 8450 y(If)433 b(there)h(is)g(an)-31 b(y)434 b(signi\257can)-31 b(t)436 b(stretc)-31 b(h)434 b(of)g(co)31 b(de)434 b(in)f(whic)-31 b(h)435 b(the)f(in)-31 b(v)-61 b(arian)-31 b(t)436 b(is)d(violated,)453 b(it)0 9805 y(is)466 b(imp)31 b(ortan)-31 b(t)468 b(for)e(the)g(commen) -31 b(ts)468 b(to)e(mak)-31 b(e)468 b(that)f(clear,)491 b(so)466 b(that)h(no)f(op)31 b(erations)467 b(are)0 11160 y(p)31 b(erformed)369 b(that)h(dep)31 b(end)369 b(on)g(the)h(in)-31 b(v)-61 b(arian)-31 b(t.)0 15671 y Fl(17.11)1792 b(Glossary)0 18169 y Fv(em)-35 b(b)35 b(edded)426 b(reference:)556 b Fn(A)369 b(reference)f(stored)h(in)h(an)f(attribute)i(of)f(an)f(ob)61 b(ject.)0 20410 y Fv(link)-35 b(ed)424 b(list:)552 b Fn(A)362 b(data)h(structure)f(that)h(implemen)-31 b(ts)363 b(a)f(collection)j(using)d(a)g(sequence)f(of)2767 21765 y(link)-31 b(ed)371 b(no)31 b(des.)0 24005 y Fv(no)k(de:)555 b Fn(An)409 b(elemen)-31 b(t)410 b(of)g(a)f(list,)421 b(usually)410 b(implemen)-31 b(ted)411 b(as)e(an)g(ob)61 b(ject)411 b(that)f(con)-31 b(tains)411 b(a)2767 25360 y(reference)369 b(to)h(another)g(ob)61 b(ject)370 b(of)g(the)f(same)h (t)-31 b(yp)31 b(e.)0 27601 y Fv(cargo:)554 b Fn(An)369 b(item)i(of)e(data)i(con)-31 b(tained)371 b(in)e(a)h(no)31 b(de.)0 29841 y Fv(link:)552 b Fn(An)370 b(em)-31 b(b)31 b(edded)369 b(reference)f(used)h(to)h(link)g(one)f(ob)61 b(ject)371 b(to)f(another.)0 32082 y Fv(precondition:)555 b Fn(An)398 b(assertion)h(that)h(m)-31 b(ust)398 b(b)31 b(e)398 b(true)g(in)h(order)f(for)g(a)h(metho)31 b(d)399 b(to)g(w)-31 b(ork)2767 33437 y(correctly)-92 b(.)0 35677 y Fv(fundamen)-35 b(tal)424 b(am)-35 b(biguit)g(y)424 b(theorem:)555 b Fn(A)339 b(reference)g(to)h(a)g(list)h(no)31 b(de)339 b(can)h(b)31 b(e)339 b(treated)2767 37032 y(as)370 b(a)f(single)h(ob)61 b(ject)371 b(or)e(as)g(the)g(\257rst)g(in)g(a)h (list)g(of)g(no)31 b(des.)0 39272 y Fv(singleton:)554 b Fn(A)370 b(link)-31 b(ed)370 b(list)g(with)g(a)g(single)g(no)31 b(de.)0 41513 y Fv(wrapp)k(er:)555 b Fn(A)414 b(metho)31 b(d)416 b(that)f(acts)g(as)g(a)f(middleman)j(b)31 b(et)-31 b(w)g(een)415 b(a)g(caller)g(and)g(a)f(help)31 b(er)2767 42868 y(metho)g(d,)371 b(often)f(making)h(the)f(metho)31 b(d)370 b(easier)f(or)g(less)g(error-prone)f(to)i(in)-31 b(v)g(ok)g(e.)0 45108 y Fv(help)35 b(er:)555 b Fn(A)276 b(metho)31 b(d)278 b(that)g(is)f(not)h(in)-31 b(v)g(ok)g(ed)278 b(directly)g(b)-31 b(y)277 b(a)g(caller)h(but)f(is)g(used)f(b)-31 b(y)277 b(another)2767 46463 y(metho)31 b(d)371 b(to)e(p)31 b(erform)369 b(part)h(of)g(an)f(op)31 b(eration.)0 48704 y Fv(in)-35 b(v)-71 b(arian)-35 b(t:)552 b Fn(An)423 b(assertion)g(that)h(should)f(b)31 b(e)422 b(true)g(of)h(an)g(ob)61 b(ject)424 b(at)g(all)g(times)f(\(except)2767 50059 y(p)31 b(erhaps)369 b(while)h(the)g(ob)61 b(ject)370 b(is)f(b)31 b(eing)370 b(mo)31 b(di\257ed\).)p eop %%Page: 189 215 189 214 bop 0 10118 a Fi(Chapter)861 b(18)0 16615 y Fo(Stac)-86 b(ks)0 23971 y Fl(18.1)1792 b(Abstract)600 b(data)e(t)-50 b(yp)50 b(es)0 26590 y Fn(The)373 b(data)g(t)-31 b(yp)31 b(es)373 b(y)-31 b(ou)373 b(ha)-31 b(v)g(e)373 b(seen)f(so)g(far)h(are) f(all)i(concrete,)g(in)e(the)h(sense)e(that)j(w)-31 b(e)373 b(ha)-31 b(v)g(e)0 27945 y(completely)460 b(sp)31 b(eci\257ed)457 b(ho)-31 b(w)458 b(they)g(are)f(implemen)-31 b(ted.)759 b(F)-92 b(or)456 b(example,)482 b(the)457 b Fk(Card)h Fn(class)0 29299 y(represen)-31 b(ts)417 b(a)h(card)g(using)g(t)-31 b(w)g(o)420 b(in)-31 b(tegers.)640 b(As)417 b(w)-31 b(e)419 b(discussed)e(at)i(the)f(time,)432 b(that)419 b(is)f(not)0 30654 y(the)369 b(only)i(w)-31 b(a)g(y)370 b(to)g(represen)-31 b(t)369 b(a)g(card;)h(there)f(are)g(man)-31 b(y)370 b(alternativ)-31 b(e)372 b(implemen)-31 b(tations.)0 32905 y(An)450 b Fv(abstract)518 b(data)f(t)-35 b(yp)35 b(e)p Fn(,)472 b(or)450 b(ADT,)h(sp)31 b(eci\257es)449 b(a)i(set)f(of)h(op)31 b(erations)451 b(\(or)g(metho)31 b(ds\))0 34260 y(and)354 b(the)f(seman)-31 b(tics)355 b(of)f(the)f(op)31 b(erations)355 b(\(what)g(they)f(do\),)j(but)d(it)g(do)31 b(es)353 b(not)h(sp)31 b(ecify)354 b(the)0 35615 y(implemen)-31 b(tation)373 b(of)d(the)g(op)31 b(erations.)493 b(That's)371 b(what)f(mak)-31 b(es)370 b(it)g(abstract.)0 37865 y(Wh)-31 b(y)369 b(is)g(that)i (useful?)1660 40676 y Fj(\262)554 b Fn(It)529 b(simpli\257es)g(the)g (task)f(of)h(sp)31 b(ecifying)530 b(an)e(algorithm)j(if)e(y)-31 b(ou)529 b(can)g(denote)g(the)2767 42031 y(op)31 b(erations)349 b(y)-31 b(ou)348 b(need)f(without)j(ha)-31 b(ving)349 b(to)f(think)g(at)h(the)e(same)h(time)h(ab)31 b(out)348 b(ho)-31 b(w)2767 43386 y(the)370 b(op)31 b(erations)370 b(are)f(p)31 b(erformed.)1660 45785 y Fj(\262)554 b Fn(Since)493 b(there)e(are)h(usually)h(man)-31 b(y)493 b(w)-31 b(a)g(ys)493 b(to)g(implemen)-31 b(t)494 b(an)e(ADT,)h(it)g(migh)-31 b(t)493 b(b)31 b(e)2767 47140 y(useful)481 b(to)g(write)g(an)g (algorithm)i(that)e(can)g(b)31 b(e)480 b(used)g(with)h(an)-31 b(y)481 b(of)g(the)g(p)31 b(ossible)2767 48495 y(implemen)-31 b(tations.)1660 50894 y Fj(\262)554 b Fn(W)-92 b(ell-kno)-31 b(wn)388 b(ADTs,)j(suc)-31 b(h)386 b(as)h(the)f(Stac)-31 b(k)388 b(ADT)e(in)h(this)g(c)-31 b(hapter,)392 b(are)386 b(often)h(im-)2767 52249 y(plemen)-31 b(ted)396 b(in)f(standard)f (libraries)h(so)f(they)h(can)g(b)31 b(e)393 b(written)j(once)e(and)h (used)f(b)-31 b(y)2767 53604 y(man)g(y)371 b(programmers.)1660 56003 y Fj(\262)554 b Fn(The)362 b(op)31 b(erations)363 b(on)f(ADTs)g(pro)-31 b(vide)362 b(a)h(common)g(high-lev)-31 b(el)364 b(language)g(for)e(sp)31 b(ec-)2767 57358 y(ifying)371 b(and)f(talking)h(ab)31 b(out)370 b(algorithms.)p eop %%Page: 190 216 190 215 bop 0 -2070 a Fv(190)32757 b(Stac)-35 b(ks)p 0 -1627 38191 45 v 0 865 a Fn(When)399 b(w)-31 b(e)400 b(talk)g(ab)31 b(out)401 b(ADTs,)407 b(w)-31 b(e)400 b(often)g(distinguish)h(the)e(co)31 b(de)400 b(that)g(uses)f(the)g (ADT,)0 2220 y(called)518 b(the)f Fv(clien)-35 b(t)517 b Fn(co)31 b(de,)554 b(from)517 b(the)h(co)31 b(de)517 b(that)h(implemen)-31 b(ts)519 b(the)e(ADT,)h(called)g(the)0 3575 y Fv(pro)-35 b(vider)370 b Fn(co)31 b(de.)0 8091 y Fl(18.2)1792 b(The)599 b(Stac)-50 b(k)599 b(ADT)0 10593 y Fn(In)488 b(this)i(c)-31 b(hapter,)519 b(w)-31 b(e)490 b(will)g(lo)31 b(ok)491 b(at)e(one)g(common)i(ADT,)e(the)g Fv(stac)-35 b(k)p Fn(.)851 b(A)489 b(stac)-31 b(k)490 b(is)f(a)0 11948 y(collection,)393 b(meaning)387 b(that)g(it)f(is)g(a)g (data)g(structure)f(that)i(con)-31 b(tains)387 b(m)-31 b(ultiple)388 b(elemen)-31 b(ts.)0 13302 y(Other)369 b(collections)i(w)-31 b(e)370 b(ha)-31 b(v)g(e)370 b(seen)f(include)h (dictionaries)h(and)e(lists.)0 15469 y(An)487 b(ADT)g(is)g(de\257ned)g (b)-31 b(y)487 b(the)g(op)31 b(erations)488 b(that)g(can)g(b)31 b(e)486 b(p)31 b(erformed)487 b(on)g(it,)518 b(whic)-31 b(h)488 b(is)0 16824 y(called)370 b(an)g Fv(in)-35 b(terface)p Fn(.)493 b(The)369 b(in)-31 b(terface)370 b(for)g(a)f(stac)-31 b(k)370 b(consists)g(of)f(these)g(op)31 b(erations:)p 70 19473 349 45 v 488 19473 V 837 19473 a Fk(init)p 3231 19473 V 3650 19473 V 837 w Fv(:)553 b Fn(Initialize)372 b(a)d(new)h(empt)-31 b(y)370 b(stac)-31 b(k.)0 21717 y Fk(push)p Fv(:)554 b Fn(Add)369 b(a)g(new)h(item)g(to)g(the)g(stac) -31 b(k.)0 23961 y Fk(pop)p Fv(:)554 b Fn(Remo)-31 b(v)g(e)399 b(and)g(return)e(an)i(item)g(from)g(the)g(stac)-31 b(k.)581 b(The)398 b(item)i(that)f(is)f(returned)g(is)2767 25316 y(alw)-31 b(a)g(ys)372 b(the)d(last)h(one)g(that)g(w)-31 b(as)370 b(added.)0 27560 y Fk(isEmpty)p Fv(:)554 b Fn(Chec)-31 b(k)370 b(whether)f(the)h(stac)-31 b(k)370 b(is)f(empt)-31 b(y)-92 b(.)0 30209 y(A)288 b(stac)-31 b(k)288 b(is)g(sometimes)h (called)g(a)f(\\last)i(in,)304 b(\257rst)288 b(out")h(or)e(LIF)-31 b(O)287 b(data)i(structure,)304 b(b)31 b(ecause)0 31564 y(the)369 b(last)i(item)f(added)f(is)g(the)h(\257rst)f(to)g(b)31 b(e)369 b(remo)-31 b(v)g(ed.)0 36080 y Fl(18.3)1792 b(Implemen)-50 b(ting)600 b(stac)-50 b(ks)600 b(with)e(Python)h(lists)0 38582 y Fn(The)534 b(list)h(op)31 b(erations)536 b(that)f(Python)g(pro) -31 b(vides)535 b(are)f(similar)h(to)g(the)f(op)31 b(erations)536 b(that)0 39937 y(de\257ne)334 b(a)g(stac)-31 b(k.)482 b(The)335 b(in)-31 b(terface)335 b(isn't)g(exactly)h(what)f(it)g(is)f (supp)31 b(osed)334 b(to)g(b)31 b(e,)342 b(but)334 b(w)-31 b(e)335 b(can)0 41292 y(write)370 b(co)31 b(de)369 b(to)h(translate)h (from)e(the)h(Stac)-31 b(k)370 b(ADT)f(to)h(the)g(built-in)h(op)31 b(erations.)0 43459 y(This)554 b(co)31 b(de)555 b(is)f(called)h(an)f Fv(implemen)-35 b(tation)554 b Fn(of)h(the)f(Stac)-31 b(k)556 b(ADT.)e(In)g(general,)602 b(an)0 44814 y(implemen)-31 b(tation)554 b(is)c(a)g(set)f(of)i(metho)31 b(ds)550 b(that)h(satisfy)g(the)f(syn)-31 b(tactic)551 b(and)f(seman)-31 b(tic)0 46169 y(requiremen)g(ts)370 b(of)f(an)h(in)-31 b(terface.)0 48335 y(Here)369 b(is)g(an)g(implemen)-31 b(tation)374 b(of)369 b(the)h(Stac)-31 b(k)370 b(ADT)g(that)g(uses)e(a) i(Python)g(list:)0 50584 y Fk(class)582 b(Stack)g(:)1162 51938 y(def)g(__init__\(self\))h(:)2325 53293 y(self.items)f(=)g([]) 1162 56003 y(def)g(push\(self,)h(item\))e(:)2325 57358 y(self.items.append\(item\))p eop %%Page: 191 217 191 216 bop 0 -2070 a Fv(18.4)425 b(Pushing)h(and)e(p)35 b(opping)21739 b(191)p 0 -1627 38191 45 v 1162 2220 a Fk(def)582 b(pop\(self\))g(:)2325 3575 y(return)g(self.items.pop\(\)) 1162 6285 y(def)g(isEmpty\(self\))h(:)2325 7640 y(return)f (\(self.items)g(==)g([]\))0 9886 y Fn(A)345 b Fk(Stack)g Fn(ob)61 b(ject)346 b(con)-31 b(tains)347 b(an)e(attribute)h(named)g Fk(items)f Fn(that)h(is)f(a)g(list)h(of)f(items)h(in)f(the)0 11241 y(stac)-31 b(k.)494 b(The)369 b(initialization)374 b(metho)31 b(d)370 b(sets)f Fk(items)h Fn(to)g(the)f(empt)-31 b(y)371 b(list.)0 13405 y(T)-92 b(o)447 b(push)f(a)g(new)h(item)g(on) -31 b(to)448 b(the)f(stac)-31 b(k,)467 b Fk(push)447 b Fn(app)31 b(ends)446 b(it)h(on)-31 b(to)448 b Fk(items)p Fn(.)724 b(T)-92 b(o)447 b(p)31 b(op)447 b(an)0 14760 y(item)315 b(o\256)e(the)h(stac)-31 b(k,)326 b Fk(pop)314 b Fn(uses)f(the)g(homon)-31 b(ymous)21466 14359 y Ff(1)22279 14760 y Fn(list)314 b(metho)31 b(d)315 b(to)f(remo)-31 b(v)g(e)315 b(and)f(return)0 16115 y(the)369 b(last)i(item)f(on)f(the)h (list.)0 18280 y(Finally)-92 b(,)422 b(to)411 b(c)-31 b(hec)g(k)411 b(if)g(the)f(stac)-31 b(k)411 b(is)f(empt)-31 b(y)-92 b(,)422 b Fk(isEmpty)411 b Fn(compares)g Fk(items)f Fn(to)h(the)g(empt)-31 b(y)0 19635 y(list.)0 21800 y(An)312 b(implemen)-31 b(tation)316 b(lik)-31 b(e)313 b(this,)324 b(in)312 b(whic)-31 b(h)312 b(the)g(metho)31 b(ds)312 b(consist)g(of)h(simple)f(in)-31 b(v)g(o)31 b(cations)0 23155 y(of)383 b(existing)g(metho)31 b(ds,)387 b(is)382 b(called)h(a)f Fv(v)-35 b(eneer)p Fn(.)533 b(In)381 b(real)h(life,)387 b(v)-31 b(eneer)382 b(is)g(a)g(thin)h(coating)h(of)0 24510 y(go)31 b(o)g(d)374 b(qualit)-31 b(y)375 b(w)-31 b(o)31 b(o)g(d)374 b(used)f(in)g(furniture-making)j(to)d(hide)h(lo)-31 b(w)g(er)374 b(qualit)-31 b(y)376 b(w)-31 b(o)31 b(o)g(d)374 b(under-)0 25865 y(neath.)495 b(Computer)371 b(scien)-31 b(tists)371 b(use)e(this)i(metaphor)g(to)f(describ)31 b(e)369 b(a)h(small)i(piece)e(of)g(co)31 b(de)0 27220 y(that)488 b(hides)e(the)h(details)h(of)f(an)g(implemen)-31 b(tation)491 b(and)c(pro)-31 b(vides)487 b(a)g(simpler,)517 b(or)487 b(more)0 28575 y(standard,)370 b(in)-31 b(terface.)0 33085 y Fl(18.4)1792 b(Pushing)599 b(and)f(p)50 b(opping)0 35583 y Fn(A)377 b(stac)-31 b(k)379 b(is)e(a)g Fv(generic)435 b(data)f(structure)p Fn(,)381 b(whic)-31 b(h)378 b(means)g(that)g(w)-31 b(e)378 b(can)g(add)f(an)-31 b(y)378 b(t)-31 b(yp)31 b(e)0 36938 y(of)383 b(item)h(to)f(it.)534 b(The)383 b(follo)-31 b(wing)386 b(example)e(pushes)e(t)-31 b(w)g(o)384 b(in)-31 b(tegers)384 b(and)f(a)f(string)i(on)-31 b(to)384 b(the)0 38293 y(stac)-31 b(k:)0 40539 y Fk(>>>)582 b(s)f(=)g(Stack\(\)) 0 41894 y(>>>)h(s.push\(54\))0 43249 y(>>>)g(s.push\(45\))0 44604 y(>>>)g(s.push\("+"\))0 46850 y Fn(W)-92 b(e)352 b(can)g(use)g Fk(isEmpty)h Fn(and)f Fk(pop)h Fn(to)g(remo)-31 b(v)g(e)353 b(and)g(prin)-31 b(t)353 b(all)g(of)g(the)f(items)i(on)e (the)h(stac)-31 b(k:)0 49096 y Fk(while)582 b(not)f(s.isEmpty\(\))i(:) 1162 50451 y(print)f(s.pop\(\),)0 52697 y Fn(The)359 b(output)h(is)f Fk(+)581 b(45)g(54)p Fn(.)490 b(In)358 b(other)h(w)-31 b(ords,)361 b(w)-31 b(e)360 b(just)f(used)f(a)h(stac) -31 b(k)359 b(to)h(prin)-31 b(t)359 b(the)g(items)0 54051 y(bac)-31 b(kw)g(ard!)470 b(Gran)-31 b(ted,)310 b(it's)297 b(not)f(the)f(standard)h(format)h(for)e(prin)-31 b(ting)297 b(a)f(list,)311 b(but)296 b(b)-31 b(y)296 b(using)0 55406 y(a)369 b(stac)-31 b(k,)371 b(it)f(w)-31 b(as)370 b(remark)-61 b(ably)370 b(easy)f(to)h(do.)p 0 56330 15276 45 v 1232 57046 a Fp(1)1694 57358 y Fb(same-named)p eop %%Page: 192 218 192 217 bop 0 -2070 a Fv(192)32757 b(Stac)-35 b(ks)p 0 -1627 38191 45 v 0 865 a Fn(Y)-92 b(ou)397 b(should)g(compare)g(this) g(bit)g(of)g(co)31 b(de)397 b(to)g(the)g(implemen)-31 b(tation)401 b(of)c Fk(printBackward)0 2220 y Fn(in)601 b(Section)g(17.4.)1189 b(There)600 b(is)h(a)f(natural)i(parallel)g(b)31 b(et)-31 b(w)g(een)602 b(the)f(recursiv)-31 b(e)600 b(v)-31 b(ersion)0 3575 y(of)692 b Fk(printBackward)g Fn(and)g(the)f(stac)-31 b(k)692 b(algorithm)h(here.)1458 b(The)691 b(di\256erence)g(is)g(that)0 4930 y Fk(printBackward)390 b Fn(uses)e(the)h(run)-31 b(time)389 b(stac)-31 b(k)390 b(to)f(k)-31 b(eep)389 b(trac)-31 b(k)389 b(of)g(the)g(no)31 b(des)388 b(while)i(it)g(tra-)0 6285 y(v)-31 b(erses)390 b(the)h(list,)398 b(and)391 b(then)g(prin)-31 b(ts)391 b(them)h(on)f(the)h(w)-31 b(a)g(y)392 b(bac)-31 b(k)392 b(from)f(the)g(recursion.)558 b(The)0 7640 y(stac)-31 b(k)339 b(algorithm)i(do)31 b(es)339 b(the)f(same)h(thing,)346 b(except)339 b(that)h(it)f(uses)f(a)g Fk(Stack)h Fn(ob)61 b(ject)340 b(instead)0 8995 y(of)370 b(the)f(run)-31 b(time)370 b(stac)-31 b(k.)0 13616 y Fl(18.5)1792 b(Using)599 b(a)e(stac)-50 b(k)599 b(to)f(ev)-100 b(aluate)599 b(p)50 b(ost\257x)0 16167 y Fn(In)301 b(most)g (programming)j(languages,)317 b(mathematical)305 b(expressions)300 b(are)h(written)h(with)h(the)0 17522 y(op)31 b(erator)380 b(b)31 b(et)-31 b(w)g(een)380 b(the)g(t)-31 b(w)g(o)381 b(op)31 b(erands,)382 b(as)e(in)f Fk(1+2)p Fn(.)524 b(This)380 b(format)h(is)e(called)i Fv(in\257x)p Fn(.)523 b(An)0 18877 y(alternativ)-31 b(e)382 b(used)d(b)-31 b(y)380 b(some)g(calculators)h(is)f(called)h Fv(p)35 b(ost\257x)p Fn(.)525 b(In)379 b(p)31 b(ost\257x,)383 b(the)c(op)31 b(erator)0 20232 y(follo)-31 b(ws)372 b(the)d(op)31 b(erands,)369 b(as)g(in)h Fk(1)581 b(2)g(+)p Fn(.)0 22434 y(The)324 b(reason)f(p)31 b(ost\257x)323 b(is)h(sometimes)g(useful)g(is)f(that)h (there)f(is)h(a)f(natural)i(w)-31 b(a)g(y)324 b(to)h(ev)-61 b(aluate)0 23789 y(a)369 b(p)31 b(ost\257x)370 b(expression)f(using)g (a)h(stac)-31 b(k:)1660 26506 y Fj(\262)554 b Fn(Starting)511 b(at)e(the)g(b)31 b(eginning)510 b(of)f(the)g(expression,)543 b(get)510 b(one)f(term)f(\(op)31 b(erator)510 b(or)2767 27860 y(op)31 b(erand\))370 b(at)g(a)f(time.)4013 29765 y Fv({)554 b Fn(If)369 b(the)g(term)h(is)f(an)g(op)31 b(erand,)370 b(push)e(it)i(on)g(the)f(stac)-31 b(k.)4013 31597 y Fv({)554 b Fn(If)407 b(the)h(term)g(is)f(an)h(op)31 b(erator,)418 b(p)31 b(op)408 b(t)-31 b(w)g(o)409 b(op)31 b(erands)407 b(o\256)h(the)g(stac)-31 b(k,)418 b(p)31 b(erform)5203 32951 y(the)369 b(op)31 b(eration)371 b(on)e(them,)i(and) e(push)g(the)g(result)g(bac)-31 b(k)370 b(on)g(the)f(stac)-31 b(k.)1660 35261 y Fj(\262)554 b Fn(When)428 b(y)-31 b(ou)428 b(get)g(to)h(the)f(end)f(of)h(the)g(expression,)443 b(there)427 b(should)h(b)31 b(e)427 b(exactly)j(one)2767 36616 y(op)31 b(erand)370 b(left)g(on)f(the)h(stac)-31 b(k.)493 b(That)371 b(op)31 b(erand)369 b(is)g(the)g(result.)2767 39332 y Fm(As)396 b(an)g(exer)-57 b(cise,)397 b(apply)f(this)g(algorithm)f(to)h (the)g(expr)-57 b(ession)395 b Fk(1)582 b(2)f(+)g(3)h(*)p Fm(.)0 42049 y Fn(This)402 b(example)h(demonstrates)g(one)e(of)i(the)e (adv)-61 b(an)-31 b(tages)404 b(of)e(p)31 b(ost\257x|there)402 b(is)f(no)h(need)0 43404 y(to)359 b(use)e(paren)-31 b(theses)358 b(to)h(con)-31 b(trol)360 b(the)e(order)g(of)g(op)31 b(erations.)490 b(T)-92 b(o)359 b(get)g(the)f(same)h(result)f(in)0 44759 y(in\257x,)370 b(w)-31 b(e)370 b(w)-31 b(ould)370 b(ha)-31 b(v)g(e)371 b(to)f(write)g Fk(\(1)581 b(+)g(2\))h(*)f(3)p Fn(.)2767 47476 y Fm(As)353 b(an)g(exer)-57 b(cise,)363 b(write)353 b(a)f(p)-57 b(ost\257x)353 b(expr)-57 b(ession)352 b(that)h(is)g(e)-57 b(quivalent)354 b(to)f Fk(1)581 b(+)h(2)2767 48831 y(*)g(3)p Fm(.)0 53453 y Fl(18.6)1792 b(P)-50 b(arsing)0 56003 y Fn(T)-92 b(o)274 b(implemen)-31 b(t)275 b(the)f(previous)f (algorithm,)295 b(w)-31 b(e)274 b(need)f(to)h(b)31 b(e)273 b(able)g(to)h(tra)-31 b(v)g(erse)274 b(a)f(string)h(and)0 57358 y(break)412 b(it)h(in)-31 b(to)414 b(op)31 b(erands)412 b(and)g(op)31 b(erators.)622 b(This)413 b(pro)31 b(cess)411 b(is)h(an)g(example)i(of)f Fv(parsing)p Fn(,)p eop %%Page: 193 219 193 218 bop 0 -2070 a Fv(18.7)425 b(Ev)-71 b(aluating)425 b(p)35 b(ost\257x)23487 b(193)p 0 -1627 38191 45 v 0 865 a Fn(and)436 b(the)h(results|the)f(individual)i(c)-31 b(h)g(unks)436 b(of)h(the)f(string|are)h(called)g Fv(tok)-35 b(ens)p Fn(.)694 b(Y)-92 b(ou)0 2220 y(migh)-31 b(t)371 b(remem)-31 b(b)31 b(er)369 b(these)g(w)-31 b(ords)370 b(from)f(Chapter)h(1.)0 4991 y(Python)265 b(pro)-31 b(vides)264 b(a)g Fk(split)g Fn(metho)31 b(d)265 b(in)e(b)31 b(oth)265 b(the)e Fk(string)i Fn(and)f Fk(re)f Fn(\(regular)i(expression\))0 6346 y(mo)31 b(dules.)696 b(The)436 b(function)i Fk(string.split)h Fn(splits)e(a)g(string)g(in)-31 b(to)438 b(a)f(list)g(using)g(a)g (single)0 7701 y(c)-31 b(haracter)370 b(as)f(a)g Fv(delimiter)p Fn(.)493 b(F)-92 b(or)368 b(example:)0 10553 y Fk(>>>)582 b(import)g(string)0 11908 y(>>>)g(string.split\("Now)h(is)f(the)f (time",")i("\))0 13262 y(['Now',)f('is',)g('the',)g('time'])0 16114 y Fn(In)422 b(this)h(case,)437 b(the)423 b(delimiter)h(is)f(the)g (space)g(c)-31 b(haracter,)437 b(so)422 b(the)h(string)h(is)e(split)i (at)f(eac)-31 b(h)0 17469 y(space.)0 20240 y(The)427 b(function)h Fk(re.split)g Fn(is)e(more)h(p)31 b(o)-31 b(w)g(erful,)443 b(allo)-31 b(wing)430 b(us)c(to)i(pro)-31 b(vide)427 b(a)g(regular)g(ex-)0 21595 y(pression)336 b(instead)i(of)f(a)g(delimiter.)483 b(A)337 b(regular)g(expression)f (is)h(a)g(w)-31 b(a)g(y)338 b(of)f(sp)31 b(ecifying)338 b(a)f(set)0 22950 y(of)425 b(strings.)659 b(F)-92 b(or)423 b(example,)440 b Fk([A-z])425 b Fn(is)g(the)f(set)h(of)g(all)g(letters) g(and)g Fk([0-9])g Fn(is)f(the)h(set)f(of)0 24305 y(all)g(n)-31 b(um)g(b)31 b(ers.)651 b(The)423 b Fk(^)f Fn(op)31 b(erator)423 b(negates)g(a)g(set,)436 b(so)422 b Fk([^0-9])h Fn(is)g(the)f(set)h(of) f(ev)-31 b(erything)0 25660 y(that)337 b(is)f(not)g(a)g(n)-31 b(um)g(b)31 b(er,)343 b(whic)-31 b(h)336 b(is)g(exactly)h(the)f(set)g (w)-31 b(e)336 b(w)-31 b(an)g(t)338 b(to)e(use)f(to)i(split)f(up)g(p)31 b(ost\257x)0 27015 y(expressions:)0 29867 y Fk(>>>)582 b(import)g(re)0 31222 y(>>>)g(re.split\("\([^0-9]\)",)i("123+456*/"\))0 32576 y(['123',)e('+',)g('456',)g('*',)g('',)f('/',)h(''])0 35428 y Fn(Notice)516 b(that)f(the)g(order)f(of)h(the)f(argumen)-31 b(ts)516 b(is)e(di\256eren)-31 b(t)515 b(from)g Fk(string.split)p Fn(;)589 b(the)0 36783 y(delimiter)371 b(comes)e(b)31 b(efore)369 b(the)h(string.)0 39554 y(The)413 b(resulting)g(list)g (includes)g(the)g(op)31 b(erands)412 b Fk(123)h Fn(and)f Fk(456)h Fn(and)g(the)g(op)31 b(erators)412 b Fk(*)h Fn(and)0 40909 y Fk(/)p Fn(.)493 b(It)369 b(also)h(includes)f(t)-31 b(w)g(o)371 b(empt)-31 b(y)371 b(strings)e(that)h(are)f(inserted)g (after)h(the)g(op)31 b(erands.)0 47237 y Fl(18.7)1792 b(Ev)-100 b(aluating)599 b(p)50 b(ost\257x)0 50584 y Fn(T)-92 b(o)283 b(ev)-61 b(aluate)285 b(a)e(p)31 b(ost\257x)283 b(expression,)301 b(w)-31 b(e)283 b(will)i(use)d(the)h(parser)f(from)i (the)f(previous)g(section)0 51938 y(and)460 b(the)h(algorithm)h(from)f (the)f(section)h(b)31 b(efore)460 b(that.)766 b(T)-92 b(o)461 b(k)-31 b(eep)460 b(things)h(simple,)484 b(w)-31 b(e'll)0 53293 y(start)370 b(with)g(an)f(ev)-61 b(aluator)371 b(that)g(only)f(implemen)-31 b(ts)371 b(the)e(op)31 b(erators)370 b Fk(+)f Fn(and)g Fk(*)p Fn(:)p eop %%Page: 194 220 194 219 bop 0 -2070 a Fv(194)32757 b(Stac)-35 b(ks)p 0 -1627 38191 45 v 0 865 a Fk(def)582 b(evalPostfix\(expr\):)1162 2220 y(import)g(re)1162 3575 y(tokenList)h(=)e(re.split\("\([^0-9]\)",) j(expr\))1162 4930 y(stack)e(=)f(Stack\(\))1162 6285 y(for)h(token)g(in)f(tokenList:)2325 7640 y(if)1162 b(token)582 b(==)g('')f(or)g(token)h(==)g(')f(':)3487 8995 y(continue)2325 10350 y(if)1162 b(token)582 b(==)g('+':)3487 11705 y(sum)f(=)h (stack.pop\(\))h(+)e(stack.pop\(\))3487 13059 y(stack.push\(sum\))2325 14414 y(elif)g(token)h(==)g('*':)3487 15769 y(product)g(=)f (stack.pop\(\))i(*)e(stack.pop\(\))3487 17124 y(stack.push\(product\)) 2325 18479 y(else:)3487 19834 y(stack.push\(int\(token\)\))1162 21189 y(return)h(stack.pop\(\))0 23395 y Fn(The)403 b(\257rst)g (condition)i(tak)-31 b(es)404 b(care)f(of)g(spaces)g(and)g(empt)-31 b(y)404 b(strings.)594 b(The)403 b(next)h(t)-31 b(w)g(o)405 b(con-)0 24750 y(ditions)425 b(handle)f(op)31 b(erators.)655 b(W)-92 b(e)422 b(assume,)437 b(for)424 b(no)-31 b(w,)438 b(that)424 b(an)-31 b(ything)426 b(else)d(m)-31 b(ust)424 b(b)31 b(e)423 b(an)0 26105 y(op)31 b(erand.)492 b(Of)366 b(course,)g(it)h(w)-31 b(ould)368 b(b)31 b(e)366 b(b)31 b(etter)366 b(to)h(c)-31 b(hec)g(k)366 b(for)h(erroneous)e(input)i(and) f(rep)31 b(ort)0 27460 y(an)369 b(error)g(message,)h(but)f(w)-31 b(e'll)371 b(get)f(to)g(that)h(later.)0 29586 y(Let's)e(test)h(it)g(b) -31 b(y)369 b(ev)-61 b(aluating)372 b(the)d(p)31 b(ost\257x)370 b(form)g(of)f Fk(\(56+47\)*2)p Fn(:)0 31792 y Fk(>>>)582 b(print)f(evalPostfix)i(\("56)f(47)f(+)h(2)f(*"\))0 33147 y(206)0 35354 y Fn(That's)371 b(close)e(enough.)0 39809 y Fl(18.8)1792 b(Clien)-50 b(ts)600 b(and)e(pro)-50 b(viders)0 42268 y Fn(One)506 b(of)g(the)h(fundamen)-31 b(tal)508 b(goals)g(of)e(an)g(ADT)g(is)g(to)h(separate)g(the)f(in)-31 b(terests)506 b(of)h(the)0 43623 y(pro)-31 b(vider,)449 b(who)434 b(writes)f(the)g(co)31 b(de)432 b(that)i(implemen)-31 b(ts)435 b(the)e(ADT,)g(and)g(the)g(clien)-31 b(t,)450 b(who)0 44978 y(uses)441 b(the)h(ADT.)h(The)f(pro)-31 b(vider)442 b(only)h(has)f(to)h(w)-31 b(orry)442 b(ab)31 b(out)443 b(whether)f(the)g(implemen-)0 46333 y(tation)366 b(is)d(correct|in)h(accord)g(with)h(the)e(sp)31 b(eci\257cation)365 b(of)f(the)g(ADT|and)g(not)h(ho)-31 b(w)364 b(it)0 47688 y(will)371 b(b)31 b(e)369 b(used.)0 49813 y(Con)-31 b(v)g(ersely)-92 b(,)429 b(the)415 b(clien)-31 b(t)417 b Fm(assumes)e Fn(that)h(the)g(implemen)-31 b(tation)420 b(of)c(the)f(ADT)h(is)f (correct)0 51168 y(and)539 b(do)31 b(esn't)540 b(w)-31 b(orry)540 b(ab)31 b(out)540 b(the)f(details.)1004 b(When)539 b(y)-31 b(ou)540 b(are)f(using)g(one)h(of)f(Python's)0 52523 y(built-in)371 b(t)-31 b(yp)31 b(es,)370 b(y)-31 b(ou)370 b(ha)-31 b(v)g(e)370 b(the)f(luxury)h(of)f(thinking)i (exclusiv)-31 b(ely)371 b(as)f(a)f(clien)-31 b(t.)0 54648 y(Of)386 b(course,)391 b(when)386 b(y)-31 b(ou)387 b(implemen)-31 b(t)389 b(an)d(ADT,)h(y)-31 b(ou)387 b(also)g(ha)-31 b(v)g(e)387 b(to)g(write)g(clien)-31 b(t)388 b(co)31 b(de)386 b(to)0 56003 y(test)403 b(it.)592 b(In)402 b(that)i(case,)410 b(y)-31 b(ou)403 b(pla)-31 b(y)404 b(b)31 b(oth)403 b(roles,)411 b(whic)-31 b(h)403 b(can)f(b)31 b(e)402 b(confusing.)593 b(Y)-92 b(ou)403 b(should)0 57358 y(mak)-31 b(e)370 b(some)g(e\256ort)f (to)h(k)-31 b(eep)370 b(trac)-31 b(k)370 b(of)f(whic)-31 b(h)370 b(role)g(y)-31 b(ou)370 b(are)f(pla)-31 b(ying)371 b(at)f(an)-31 b(y)370 b(momen)-31 b(t.)p eop %%Page: 195 221 195 220 bop 0 -2070 a Fv(18.9)425 b(Glossary)28784 b(195)p 0 -1627 38191 45 v 0 865 a Fl(18.9)1792 b(Glossary)0 3364 y Fv(abstract)424 b(data)h(t)-35 b(yp)35 b(e)425 b(\(ADT\):)553 b Fn(A)567 b(data)i(t)-31 b(yp)31 b(e)568 b(\(usually)h(a)f(collection)i(of)e(ob)61 b(jects\))2767 4719 y(that)511 b(is)e(de\257ned)h(b)-31 b(y)509 b(a)h(set)f(of)h(op)31 b(erations)511 b(but)f(that)g(can)g(b)31 b(e)509 b(implemen)-31 b(ted)512 b(in)2767 6074 y(a)370 b(v)-61 b(ariet)-31 b(y)370 b(of)g(w)-31 b(a)g(ys.)0 8314 y Fv(in)c(terface:)553 b Fn(The)370 b(set)f(of)h(op)31 b(erations)370 b(that)g(de\257ne)f(an)h (ADT.)0 10555 y Fv(implemen)-35 b(tation:)553 b Fn(Co)31 b(de)329 b(that)h(satis\257es)f(the)g(syn)-31 b(tactic)330 b(and)f(seman)-31 b(tic)331 b(requiremen)-31 b(ts)2767 11910 y(of)370 b(an)g(in)-31 b(terface.)0 14150 y Fv(clien)c(t:)552 b Fn(A)370 b(program)g(\(or)f(the)h(p)31 b(erson)368 b(who)i(wrote)g(it\))g(that)h(uses)d(an)h(ADT.)0 16391 y Fv(pro)-35 b(vider:)554 b Fn(The)370 b(co)31 b(de)369 b(\(or)g(the)h(p)31 b(erson)368 b(who)i(wrote)g(it\))g(that)h(implemen) -31 b(ts)371 b(an)e(ADT.)0 18631 y Fv(v)-35 b(eneer:)554 b Fn(A)453 b(class)g(de\257nition)i(that)f(implemen)-31 b(ts)455 b(an)f(ADT)e(with)j(metho)31 b(d)454 b(de\257nitions)2767 19986 y(that)313 b(are)e(in)-31 b(v)g(o)31 b(cations)314 b(of)d(other)h(metho)31 b(ds,)324 b(sometimes)312 b(with)h(simple)f (transforma-)2767 21341 y(tions.)465 b(The)282 b(v)-31 b(eneer)282 b(do)31 b(es)282 b(no)g(signi\257can)-31 b(t)284 b(w)-31 b(ork,)301 b(but)282 b(it)h(impro)-31 b(v)g(es)284 b(or)d(standardizes)2767 22696 y(the)370 b(in)-31 b(terface)370 b(seen)f(b)-31 b(y)369 b(the)h(clien)-31 b(t.)0 24936 y Fv(generic)426 b(data)e(structure:)554 b Fn(A)477 b(kind)h(of)f(data)h(structure)f(that)h(can)f(con)-31 b(tain)479 b(data)f(of)2767 26291 y(an)-31 b(y)370 b(t)-31 b(yp)31 b(e.)0 28532 y Fv(in\257x:)553 b Fn(A)410 b(w)-31 b(a)g(y)411 b(of)g(writing)h(mathematical)i(expressions)409 b(with)j(the)e(op)31 b(erators)410 b(b)31 b(et)-31 b(w)g(een)2767 29887 y(the)370 b(op)31 b(erands.)0 32127 y Fv(p)k(ost\257x:)554 b Fn(A)448 b(w)-31 b(a)g(y)450 b(of)e(writing)i(mathematical)i (expressions)c(with)h(the)f(op)31 b(erators)448 b(after)2767 33482 y(the)370 b(op)31 b(erands.)0 35723 y Fv(parse:)554 b Fn(T)-92 b(o)475 b(read)f(a)h(string)f(of)h(c)-31 b(haracters)475 b(or)f(tok)-31 b(ens)475 b(and)g(analyze)g(its)g(grammatical)2767 37078 y(structure.)0 39318 y Fv(tok)-35 b(en:)554 b Fn(A)424 b(set)f(of)i(c)-31 b(haracters)424 b(that)h(are)f(treated)g(as)g(a)g (unit)h(for)f(purp)31 b(oses)423 b(of)h(parsing,)2767 40673 y(suc)-31 b(h)369 b(as)g(the)h(w)-31 b(ords)369 b(in)h(a)f(natural)h(language.)0 42913 y Fv(delimiter:)553 b Fn(A)343 b(c)-31 b(haracter)344 b(that)h(is)e(used)g(to)h(separate)f (tok)-31 b(ens,)350 b(suc)-31 b(h)343 b(as)g(punctuation)j(in)2767 44268 y(a)370 b(natural)g(language.)p eop %%Page: 196 222 196 221 bop 0 -2070 a Fv(196)32757 b(Stac)-35 b(ks)p 0 -1627 38191 45 v eop %%Page: 197 223 197 222 bop 0 9955 a Fi(Chapter)861 b(19)0 16288 y Fo(Queues)0 22803 y Fn(This)275 b(c)-31 b(hapter)276 b(presen)-31 b(ts)274 b(t)-31 b(w)g(o)276 b(ADTs:)446 b(the)275 b(Queue)f(and)h(the) g(Priorit)-31 b(y)277 b(Queue.)461 b(In)274 b(real)h(life,)0 24158 y(a)250 b Fv(queue)h Fn(is)f(a)g(line)h(of)f(customers)g(w)-31 b(aiting)253 b(for)d(service)g(of)g(some)g(kind.)454 b(In)249 b(most)i(cases,)274 b(the)0 25513 y(\257rst)400 b(customer)h(in)f(line)h(is)f(the)h(next)g(customer)g(to)g(b)31 b(e)400 b(serv)-31 b(ed.)585 b(There)400 b(are)g(exceptions,)0 26868 y(though.)787 b(A)-31 b(t)467 b(airp)31 b(orts,)492 b(customers)467 b(whose)g(\260igh)-31 b(ts)468 b(are)f(lea)-31 b(ving)469 b(so)31 b(on)467 b(are)f(sometimes)0 28223 y(tak)-31 b(en)368 b(from)f(the)f(middle)i(of)f(the)f(queue.)492 b(A)-31 b(t)367 b(sup)31 b(ermark)-31 b(ets,)368 b(a)e(p)31 b(olite)368 b(customer)f(migh)-31 b(t)0 29578 y(let)370 b(someone)g(with)g(only)h(a)e(few)h(items)g(go)g(\257rst.)0 31665 y(The)431 b(rule)f(that)i(determines)f(who)h(go)31 b(es)431 b(next)g(is)f(called)i(the)f Fv(queueing)497 b(p)35 b(olicy)p Fn(.)677 b(The)0 33020 y(simplest)366 b(queueing)g(p)31 b(olicy)366 b(is)f(called)i Fv(FIF)-35 b(O)p Fn(,)365 b(for)g(\\\257rst-in-\257rst-out.")492 b(The)366 b(most)g(gen-)0 34374 y(eral)c(queueing)h(p)31 b(olicy)363 b(is)f Fv(priorit)-35 b(y)416 b(queueing)p Fn(,)365 b(in)d(whic)-31 b(h)363 b(eac)-31 b(h)362 b(customer)h(is)e (assigned)0 35729 y(a)465 b(priorit)-31 b(y)466 b(and)f(the)f(customer) h(with)h(the)f(highest)g(priorit)-31 b(y)466 b(go)31 b(es)465 b(\257rst,)488 b(regardless)464 b(of)0 37084 y(the)354 b(order)f(of)h(arriv)-61 b(al.)488 b(W)-92 b(e)353 b(sa)-31 b(y)355 b(this)f(is)f(the)h(most)h(general)f(p)31 b(olicy)355 b(b)31 b(ecause)354 b(the)g(priorit)-31 b(y)0 38439 y(can)438 b(b)31 b(e)437 b(based)g(on)h(an)-31 b(ything:)631 b(what)439 b(time)g(a)e(\260igh)-31 b(t)439 b(lea)-31 b(v)g(es;)473 b(ho)-31 b(w)439 b(man)-31 b(y)439 b(gro)31 b(ceries)437 b(the)0 39794 y(customer)i(has;)475 b(or)439 b(ho)-31 b(w)440 b(imp)31 b(ortan)-31 b(t)441 b(the)e(customer)g(is.)703 b(Of)439 b(course,)456 b(not)440 b(all)g(queueing)0 41149 y(p)31 b(olicies)370 b(are)f(\\fair,")i(but)f (fairness)f(is)g(in)g(the)h(ey)-31 b(e)369 b(of)h(the)f(b)31 b(eholder.)0 43236 y(The)338 b(Queue)f(ADT)g(and)h(the)g(Priorit)-31 b(y)339 b(Queue)e(ADT)h(ha)-31 b(v)g(e)338 b(the)g(same)g(set)f(of)h (op)31 b(erations.)0 44591 y(The)485 b(di\256erence)f(is)h(in)g(the)g (seman)-31 b(tics)486 b(of)f(the)g(op)31 b(erations:)725 b(a)485 b(queue)f(uses)g(the)h(FIF)-31 b(O)0 45946 y(p)31 b(olicy;)424 b(and)405 b(a)g(priorit)-31 b(y)406 b(queue)e(\(as)h(the)g (name)g(suggests\))h(uses)d(the)i(priorit)-31 b(y)406 b(queueing)0 47301 y(p)31 b(olicy)-92 b(.)0 51702 y Fl(19.1)1792 b(The)599 b(Queue)f(ADT)0 54123 y Fn(The)369 b(Queue)g(ADT)h(is)f (de\257ned)g(b)-31 b(y)369 b(the)g(follo)-31 b(wing)373 b(op)31 b(erations:)p 70 56545 349 45 v 488 56545 V 837 56545 a Fk(init)p 3231 56545 V 3650 56545 V 837 w Fv(:)553 b Fn(Initialize)372 b(a)d(new)h(empt)-31 b(y)370 b(queue.)0 58713 y Fk(insert)p Fv(:)554 b Fn(Add)369 b(a)h(new)f(item)h(to)g(the)g (queue.)p eop %%Page: 198 224 198 223 bop 0 -2070 a Fv(198)32242 b(Queues)p 0 -1627 38191 45 v 0 865 a Fk(remove)p Fv(:)554 b Fn(Remo)-31 b(v)g(e)324 b(and)f(return)f(an)h(item)h(from)g(the)f(queue.)477 b(The)323 b(item)h(that)g(is)f(returned)2767 2220 y(is)370 b(the)f(\257rst)g(one)g(that)h(w)-31 b(as)370 b(added.)0 4253 y Fk(isEmpty)p Fv(:)554 b Fn(Chec)-31 b(k)370 b(whether)f(the)h (queue)f(is)g(empt)-31 b(y)-92 b(.)0 8450 y Fl(19.2)1792 b(Link)-50 b(ed)600 b(Queue)0 10725 y Fn(The)390 b(\257rst)f(implemen) -31 b(tation)394 b(of)c(the)g(Queue)f(ADT)h(w)-31 b(e)390 b(will)i(lo)31 b(ok)391 b(at)f(is)g(called)h(a)f Fv(link)-35 b(ed)0 12080 y(queue)309 b Fn(b)31 b(ecause)307 b(it)h(is)g(made)g(up)f (of)i(link)-31 b(ed)308 b Fk(Node)g Fn(ob)61 b(jects.)474 b(Here)307 b(is)g(the)h(class)g(de\257nition:)0 14102 y Fk(class)582 b(Queue:)1162 15457 y(def)g(__init__\(self\):)2325 16812 y(self.length)g(=)g(0)2325 18167 y(self.head)g(=)f(None)1162 20876 y(def)h(isEmpty\(self\):)2325 22231 y(return)g(\(self.length)h (==)e(0\))1162 24941 y(def)h(insert\(self,)h(cargo\):)2325 26296 y(node)e(=)h(Node\(cargo\))2325 27651 y(node.next)g(=)f(None)2325 29006 y(if)g(self.head)i(==)e(None:)3487 30361 y(#)g(if)h(list)f(is)h (empty)g(the)f(new)h(node)g(goes)f(first)3487 31716 y(self.head)h(=)g (node)2325 33071 y(else:)3487 34426 y(#)f(find)h(the)g(last)f(node)h (in)f(the)h(list)3487 35781 y(last)g(=)f(self.head)3487 37136 y(while)h(last.next:)g(last)g(=)f(last.next)3487 38490 y(#)g(append)h(the)g(new)f(node)3487 39845 y(last.next)h(=)g (node)2325 41200 y(self.length)g(=)g(self.length)g(+)g(1)1162 43910 y(def)g(remove\(self\):)2325 45265 y(cargo)f(=)h(self.head.cargo) 2325 46620 y(self.head)g(=)f(self.head.next)2325 47975 y(self.length)h(=)g(self.length)g(-)g(1)2325 49330 y(return)g(cargo)0 51352 y Fn(The)486 b(metho)31 b(ds)486 b Fk(isEmpty)g Fn(and)g Fk(remove)g Fn(are)f(iden)-31 b(tical)488 b(to)e(the)g Fk(LinkedList)g Fn(metho)31 b(ds)0 52707 y Fk(isEmpty)346 b Fn(and)f Fk(removeFirst)p Fn(.)486 b(The)346 b Fk(insert)f Fn(metho)31 b(d)346 b(is)f(new)g(and)h(a)f(bit)h(more)f(compli-)0 54062 y(cated.)0 56003 y(W)-92 b(e)418 b(w)-31 b(an)g(t)421 b(to)e(insert)g(new)g(items)h(at)g(the)f(end)f(of)i(the)f(list.)642 b(If)419 b(the)g(queue)g(is)g(empt)-31 b(y)-92 b(,)432 b(w)-31 b(e)0 57358 y(just)369 b(set)g Fk(head)h Fn(to)g(refer)e(to)i (the)g(new)f(no)31 b(de.)p eop %%Page: 199 225 199 224 bop 0 -2070 a Fv(19.3)425 b(P)-35 b(erformance)426 b(c)-35 b(haracteristics)18200 b(199)p 0 -1627 38191 45 v 0 865 a Fn(Otherwise,)418 b(w)-31 b(e)407 b(tra)-31 b(v)g(erse)408 b(the)g(list)g(to)g(the)f(last)h(no)31 b(de)408 b(and)f(tac)-31 b(k)409 b(the)e(new)h(no)31 b(de)407 b(on)h(the)0 2220 y(end.)492 b(W)-92 b(e)369 b(can)g(iden)-31 b(tify)371 b(the)f(last)g(no)31 b(de)369 b(b)31 b(ecause)369 b(its)g Fk(next)h Fn(attribute)h(is)e Fk(None)p Fn(.)0 4399 y(There)520 b(are)f(t)-31 b(w)g(o)522 b(in)-31 b(v)-61 b(arian)-31 b(ts)521 b(for)f(a)g(prop)31 b(erly)520 b(formed)g Fk(Queue)h Fn(ob)61 b(ject.)946 b(The)520 b(v)-61 b(alue)520 b(of)0 5754 y Fk(length)395 b Fn(should)g(b)31 b(e)394 b(the)h(n)-31 b(um)g(b)31 b(er)394 b(of)h(no)31 b(des)394 b(in)h(the)f(queue,)402 b(and)394 b(the)h(last)g(no)31 b(de)395 b(should)0 7109 y(ha)-31 b(v)g(e)452 b Fk(next)g Fn(equal)g(to)g Fk(None)p Fn(.)739 b(Con)-31 b(vince)453 b(y)-31 b(ourself)452 b(that)h(this)e(metho)31 b(d)453 b(preserv)-31 b(es)449 b(b)31 b(oth)0 8464 y(in)-31 b(v)-61 b(arian)-31 b(ts.)0 13016 y Fl(19.3)1792 b(P)-50 b(erformance)600 b(c)-50 b(haracteristics)0 15535 y Fn(Normally)424 b(when)d(w)-31 b(e)422 b(in)-31 b(v)g(ok)g(e)423 b(a)f(metho)31 b(d,)436 b(w)-31 b(e)422 b(are)f(not)h(concerned)f(with)i(the)f(details)g(of)0 16890 y(its)519 b(implemen)-31 b(tation.)944 b(But)518 b(there)g(is)g(one)h(\\detail")i(w)-31 b(e)518 b(migh)-31 b(t)520 b(w)-31 b(an)g(t)520 b(to)f(kno)-31 b(w|the)0 18245 y(p)31 b(erformance)495 b(c)-31 b(haracteristics)496 b(of)f(the)f(metho)31 b(d.)870 b(Ho)-31 b(w)496 b(long)f(do)31 b(es)494 b(it)i(tak)-31 b(e,)527 b(and)495 b(ho)-31 b(w)0 19599 y(do)31 b(es)369 b(the)g(run)g(time)h(c)-31 b(hange)370 b(as)f(the)h(n)-31 b(um)g(b)31 b(er)369 b(of)h(items)g(in)f(the)h (collection)h(increases?)0 21779 y(First)347 b(lo)31 b(ok)350 b(at)e Fk(remove)p Fn(.)487 b(There)347 b(are)h(no)g(lo)31 b(ops)349 b(or)e(function)j(calls)e(here,)k(suggesting)e(that)0 23133 y(the)404 b(run)-31 b(time)404 b(of)g(this)g(metho)31 b(d)405 b(is)e(the)h(same)g(ev)-31 b(ery)404 b(time.)597 b(Suc)-31 b(h)403 b(a)h(metho)31 b(d)404 b(is)g(called)h(a)0 24488 y Fv(constan)-35 b(t-time)339 b Fn(op)31 b(eration.)484 b(In)337 b(realit)-31 b(y)-92 b(,)347 b(the)338 b(metho)31 b(d)340 b(migh)-31 b(t)340 b(b)31 b(e)338 b(sligh)-31 b(tly)340 b(faster)f(when)0 25843 y(the)402 b(list)g(is)f(empt)-31 b(y)403 b(since)e(it)h(skips)f(the)h(b)31 b(o)g(dy)401 b(of)h(the)f(conditional,)413 b(but)402 b(that)g(di\256erence)0 27198 y(is)369 b(not)h(signi\257can)-31 b(t.)0 29377 y(The)447 b(p)31 b(erformance)448 b(of)g Fk(insert)g Fn(is)f(v)-31 b(ery)447 b(di\256eren)-31 b(t.)727 b(In)447 b(the)g(general)h(case,)467 b(w)-31 b(e)448 b(ha)-31 b(v)g(e)448 b(to)0 30732 y(tra)-31 b(v)g(erse)369 b(the)h(list)g(to)g (\257nd)f(the)g(last)h(elemen)-31 b(t.)0 32911 y(This)267 b(tra)-31 b(v)g(ersal)267 b(tak)-31 b(es)267 b(time)h(prop)31 b(ortional)268 b(to)f(the)f(length)i(of)e(the)h(list.)459 b(Since)266 b(the)h(run)-31 b(time)0 34266 y(is)337 b(a)g(linear)h (function)h(of)e(the)h(length,)345 b(this)337 b(metho)31 b(d)338 b(is)f(called)i Fv(linear)387 b(time)p Fn(.)482 b(Compared)0 35621 y(to)370 b(constan)-31 b(t)371 b(time,)g(that's)f(v) -31 b(ery)369 b(bad.)0 40174 y Fl(19.4)1792 b(Impro)-50 b(v)g(ed)600 b(Link)-50 b(ed)600 b(Queue)0 42692 y Fn(W)-92 b(e)402 b(w)-31 b(ould)405 b(lik)-31 b(e)404 b(an)f(implemen)-31 b(tation)408 b(of)403 b(the)g(Queue)g(ADT)g(that)h(can)g(p)31 b(erform)402 b(all)j(op-)0 44047 y(erations)388 b(in)f(constan)-31 b(t)388 b(time.)546 b(One)387 b(w)-31 b(a)g(y)388 b(to)g(do)f(that)h (is)e(to)i(mo)31 b(dify)388 b(the)f(Queue)f(class)h(so)0 45402 y(that)442 b(it)g(main)-31 b(tains)444 b(a)d(reference)g(to)h(b) 31 b(oth)441 b(the)h(\257rst)e(and)i(the)f(last)h(no)31 b(de,)460 b(as)441 b(sho)-31 b(wn)442 b(in)0 46757 y(the)369 b(\257gure:)2206 48136 y 19997655 5459886 0 0 19997655 5459886 startTexFig 2206 48136 a %%BeginDocument: illustrations/queue1.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: queue1.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Tue Dec 11 11:01:07 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 304 83 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 83 moveto 0 0 lineto 304 0 lineto 304 83 lineto closepath clip newpath -89.0 100.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 4950 975 m 6525 975 l 6525 1650 l 4950 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1500 975 m 2850 975 l 2850 1650 l 1500 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 3225 975 m 4575 975 l 4575 1650 l 3225 1650 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1500 300 m 5475 300 l 5475 675 l 1500 675 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 4971 1485 m 4972 1425 l 4820 1424 l 4940 1455 l 4819 1484 l cp eoclip n 3825 1447 m 4957 1455 l gs col0 s gr gr % arrowhead n 4819 1484 m 4940 1455 l 4820 1424 l col0 s % Polyline gs clippath 4215 1177 m 4215 1117 l 4063 1117 l 4183 1147 l 4063 1177 l cp eoclip n 3825 1147 m 4200 1147 l gs col0 s gr gr % arrowhead n 4063 1177 m 4183 1147 l 4063 1117 l col0 s % Polyline gs clippath 3240 1477 m 3240 1417 l 3088 1417 l 3208 1447 l 3088 1477 l cp eoclip n 2100 1447 m 3225 1447 l gs col0 s gr gr % arrowhead n 3088 1477 m 3208 1447 l 3088 1417 l col0 s % Polyline gs clippath 2490 1177 m 2490 1117 l 2338 1117 l 2458 1147 l 2338 1177 l cp eoclip n 2100 1147 m 2475 1147 l gs col0 s gr gr % arrowhead n 2338 1177 m 2458 1147 l 2338 1117 l col0 s % Polyline gs clippath 5940 1477 m 5940 1417 l 5788 1417 l 5908 1447 l 5788 1477 l cp eoclip n 5550 1447 m 5925 1447 l gs col0 s gr gr % arrowhead n 5788 1477 m 5908 1447 l 5788 1417 l col0 s % Polyline gs clippath 5940 1177 m 5940 1117 l 5788 1117 l 5908 1147 l 5788 1177 l cp eoclip n 5550 1147 m 5925 1147 l gs col0 s gr gr % arrowhead n 5788 1177 m 5908 1147 l 5788 1117 l col0 s % Polyline gs clippath 5070 990 m 5130 990 l 5130 838 l 5100 958 l 5070 838 l cp eoclip n 5100 600 m 5100 975 l gs col0 s gr gr % arrowhead n 5070 838 m 5100 958 l 5130 838 l col0 s % Polyline gs clippath 1845 990 m 1905 990 l 1905 838 l 1875 958 l 1845 838 l cp eoclip n 1875 600 m 1875 975 l gs col0 s gr gr % arrowhead n 1845 838 m 1875 958 l 1905 838 l col0 s % Polyline gs clippath 3765 502 m 3765 442 l 3613 442 l 3733 472 l 3613 502 l cp eoclip n 3375 472 m 3750 472 l gs col0 s gr gr % arrowhead n 3613 502 m 3733 472 l 3613 442 l col0 s /Helvetica ff 165.00 scf sf 3750 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3750 1500 m gs 1 -1 sc (next) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2025 1500 m gs 1 -1 sc (next) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 5475 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 5475 1500 m gs 1 -1 sc (next) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 1200 m gs 1 -1 sc (1) col0 sh gr /Helvetica ff 165.00 scf sf 4275 1200 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 6000 1200 m gs 1 -1 sc (3) col0 sh gr /Helvetica ff 165.00 scf sf 2100 525 m gs 1 -1 sc (head) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 5175 525 m gs 1 -1 sc (last) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3300 525 m gs 1 -1 sc (length) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3825 525 m gs 1 -1 sc (3) col0 sh gr $F2psEnd rs %%EndDocument endTexFig eop %%Page: 200 226 200 225 bop 0 -2070 a Fv(200)32242 b(Queues)p 0 -1627 38191 45 v 0 865 a Fn(The)369 b Fk(ImprovedQueue)i Fn(implemen)-31 b(tation)374 b(lo)31 b(oks)370 b(lik)-31 b(e)370 b(this:)0 3068 y Fk(class)582 b(ImprovedQueue:)1162 4423 y(def)g (__init__\(self\):)2325 5778 y(self.length)g(=)g(0)2325 7133 y(self.head)1744 b(=)582 b(None)2325 8488 y(self.last)1744 b(=)582 b(None)1162 11197 y(def)g(isEmpty\(self\):)2325 12552 y(return)g(\(self.length)h(==)e(0\))0 14755 y Fn(So)382 b(far,)i(the)e(only)g(c)-31 b(hange)383 b(is)e(the)g(attribute)i Fk(last)p Fn(.)530 b(It)381 b(is)g(used)g(in)h Fk(insert)g Fn(and)f Fk(remove)0 16110 y Fn(metho)31 b(ds:)0 18313 y Fk(class)582 b(ImprovedQueue:)1162 19668 y(...)1162 21023 y(def)g(insert\(self,)h(cargo\):)2325 22378 y(node)e(=)h (Node\(cargo\))2325 23732 y(node.next)g(=)f(None)2325 25087 y(if)g(self.length)i(==)e(0:)3487 26442 y(#)g(if)h(list)f(is)h (empty,)g(the)f(new)h(node)g(is)f(head)h(and)g(last)3487 27797 y(self.head)g(=)g(self.last)g(=)f(node)2325 29152 y(else:)3487 30507 y(#)g(find)h(the)g(last)f(node)3487 31862 y(last)h(=)f(self.last)3487 33217 y(#)g(append)h(the)g(new)f (node)3487 34572 y(last.next)h(=)g(node)3487 35927 y(self.last)g(=)g (node)2325 37282 y(self.length)g(=)g(self.length)g(+)g(1)0 39484 y Fn(Since)444 b Fk(last)g Fn(k)-31 b(eeps)444 b(trac)-31 b(k)445 b(of)f(the)g(last)h(no)31 b(de,)463 b(w)-31 b(e)444 b(don't)h(ha)-31 b(v)g(e)445 b(to)f(searc)-31 b(h)444 b(for)g(it.)717 b(As)444 b(a)0 40839 y(result,)370 b(this)f(metho)31 b(d)370 b(is)f(constan)-31 b(t)371 b(time.)0 42961 y(There)342 b(is)f(a)i(price)e(to)i(pa)-31 b(y)343 b(for)f(that)h(sp)31 b(eed.)482 b(W)-92 b(e)342 b(ha)-31 b(v)g(e)342 b(to)h(add)f(a)g(sp)31 b(ecial)343 b(case)f(to)g Fk(remove)0 44316 y Fn(to)370 b(set)f Fk(last)h Fn(to)g Fk(None)f Fn(when)h(the)f(last)h(no)31 b(de)369 b(is)g(remo)-31 b(v)g(ed:)0 46519 y Fk(class)582 b(ImprovedQueue:)1162 47874 y(...)1162 49229 y(def)g(remove\(self\):)2325 50584 y(cargo)2906 b(=)581 b(self.head.cargo)2325 51938 y(self.head)h(=)f (self.head.next)2325 53293 y(self.length)h(=)g(self.length)g(-)g(1)2325 54648 y(if)f(self.length)i(==)e(0:)3487 56003 y(self.last)h(=)g(None) 2325 57358 y(return)g(cargo)p eop %%Page: 201 227 201 226 bop 0 -2070 a Fv(19.5)425 b(Priorit)-35 b(y)425 b(queue)25523 b(201)p 0 -1627 38191 45 v 0 865 a Fn(This)387 b(implemen)-31 b(tation)390 b(is)c(more)h(complicated)i(than)e(the)f (Link)-31 b(ed)387 b(Queue)f(implemen)-31 b(ta-)0 2220 y(tion,)439 b(and)424 b(it)g(is)g(more)g(di\261cult)h(to)f(demonstrate) h(that)g(it)g(is)e(correct.)656 b(The)424 b(adv)-61 b(an)-31 b(tage)0 3575 y(is)379 b(that)i(w)-31 b(e)380 b(ha)-31 b(v)g(e)381 b(ac)-31 b(hiev)g(ed)381 b(the)e(goal|b)31 b(oth)382 b Fk(insert)f Fn(and)e Fk(remove)i Fn(are)e(constan)-31 b(t-time)0 4930 y(op)31 b(erations.)2767 7541 y Fm(As)371 b(an)g(exer)-57 b(cise,)377 b(write)371 b(an)g(implementation)i(of)e (the)g(Queue)g(ADT)g(using)h(a)2767 8896 y(Python)360 b(list.)497 b(Comp)-57 b(ar)g(e)361 b(the)e(p)-57 b(erformanc)g(e)361 b(of)f(this)g(implementation)h(to)e(the)2767 10250 y Fk(ImprovedQueue)398 b Fm(for)e(a)g(r)-57 b(ange)397 b(of)f(queue)h(lengths.)0 14744 y Fl(19.5)1792 b(Priorit)-50 b(y)600 b(queue)0 17231 y Fn(The)250 b(Priorit)-31 b(y)251 b(Queue)f(ADT)g(has)f(the)h(same)g(in)-31 b(terface)251 b(as)f(the)g(Queue)f(ADT,)i(but)f(di\256eren)-31 b(t)0 18586 y(seman)g(tics.)494 b(Again,)371 b(the)e(in)-31 b(terface)371 b(is:)p 70 21196 349 45 v 488 21196 V 837 21196 a Fk(init)p 3231 21196 V 3650 21196 V 837 w Fv(:)553 b Fn(Initialize)372 b(a)d(new)h(empt)-31 b(y)370 b(queue.)0 23425 y Fk(insert)p Fv(:)554 b Fn(Add)369 b(a)h(new)f(item)h(to)g(the)g (queue.)0 25655 y Fk(remove)p Fv(:)554 b Fn(Remo)-31 b(v)g(e)324 b(and)f(return)f(an)h(item)h(from)g(the)f(queue.)477 b(The)323 b(item)h(that)g(is)f(returned)2767 27010 y(is)370 b(the)f(one)g(with)i(the)e(highest)h(priorit)-31 b(y)-92 b(.)0 29239 y Fk(isEmpty)p Fv(:)554 b Fn(Chec)-31 b(k)370 b(whether)f(the)h(queue)f(is)g(empt)-31 b(y)-92 b(.)0 31849 y(The)378 b(seman)-31 b(tic)379 b(di\256erence)e(is)h(that)h(the) f(item)h(that)g(is)f(remo)-31 b(v)g(ed)379 b(from)f(the)g(queue)g(is)f (not)0 33204 y(necessarily)466 b(the)h(\257rst)e(one)h(that)i(w)-31 b(as)466 b(added.)784 b(Rather,)491 b(it)467 b(is)f(the)g(item)h(in)g (the)f(queue)0 34559 y(that)357 b(has)g(the)f(highest)h(priorit)-31 b(y)-92 b(.)490 b(What)356 b(the)h(priorities)g(are)f(and)g(ho)-31 b(w)358 b(they)e(compare)h(to)0 35914 y(eac)-31 b(h)374 b(other)f(are)g(not)h(sp)31 b(eci\257ed)373 b(b)-31 b(y)373 b(the)h(Priorit)-31 b(y)375 b(Queue)e(implemen)-31 b(tation.)509 b(It)373 b(dep)31 b(ends)0 37269 y(on)369 b(whic)-31 b(h)371 b(items)f(are)f(in)g(the)h(queue.)0 39422 y(F)-92 b(or)438 b(example,)458 b(if)439 b(the)g(items)h(in)f(the)g(queue)f(ha) -31 b(v)g(e)440 b(names,)457 b(w)-31 b(e)439 b(migh)-31 b(t)441 b(c)-31 b(ho)31 b(ose)439 b(them)h(in)0 40777 y(alphab)31 b(etical)501 b(order.)880 b(If)498 b(they)h(are)f(b)31 b(o)-31 b(wling)501 b(scores,)530 b(w)-31 b(e)499 b(migh)-31 b(t)501 b(go)e(from)g(highest)g(to)0 42132 y(lo)-31 b(w)g(est,)371 b(but)d(if)h(they)f(are)g(golf)i(scores,)d(w)-31 b(e)369 b(w)-31 b(ould)370 b(go)e(from)h(lo)-31 b(w)g(est)370 b(to)f(highest.)493 b(As)368 b(long)0 43487 y(as)325 b(w)-31 b(e)326 b(can)f(compare)h(the)g(items)g(in)f(the)h(queue,)334 b(w)-31 b(e)326 b(can)f(\257nd)g(and)h(remo)-31 b(v)g(e)326 b(the)f(one)h(with)0 44842 y(the)369 b(highest)h(priorit)-31 b(y)-92 b(.)0 46995 y(This)423 b(implemen)-31 b(tation)427 b(of)c(Priorit)-31 b(y)425 b(Queue)d(has)h(as)g(an)g(attribute)h(a)f (Python)h(list)g(that)0 48350 y(con)-31 b(tains)371 b(the)e(items)h(in) g(the)f(queue.)0 50584 y Fk(class)582 b(PriorityQueue:)1162 51938 y(def)g(__init__\(self\):)2325 53293 y(self.items)g(=)g([])1162 56003 y(def)g(isEmpty\(self\):)2325 57358 y(return)g(self.items)g(==)g ([])p eop %%Page: 202 228 202 227 bop 0 -2070 a Fv(202)32242 b(Queues)p 0 -1627 38191 45 v 1162 2220 a Fk(def)582 b(insert\(self,)h(item\):)2325 3575 y(self.items.append\(item\))0 5586 y Fn(The)427 b(initialization)432 b(metho)31 b(d,)443 b Fk(isEmpty)p Fn(,)g(and)427 b Fk(insert)h Fn(are)e(all)j(v)-31 b(eneers)426 b(on)h(list)h(op)31 b(era-)0 6941 y(tions.)494 b(The)369 b(only)h(in)-31 b(teresting)371 b(metho)31 b(d)370 b(is)f Fk(remove)p Fn(:)0 8952 y Fk(class)582 b(PriorityQueue:)1162 10307 y(...)1162 11662 y(def)g(remove\(self\):)2325 13017 y(maxi)f(=)h(0)2325 14372 y(for)f(i)g(in)h (range\(1,len\(self.items\)\):)3487 15727 y(if)f(self.items[i])i(>)f (self.items[maxi]:)4649 17082 y(maxi)g(=)f(i)2325 18436 y(item)g(=)h(self.items[maxi])2325 19791 y(self.items[maxi:maxi+1])i(=) d([])2325 21146 y(return)h(item)0 23157 y Fn(A)-31 b(t)483 b(the)g(b)31 b(eginning)484 b(of)g(eac)-31 b(h)483 b(iteration,)513 b Fk(maxi)484 b Fn(holds)f(the)f(index)i(of)f(the)g(biggest)h(item)0 24512 y(\(highest)309 b(priorit)-31 b(y\))310 b(w)-31 b(e)308 b(ha)-31 b(v)g(e)309 b(seen)f Fm(so)339 b(far)p Fn(.)472 b(Eac)-31 b(h)308 b(time)i(through)e(the)g(lo)31 b(op,)322 b(the)308 b(program)0 25867 y(compares)393 b(the)g Fk(i)p Fn(-eth)h(item)g(to)f(the)g(c)-31 b(hampion.)566 b(If)392 b(the)h(new)h(item)g(is)e(bigger,)400 b(the)393 b(v)-61 b(alue)0 27222 y(of)370 b Fk(maxi)f Fn(if)h(set)f(to)h Fk(i)p Fn(.)0 29152 y(When)340 b(the)h Fk(for)g Fn(statemen)-31 b(t)342 b(completes,)348 b Fk(maxi)341 b Fn(is)g(the)f(index)h(of)h (the)e(biggest)i(item.)485 b(This)0 30507 y(item)370 b(is)g(remo)-31 b(v)g(ed)370 b(from)f(the)h(list)g(and)f(returned.)0 32437 y(Let's)g(test)h(the)f(implemen)-31 b(tation:)0 34448 y Fk(>>>)582 b(q)f(=)g(PriorityQueue\(\))0 35803 y(>>>)h(q.insert\(11\))0 37158 y(>>>)g(q.insert\(12\))0 38513 y(>>>)g(q.insert\(14\))0 39868 y(>>>)g(q.insert\(13\))0 41223 y(>>>)g(while)f(not)h(q.isEmpty\(\):)h(print)f(q.remove\(\))0 42578 y(14)0 43933 y(13)0 45288 y(12)0 46642 y(11)0 48654 y Fn(If)349 b(the)h(queue)f(con)-31 b(tains)351 b(simple)f(n)-31 b(um)g(b)31 b(ers)349 b(or)g(strings,)354 b(they)c(are)f(remo)-31 b(v)g(ed)351 b(in)e(n)-31 b(umerical)0 50008 y(or)254 b(alphab)31 b(etical)257 b(order,)277 b(from)255 b(highest)g(to)g(lo) -31 b(w)g(est.)457 b(Python)255 b(can)g(\257nd)f(the)g(biggest)i(in)-31 b(teger)0 51363 y(or)348 b(string)g(b)31 b(ecause)348 b(it)g(can)h(compare)f(them)h(using)f(the)g(built-in)i(comparison)f(op) 31 b(erators.)0 53293 y(If)337 b(the)h(queue)f(con)-31 b(tains)339 b(an)e(ob)61 b(ject)339 b(t)-31 b(yp)31 b(e,)344 b(it)339 b(has)e(to)h(pro)-31 b(vide)338 b(a)p 27198 53293 349 45 v 27616 53293 V 1174 w Fk(cmp)p 29778 53293 V 30197 53293 V 1175 w Fn(metho)31 b(d.)482 b(When)0 54648 y Fk(remove)394 b Fn(uses)f(the)h Fk(>)g Fn(op)31 b(erator)394 b(to)h(compare)f(items,)401 b(it)395 b(in)-31 b(v)g(ok)g(es)395 b(the)p 29785 54648 V 30203 54648 V 1231 w Fk(cmp)p 32365 54648 V 32783 54648 V 1231 w Fn(for)e(one)h(of)0 56003 y(the)387 b(items)h(and)f(passes)f(the)h(other)g(as)g(a)g (parameter.)546 b(As)386 b(long)i(as)f(the)p 30797 56003 V 31215 56003 V 1224 w Fk(cmp)p 33377 56003 V 33796 56003 V 1224 w Fn(metho)31 b(d)0 57358 y(w)-31 b(orks)370 b(correctly)-92 b(,)370 b(the)f(Priorit)-31 b(y)371 b(Queue)e(will)i(w)-31 b(ork.)p eop %%Page: 203 229 203 228 bop 0 -2070 a Fv(19.6)425 b(The)g Fk(Golfer)g Fv(class)24539 b(203)p 0 -1627 38191 45 v 0 865 a Fl(19.6)1792 b(The)599 b Fe(Golfer)g Fl(class)0 3198 y Fn(As)256 b(an)h(example)i (of)e(an)g(ob)61 b(ject)258 b(with)g(an)f(un)-31 b(usual)257 b(de\257nition)i(of)e(priorit)-31 b(y)-92 b(,)281 b(let's)258 b(implemen)-31 b(t)0 4553 y(a)440 b(class)g(called)h Fk(Golfer)f Fn(that)h(k)-31 b(eeps)440 b(trac)-31 b(k)440 b(of)g(the)g(names)g(and)g(scores)f(of)h(golfers.)705 b(As)0 5908 y(usual,)370 b(w)-31 b(e)370 b(start)f(b)-31 b(y)370 b(de\257ning)p 13276 5908 349 45 v 13695 5908 V 1207 w Fk(init)p 16438 5908 V 16856 5908 V 1206 w Fn(and)p 19796 5908 V 20215 5908 V 1206 w Fk(str)p 22376 5908 V 22795 5908 V 838 w Fn(:)0 7988 y Fk(class)582 b(Golfer:)1162 9343 y(def)g(__init__\(self,)h(name,)f(score\):)2325 10698 y(self.name)g(=)f(name)2325 12053 y(self.score=)h(score)1162 14763 y(def)g(__str__\(self\):)2325 16117 y(return)g("\045-16s:)g (\045d")f(\045)h(\(self.name,)h(self.score\))p 70 18198 V 488 18198 V 837 18198 a(str)p 2650 18198 V 3068 18198 V 1206 w Fn(uses)368 b(the)i(format)g(op)31 b(erator)370 b(to)g(put)g(the)f(names)h(and)f(scores)f(in)i(neat)g(columns.)0 20197 y(Next)352 b(w)-31 b(e)351 b(de\257ne)g(a)h(v)-31 b(ersion)351 b(of)p 13439 20197 V 13857 20197 V 1189 w Fk(cmp)p 16019 20197 V 16437 20197 V 1188 w Fn(where)g(the)g(lo)-31 b(w)g(est)353 b(score)e(gets)g(highest)h(priorit)-31 b(y)-92 b(.)0 21552 y(As)368 b(alw)-31 b(a)g(ys,)p 5553 21552 V 5971 21552 V 1207 w Fk(cmp)p 8133 21552 V 8552 21552 V 1205 w Fn(returns)367 b(1)h(if)g Fk(self)h Fn(is)e(\\greater)i (than")g Fk(other)p Fn(,)g(-1)f(if)h Fk(self)f Fn(is)g(\\less)0 22907 y(than")i(other,)g(and)g(0)f(if)h(they)g(are)f(equal.)0 24987 y Fk(class)582 b(Golfer:)1162 26342 y(...)1162 27697 y(def)g(__cmp__\(self,)h(other\):)2325 29052 y(if)e(self.score)i (<)e(other.score:)i(return)1163 b(1)1744 b(#)581 b(less)h(is)f(more) 2325 30407 y(if)g(self.score)i(>)e(other.score:)i(return)f(-1)2325 31761 y(return)g(0)0 33842 y Fn(No)-31 b(w)370 b(w)-31 b(e)370 b(are)f(ready)g(to)h(test)g(the)f(priorit)-31 b(y)371 b(queue)e(with)h(the)g Fk(Golfer)g Fn(class:)0 35922 y Fk(>>>)582 b(tiger)f(=)h(Golfer\("Tiger)h(Woods",)2326 b(61\))0 37277 y(>>>)582 b(phil)1162 b(=)582 b(Golfer\("Phil)h (Mickelson",)g(72\))0 38632 y(>>>)f(hal)1743 b(=)582 b(Golfer\("Hal)h(Sutton",)2907 b(69\))0 39987 y(>>>)0 41341 y(>>>)582 b(pq)f(=)g(PriorityQueue\(\))0 42696 y(>>>)h(pq.insert\(tiger\))0 44051 y(>>>)g(pq.insert\(phil\))0 45406 y(>>>)g(pq.insert\(hal\))0 46761 y(>>>)g(while)f(not)h (pq.isEmpty\(\):)h(print)f(pq.remove\(\))0 48116 y(Tiger)g(Woods)2325 b(:)582 b(61)0 49471 y(Hal)g(Sutton)2906 b(:)582 b(69)0 50826 y(Phil)g(Mickelson)g(:)g(72)2767 53078 y Fm(As)332 b(an)h(exer)-57 b(cise,)346 b(write)332 b(an)g(implementation)i(of)f (the)f(Priority)g(Queue)h(ADT)2767 54433 y(using)366 b(a)e(linke)-57 b(d)366 b(list.)499 b(Y)-85 b(ou)364 b(should)g(ke)-57 b(ep)365 b(the)f(list)g(sorte)-57 b(d)364 b(so)g(that)g(r)-57 b(emoval)365 b(is)2767 55788 y(a)418 b(c)-57 b(onstant)417 b(time)h(op)-57 b(er)g(ation.)575 b(Comp)-57 b(ar)g(e)418 b(the)f(p)-57 b(erformanc)g(e)419 b(of)f(this)f(imple-)2767 57143 y(mentation)397 b(with)f(the)f(Python)i (list)e(implementation.)p eop %%Page: 204 230 204 229 bop 0 -2070 a Fv(204)32242 b(Queues)p 0 -1627 38191 45 v 0 865 a Fl(19.7)1792 b(Glossary)0 3364 y Fv(queue:)554 b Fn(An)369 b(ordered)g(set)g(of)h(ob)61 b(jects)370 b(w)-31 b(aiting)372 b(for)d(a)h(service)f(of)g(some)h(kind.)0 5604 y Fv(Queue:)555 b Fn(An)352 b(ADT)h(that)h(p)31 b(erforms)352 b(the)h(op)31 b(erations)353 b(one)g(migh)-31 b(t)354 b(p)31 b(erform)353 b(on)g(a)f(queue.)0 7845 y Fv(queueing)426 b(p)35 b(olicy:)553 b Fn(The)461 b(rules)f(that)i (determine)g(whic)-31 b(h)462 b(mem)-31 b(b)31 b(er)461 b(of)g(a)g(queue)g(is)g(re-)2767 9200 y(mo)-31 b(v)g(ed)371 b(next.)0 11440 y Fv(FIF)-35 b(O:)553 b Fn(\\First)432 b(In,)449 b(First)432 b(Out,")449 b(a)433 b(queueing)h(p)31 b(olicy)433 b(in)g(whic)-31 b(h)434 b(the)e(\257rst)g(mem)-31 b(b)31 b(er)433 b(to)2767 12795 y(arriv)-31 b(e)370 b(is)f(the)g (\257rst)g(to)h(b)31 b(e)369 b(remo)-31 b(v)g(ed.)0 15036 y Fv(priorit)c(y)424 b(queue:)555 b Fn(A)439 b(queueing)h(p)31 b(olicy)441 b(in)e(whic)-31 b(h)440 b(eac)-31 b(h)440 b(mem)-31 b(b)31 b(er)440 b(has)f(a)h(priorit)-31 b(y)440 b(de-)2767 16391 y(termined)319 b(b)-31 b(y)318 b(external)h(factors.) 477 b(The)318 b(mem)-31 b(b)31 b(er)318 b(with)h(the)g(highest)f (priorit)-31 b(y)320 b(is)e(the)2767 17746 y(\257rst)369 b(to)h(b)31 b(e)369 b(remo)-31 b(v)g(ed.)0 19986 y Fv(Priorit)c(y)424 b(Queue:)555 b Fn(An)412 b(ADT)g(that)i(de\257nes)d(the)h(op)31 b(erations)413 b(one)g(migh)-31 b(t)414 b(p)31 b(erform)412 b(on)2767 21341 y(a)370 b(priorit)-31 b(y)370 b(queue.)0 23581 y Fv(link)-35 b(ed)424 b(queue:)554 b Fn(An)369 b(implemen)-31 b(tation)374 b(of)c(a)f(queue)g(using)h(a)f(link)-31 b(ed)371 b(list.)0 25822 y Fv(constan)-35 b(t)425 b(time:)553 b Fn(An)443 b(op)31 b(eration)446 b(whose)e(run)-31 b(time)444 b(do)31 b(es)444 b(not)g(dep)31 b(end)443 b(on)h(the)g(size)f(of)2767 27177 y(the)370 b(data)g(structure.)0 29417 y Fv(linear)424 b(time:)553 b Fn(An)330 b(op)31 b(eration)331 b(whose)f(run)-31 b(time)331 b(is)e(a)h(linear)h(function)g(of)f(the)g(size)f(of)i(the) 2767 30772 y(data)371 b(structure.)p eop %%Page: 205 231 205 230 bop 0 10169 a Fi(Chapter)861 b(20)0 16716 y Fo(T)-258 b(rees)0 23444 y Fn(Lik)-31 b(e)294 b(link)-31 b(ed)295 b(lists,)309 b(trees)293 b(are)g(made)h(up)f(of)h(no)31 b(des.)467 b(A)293 b(common)i(kind)f(of)g(tree)f(is)g(a)h Fv(binary)0 24799 y(tree)p Fn(,)315 b(in)299 b(whic)-31 b(h)300 b(eac)-31 b(h)299 b(no)31 b(de)299 b(con)-31 b(tains)301 b(a)e(reference)f(to)i(t)-31 b(w)g(o)301 b(other)e(no)31 b(des)299 b(\(p)31 b(ossibly)300 b(n)-31 b(ull\).)0 26154 y(These)402 b(references)g(are)g(referred)f(to)j(as)e (the)h(left)h(and)f(righ)-31 b(t)403 b(subtrees.)592 b(Lik)-31 b(e)403 b(list)h(no)31 b(des,)0 27509 y(tree)369 b(no)31 b(des)369 b(also)h(con)-31 b(tain)371 b(cargo.)493 b(A)370 b(state)g(diagram)h(for)e(a)g(tree)g(lo)31 b(oks)370 b(lik)-31 b(e)371 b(this:)10595 28888 y 10064586 8051672 0 0 14077296 11182899 startTexFig 10595 28888 a %%BeginDocument: illustrations/tree1.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: tree1.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Tue Dec 11 17:35:32 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 214 170 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 170 moveto 0 0 lineto 214 0 lineto 214 170 lineto closepath clip newpath -93.0 194.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 2550 975 m 4125 975 l 4125 1725 l 2550 1725 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1575 2025 m 3150 2025 l 3150 2775 l 1575 2775 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 3525 2025 m 5100 2025 l 5100 2775 l 3525 2775 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 3690 1177 m 3690 1117 l 3538 1117 l 3658 1147 l 3538 1177 l cp eoclip n 3300 1147 m 3675 1147 l gs col0 s gr gr % arrowhead n 3538 1177 m 3658 1147 l 3538 1117 l col0 s /Helvetica ff 165.00 scf sf 3225 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3750 1200 m gs 1 -1 sc (1) col0 sh gr % Polyline gs clippath 2591 2020 m 2641 2054 l 2725 1927 l 2634 2011 l 2675 1894 l cp eoclip n 2925 1575 m 2625 2025 l gs col0 s gr gr % arrowhead n 2675 1894 m 2634 2011 l 2725 1927 l col0 s % Polyline gs clippath 4033 2054 m 4083 2020 l 3999 1894 l 4041 2011 l 3949 1927 l cp eoclip n 3750 1575 m 4050 2025 l gs col0 s gr gr % arrowhead n 3949 1927 m 4041 2011 l 3999 1894 l col0 s % Polyline gs clippath 1691 3075 m 1745 3101 l 1812 2966 l 1732 3060 l 1758 2939 l cp eoclip n 1950 2625 m 1725 3075 l gs col0 s gr gr % arrowhead n 1758 2939 m 1732 3060 l 1812 2966 l col0 s % Polyline gs clippath 3641 3075 m 3695 3101 l 3762 2966 l 3682 3060 l 3708 2939 l cp eoclip n 3900 2625 m 3675 3075 l gs col0 s gr gr % arrowhead n 3708 2939 m 3682 3060 l 3762 2966 l col0 s % Polyline gs clippath 2979 3101 m 3033 3075 l 2966 2939 l 2993 3060 l 2912 2966 l cp eoclip n 2775 2625 m 3000 3075 l gs col0 s gr gr % arrowhead n 2912 2966 m 2993 3060 l 2966 2939 l col0 s % Polyline gs clippath 4929 3101 m 4983 3075 l 4916 2939 l 4943 3060 l 4862 2966 l cp eoclip n 4725 2625 m 4950 3075 l gs col0 s gr gr % arrowhead n 4862 2966 m 4943 3060 l 4916 2939 l col0 s % Polyline gs clippath 3270 990 m 3330 990 l 3330 838 l 3300 958 l 3270 838 l cp eoclip n 3300 600 m 3300 975 l gs col0 s gr gr % arrowhead n 3270 838 m 3300 958 l 3330 838 l col0 s % Polyline gs clippath 2715 2227 m 2715 2167 l 2563 2167 l 2683 2197 l 2563 2227 l cp eoclip n 2325 2197 m 2700 2197 l gs col0 s gr gr % arrowhead n 2563 2227 m 2683 2197 l 2563 2167 l col0 s % Polyline gs clippath 4665 2227 m 4665 2167 l 4513 2167 l 4633 2197 l 4513 2227 l cp eoclip n 4275 2197 m 4650 2197 l gs col0 s gr gr % arrowhead n 4513 2227 m 4633 2197 l 4513 2167 l col0 s /Helvetica ff 165.00 scf sf 3150 525 m gs 1 -1 sc (tree) col0 sh gr /Helvetica ff 165.00 scf sf 1575 3225 m gs 1 -1 sc (None) col0 sh gr /Helvetica ff 165.00 scf sf 2775 3225 m gs 1 -1 sc (None) col0 sh gr /Helvetica ff 165.00 scf sf 3525 3225 m gs 1 -1 sc (None) col0 sh gr /Helvetica ff 165.00 scf sf 4725 3225 m gs 1 -1 sc (None) col0 sh gr /Helvetica ff 165.00 scf sf 3075 1500 m gs 1 -1 sc (left) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3525 1500 m gs 1 -1 sc (right) col0 sh gr /Helvetica ff 165.00 scf sf 2100 2550 m gs 1 -1 sc (left) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 2550 m gs 1 -1 sc (right) col0 sh gr /Helvetica ff 165.00 scf sf 4050 2550 m gs 1 -1 sc (left) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4500 2550 m gs 1 -1 sc (right) col0 sh gr /Helvetica ff 165.00 scf sf 2250 2250 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2775 2250 m gs 1 -1 sc (2) col0 sh gr /Helvetica ff 165.00 scf sf 4200 2250 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4725 2250 m gs 1 -1 sc (3) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 44627 a Fn(T)-92 b(o)370 b(a)-31 b(v)g(oid)371 b(cluttering)g(up)e (the)g(picture,)h(w)-31 b(e)370 b(often)g(omit)h(the)e Fk(Nones)p Fn(.)0 46928 y(The)321 b(top)h(of)g(the)f(tree)g(\(the)h(no) 31 b(de)321 b Fk(tree)g Fn(refers)f(to\))i(is)f(called)h(the)g Fv(ro)35 b(ot)p Fn(.)478 b(In)320 b(k)-31 b(eeping)323 b(with)0 48283 y(the)462 b(tree)g(metaphor,)486 b(the)462 b(other)g(no)31 b(des)462 b(are)f(called)i(branc)-31 b(hes)462 b(and)g(the)g(no)31 b(des)461 b(at)i(the)0 49638 y(tips)396 b(with)g(n)-31 b(ull)396 b(references)e(are)h(called)i Fv(lea)-35 b(v)g(es)p Fn(.)570 b(It)395 b(ma)-31 b(y)396 b(seem)g(o)31 b(dd)395 b(that)h(w)-31 b(e)396 b(dra)-31 b(w)396 b(the)0 50993 y(picture)404 b(with)h(the)g(ro)31 b(ot)404 b(at)h(the)f(top)h(and)f(the)h(lea)-31 b(v)g(es)405 b(at)f(the)h(b)31 b(ottom,)415 b(but)404 b(that)h(is)f(not)0 52348 y(the)369 b(strangest)h(thing.)0 54648 y(T)-92 b(o)284 b(mak)-31 b(e)284 b(things)g(w)-31 b(orse,)301 b(computer)284 b(scien)-31 b(tists)284 b(mix)g(in)g(another)g (metaphor|the)h(family)0 56003 y(tree.)495 b(The)371 b(top)f(no)31 b(de)370 b(is)g(sometimes)i(called)f(a)g Fv(paren)-35 b(t)370 b Fn(and)g(the)h(no)31 b(des)370 b(it)g(refers)f(to)i(are)0 57358 y(its)f Fv(c)-35 b(hildren)p Fn(.)492 b(No)31 b(des)369 b(with)i(the)e(same)h(paren)-31 b(t)369 b(are)g(called)i Fv(siblings)p Fn(.)p eop %%Page: 206 232 206 231 bop 0 -2070 a Fv(206)33309 b(T)-106 b(rees)p 0 -1627 38191 45 v 0 865 a Fn(Finally)-92 b(,)515 b(there)483 b(is)h(a)h(geometric)h(v)-31 b(o)31 b(cabulary)485 b(for)f(talking)j (ab)31 b(out)485 b(trees.)837 b(W)-92 b(e)483 b(already)0 2220 y(men)-31 b(tioned)416 b(left)g(and)f(righ)-31 b(t,)427 b(but)415 b(there)g(is)f(also)i(\\up")f(\(to)-31 b(w)g(ard)417 b(the)e(paren)-31 b(t/ro)31 b(ot\))417 b(and)0 3575 y(\\do)-31 b(wn")408 b(\(to)-31 b(w)g(ard)407 b(the)f(c)-31 b(hildren/lea)g(v)g (es\).)605 b(Also,)416 b(all)407 b(of)f(the)g(no)31 b(des)405 b(that)i(are)f(the)g(same)0 4930 y(distance)370 b(from)g(the)f(ro)31 b(ot)370 b(comprise)f(a)h Fv(lev)-35 b(el)369 b Fn(of)g(the)h(tree.)0 6893 y(W)-92 b(e)316 b(probably)i(don't)h(need)d(three)h(metaphors)h (for)f(talking)j(ab)31 b(out)318 b(trees,)327 b(but)318 b(there)e(they)0 8248 y(are.)0 10212 y(Lik)-31 b(e)477 b(link)-31 b(ed)479 b(lists,)504 b(trees)477 b(are)f(recursiv)-31 b(e)477 b(data)h(structures)e(b)31 b(ecause)476 b(they)i(are)e (de\257ned)0 11567 y(recursiv)-31 b(ely)-92 b(.)2767 13636 y(A)370 b(tree)f(is)g(either:)4096 15284 y Fj(\262)554 b Fn(the)369 b(empt)-31 b(y)371 b(tree,)e(represen)-31 b(ted)368 b(b)-31 b(y)370 b Fk(None)p Fn(,)g(or)4096 16894 y Fj(\262)554 b Fn(a)255 b(no)31 b(de)255 b(that)i(con)-31 b(tains)256 b(an)g(ob)61 b(ject)256 b(reference)e(and)i(t)-31 b(w)g(o)256 b(tree)f(references.)0 21229 y Fl(20.1)1792 b(Building)599 b(trees)0 23526 y Fn(The)338 b(pro)31 b(cess)336 b(of)i(assem)-31 b(bling)339 b(a)f(tree)g(is)f(similar)i(to) f(the)g(pro)31 b(cess)337 b(of)h(assem)-31 b(bling)339 b(a)f(link)-31 b(ed)0 24881 y(list.)494 b(Eac)-31 b(h)370 b(constructor)f(in)-31 b(v)g(o)31 b(cation)373 b(builds)c(a)h(single)g (no)31 b(de.)0 26925 y Fk(class)582 b(Tree:)1162 28280 y(def)g(__init__\(self,)h(cargo,)f(left=None,)h(right=None\):)2325 29635 y(self.cargo)f(=)g(cargo)2325 30990 y(self.left)1163 b(=)582 b(left)2325 32345 y(self.right)g(=)g(right)1162 35055 y(def)g(__str__\(self\):)2325 36410 y(return)g(str\(self.cargo\)) 0 38454 y Fn(The)338 b Fk(cargo)f Fn(can)h(b)31 b(e)337 b(an)-31 b(y)338 b(t)-31 b(yp)31 b(e,)345 b(but)337 b(the)h Fk(left)f Fn(and)h Fk(right)g Fn(parameters)g(should)f(b)31 b(e)337 b(tree)0 39809 y(no)31 b(des.)492 b Fk(left)370 b Fn(and)f Fk(right)h Fn(are)f(optional;)j(the)e(default)g(v)-61 b(alue)370 b(is)f Fk(None)p Fn(.)0 41773 y(T)-92 b(o)370 b(prin)-31 b(t)369 b(a)h(no)31 b(de,)370 b(w)-31 b(e)369 b(just)h(prin)-31 b(t)369 b(the)h(cargo.)0 43736 y(One)f(w)-31 b(a)g(y)371 b(to)f(build)f(a)h(tree)f(is)g(from)h(the)f(b)31 b(ottom)371 b(up.)493 b(Allo)31 b(cate)371 b(the)f(c)-31 b(hild)370 b(no)31 b(des)368 b(\257rst:)0 45781 y Fk(left)582 b(=)f(Tree\(2\))0 47136 y(right)h(=)f(Tree\(3\))0 49180 y Fn(Then)369 b(create)h(the)f(paren)-31 b(t)370 b(no)31 b(de)369 b(and)h(link)g(it)g(to)g(the)f(c)-31 b(hildren:)0 51225 y Fk(tree)582 b(=)f(Tree\(1,)h(left,)g(right\);)0 53269 y Fn(W)-92 b(e)368 b(can)i(write)g(this)f(co)31 b(de)370 b(more)f(concisely)h(b)-31 b(y)370 b(nesting)g(constructor)f (in)-31 b(v)g(o)31 b(cations:)0 55314 y Fk(>>>)582 b(tree)f(=)h (Tree\(1,)g(Tree\(2\),)g(Tree\(3\)\))0 57358 y Fn(Either)370 b(w)-31 b(a)g(y)-92 b(,)371 b(the)e(result)g(is)g(the)h(tree)f(at)h (the)f(b)31 b(eginning)371 b(of)f(the)f(c)-31 b(hapter.)p eop %%Page: 207 233 207 232 bop 0 -2070 a Fv(20.2)425 b(T)-106 b(ra)-35 b(v)g(ersing)425 b(trees)24651 b(207)p 0 -1627 38191 45 v 0 865 a Fl(20.2)1792 b(T)-149 b(ra)-50 b(v)g(ersing)600 b(trees)0 3396 y Fn(An)-31 b(y)474 b(time)g(y)-31 b(ou)474 b(see)e(a)h(new)h(data)g(structure,)499 b(y)-31 b(our)473 b(\257rst)g(question)h(should)f(b)31 b(e,)499 b(\\Ho)-31 b(w)0 4751 y(do)429 b(I)e(tra)-31 b(v)g(erse)429 b(it?")670 b(The)429 b(most)g(natural)h(w)-31 b(a)g(y)429 b(to)g(tra)-31 b(v)g(erse)429 b(a)f(tree)h(is)f(recursiv) -31 b(ely)-92 b(.)670 b(F)-92 b(or)0 6106 y(example,)371 b(if)f(the)f(tree)g(con)-31 b(tains)371 b(in)-31 b(tegers)370 b(as)f(cargo,)h(this)g(function)h(returns)d(their)h(sum:)0 8376 y Fk(def)582 b(total\(tree\):)1162 9731 y(if)g(tree)f(==)h(None:)g (return)g(0)1162 11086 y(return)g(total\(tree.left\))i(+)d (total\(tree.right\))j(+)d(tree.cargo)0 13355 y Fn(The)362 b(base)g(case)f(is)h(the)g(empt)-31 b(y)363 b(tree,)h(whic)-31 b(h)362 b(con)-31 b(tains)364 b(no)e(cargo,)i(so)e(the)g(sum)g(is)f(0.) 491 b(The)0 14710 y(recursiv)-31 b(e)302 b(step)g(mak)-31 b(es)304 b(t)-31 b(w)g(o)304 b(recursiv)-31 b(e)302 b(calls)h(to)h (\257nd)e(the)h(sum)f(of)h(the)g(c)-31 b(hild)304 b(trees.)469 b(When)0 16065 y(the)289 b(recursiv)-31 b(e)289 b(calls)g(complete,)308 b(w)-31 b(e)289 b(add)g(the)h(cargo)f(of)h(the)f(paren)-31 b(t)289 b(and)h(return)e(the)h(total.)0 20645 y Fl(20.3)1792 b(Expression)600 b(trees)0 23177 y Fn(A)314 b(tree)g(is)h(a)f(natural)i (w)-31 b(a)g(y)316 b(to)f(represen)-31 b(t)313 b(the)i(structure)e(of)i (an)g(expression.)474 b(Unlik)-31 b(e)316 b(other)0 24532 y(notations,)437 b(it)423 b(can)f(represen)-31 b(t)420 b(the)i(computation)j(unam)-31 b(biguously)-92 b(.)652 b(F)-92 b(or)421 b(example,)437 b(the)0 25887 y(in\257x)301 b(expression)f Fk(1)581 b(+)g(2)h(*)f(3)300 b Fn(is)h(am)-31 b(biguous)302 b(unless)e(w)-31 b(e)300 b(kno)-31 b(w)302 b(that)g(the)e(m)-31 b(ultiplication)0 27242 y(happ)31 b(ens)369 b(b)31 b(efore)369 b(the)g(addition.)0 29430 y(This)h(expression)f(tree)f(represen)-31 b(ts)369 b(the)g(same)h (computation:)8615 30809 y 12409069 9472573 0 0 17958420 13616824 startTexFig 8615 30809 a %%BeginDocument: illustrations/tree2.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: tree2.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Fri Dec 7 17:49:49 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 273 207 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 207 moveto 0 0 lineto 273 0 lineto 273 207 lineto closepath clip newpath -93.0 231.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 2550 975 m 4125 975 l 4125 1725 l 2550 1725 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 3525 2025 m 5100 2025 l 5100 2775 l 3525 2775 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 2550 3075 m 4125 3075 l 4125 3825 l 2550 3825 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 4500 3075 m 6075 3075 l 6075 3825 l 4500 3825 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 1575 2025 m 3150 2025 l 3150 2775 l 1575 2775 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 3540 3277 m 3540 3217 l 3388 3217 l 3508 3247 l 3388 3277 l cp eoclip n 3150 3247 m 3525 3247 l gs col0 s gr gr % arrowhead n 3388 3277 m 3508 3247 l 3388 3217 l col0 s /Helvetica ff 165.00 scf sf 3075 3300 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3600 3300 m gs 1 -1 sc (2) col0 sh gr % Polyline gs clippath 2715 2227 m 2715 2167 l 2563 2167 l 2683 2197 l 2563 2227 l cp eoclip n 2325 2197 m 2700 2197 l gs col0 s gr gr % arrowhead n 2563 2227 m 2683 2197 l 2563 2167 l col0 s /Helvetica ff 165.00 scf sf 2250 2250 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2775 2250 m gs 1 -1 sc (1) col0 sh gr % Polyline gs clippath 3690 1177 m 3690 1117 l 3538 1117 l 3658 1147 l 3538 1177 l cp eoclip n 3300 1147 m 3675 1147 l gs col0 s gr gr % arrowhead n 3538 1177 m 3658 1147 l 3538 1117 l col0 s /Helvetica ff 165.00 scf sf 3225 1200 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 210.00 scf sf 3750 1200 m gs 1 -1 sc (+) col0 sh gr % Polyline gs clippath 4665 2227 m 4665 2167 l 4513 2167 l 4633 2197 l 4513 2227 l cp eoclip n 4275 2197 m 4650 2197 l gs col0 s gr gr % arrowhead n 4513 2227 m 4633 2197 l 4513 2167 l col0 s /Helvetica ff 165.00 scf sf 4200 2250 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 360.00 scf sf 4725 2400 m gs 1 -1 sc (*) col0 sh gr % Polyline gs clippath 5640 3277 m 5640 3217 l 5488 3217 l 5608 3247 l 5488 3277 l cp eoclip n 5250 3247 m 5625 3247 l gs col0 s gr gr % arrowhead n 5488 3277 m 5608 3247 l 5488 3217 l col0 s /Helvetica ff 165.00 scf sf 5175 3300 m gs 1 -1 sc (cargo) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 5700 3300 m gs 1 -1 sc (3) col0 sh gr % Polyline gs clippath 2591 2020 m 2641 2054 l 2725 1927 l 2634 2011 l 2675 1894 l cp eoclip n 2925 1575 m 2625 2025 l gs col0 s gr gr % arrowhead n 2675 1894 m 2634 2011 l 2725 1927 l col0 s % Polyline gs clippath 4033 2054 m 4083 2020 l 3999 1894 l 4041 2011 l 3949 1927 l cp eoclip n 3750 1575 m 4050 2025 l gs col0 s gr gr % arrowhead n 3949 1927 m 4041 2011 l 3999 1894 l col0 s % Polyline gs clippath 3641 3075 m 3695 3101 l 3762 2966 l 3682 3060 l 3708 2939 l cp eoclip n 3900 2625 m 3675 3075 l gs col0 s gr gr % arrowhead n 3708 2939 m 3682 3060 l 3762 2966 l col0 s % Polyline gs clippath 4929 3101 m 4983 3075 l 4916 2939 l 4943 3060 l 4862 2966 l cp eoclip n 4725 2625 m 4950 3075 l gs col0 s gr gr % arrowhead n 4862 2966 m 4943 3060 l 4916 2939 l col0 s % Polyline gs clippath 3270 990 m 3330 990 l 3330 838 l 3300 958 l 3270 838 l cp eoclip n 3300 600 m 3300 975 l gs col0 s gr gr % arrowhead n 3270 838 m 3300 958 l 3330 838 l col0 s /Helvetica ff 165.00 scf sf 3150 525 m gs 1 -1 sc (tree) col0 sh gr /Helvetica ff 165.00 scf sf 3075 1500 m gs 1 -1 sc (left) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3525 1500 m gs 1 -1 sc (right) col0 sh gr /Helvetica ff 165.00 scf sf 4050 2550 m gs 1 -1 sc (left) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 4500 2550 m gs 1 -1 sc (right) col0 sh gr /Helvetica ff 165.00 scf sf 3075 3600 m gs 1 -1 sc (left) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 3525 3600 m gs 1 -1 sc (right) col0 sh gr /Helvetica ff 165.00 scf sf 5025 3600 m gs 1 -1 sc (left) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 5475 3600 m gs 1 -1 sc (right) col0 sh gr /Helvetica ff 165.00 scf sf 2100 2550 m gs 1 -1 sc (left) dup sw pop neg 0 rm col0 sh gr /Helvetica ff 165.00 scf sf 2550 2550 m gs 1 -1 sc (right) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 48836 a Fn(The)383 b(no)31 b(des)382 b(of)h(an)g(expression)g(tree)f (can)h(b)31 b(e)383 b(op)31 b(erands)382 b(lik)-31 b(e)384 b Fk(1)f Fn(and)g Fk(2)f Fn(or)h(op)31 b(erators)383 b(lik)-31 b(e)0 50190 y Fk(+)449 b Fn(and)g Fk(*)p Fn(.)733 b(Op)31 b(erands)448 b(are)h(leaf)h(no)31 b(des;)489 b(op)31 b(erator)450 b(no)31 b(des)449 b(con)-31 b(tain)451 b(references)d(to)i(their)0 51545 y(op)31 b(erands.)649 b(\(All)423 b(of)e(these)h(op)31 b(erators)421 b(are)g Fv(binary)p Fn(,)435 b(meaning)423 b(they)f(ha)-31 b(v)g(e)422 b(exactly)h(t)-31 b(w)g(o)0 52900 y(op)31 b(erands.\))0 55089 y(W)-92 b(e)368 b(can)i(build)g(this)f(tree)g(lik)-31 b(e)371 b(this:)0 57358 y Fk(>>>)582 b(tree)f(=)h(Tree\('+',)g (Tree\(1\),)g(Tree\('*',)h(Tree\(2\),)f(Tree\(3\)\)\))p eop %%Page: 208 234 208 233 bop 0 -2070 a Fv(208)33309 b(T)-106 b(rees)p 0 -1627 38191 45 v 0 865 a Fn(Lo)31 b(oking)531 b(at)g(the)f(\257gure,) 570 b(there)530 b(is)f(no)h(question)h(what)g(the)f(order)f(of)i(op)31 b(erations)530 b(is;)0 2220 y(the)367 b(m)-31 b(ultiplication)371 b(happ)31 b(ens)366 b(\257rst)h(in)f(order)g(to)i(compute)g(the)e (second)h(op)31 b(erand)367 b(of)g(the)0 3575 y(addition.)0 5767 y(Expression)482 b(trees)f(ha)-31 b(v)g(e)483 b(man)-31 b(y)483 b(uses.)830 b(The)482 b(example)h(in)f(this)h(c)-31 b(hapter)482 b(uses)f(trees)g(to)0 7122 y(translate)400 b(expressions)d(to)j(p)31 b(ost\257x,)406 b(pre\257x,)g(and)398 b(in\257x.)581 b(Similar)400 b(trees)e(are)g(used)g(inside)0 8477 y(compilers)370 b(to)g(parse,)f(optimize,)j(and)d(translate)i (programs.)0 13067 y Fl(20.4)1792 b(T)-149 b(ree)599 b(tra)-50 b(v)g(ersal)0 15603 y Fn(W)-92 b(e)368 b(can)i(tra)-31 b(v)g(erse)369 b(an)h(expression)f(tree)g(and)g(prin)-31 b(t)370 b(the)f(con)-31 b(ten)g(ts)371 b(lik)-31 b(e)370 b(this:)0 17876 y Fk(def)582 b(printTree\(tree\):)1162 19231 y(if)g(tree)f(==)h(None:)g(return)1162 20586 y(print)g (tree.cargo,)1162 21941 y(printTree\(tree.left\))1162 23295 y(printTree\(tree.right\))0 25568 y Fn(In)423 b(other)g(w)-31 b(ords,)437 b(to)424 b(prin)-31 b(t)424 b(a)f(tree,)437 b(\257rst)422 b(prin)-31 b(t)424 b(the)f(con)-31 b(ten)g(ts)425 b(of)e(the)g(ro)31 b(ot,)438 b(then)423 b(prin)-31 b(t)0 26923 y(the)498 b(en)-31 b(tire)498 b(left)h(subtree,)530 b(and)498 b(then)g(prin)-31 b(t)499 b(the)f(en)-31 b(tire)498 b(righ)-31 b(t)499 b(subtree.)878 b(This)498 b(w)-31 b(a)g(y)499 b(of)0 28278 y(tra)-31 b(v)g(ersing)375 b(a)f(tree)f(is)h (called)g(a)g Fv(preorder)p Fn(,)k(b)31 b(ecause)373 b(the)h(con)-31 b(ten)g(ts)375 b(of)f(the)g(ro)31 b(ot)374 b(app)31 b(ear)0 29633 y Fm(b)-57 b(efor)g(e)370 b Fn(the)g(con)-31 b(ten)g(ts)370 b(of)g(the)f(c)-31 b(hildren.)494 b(F)-92 b(or)368 b(the)h(previous)h(example,)h(the)e(output)i(is:)0 31906 y Fk(>>>)582 b(tree)f(=)h(Tree\('+',)g(Tree\(1\),)g(Tree\('*',)h (Tree\(2\),)f(Tree\(3\)\)\))0 33261 y(>>>)g(printTree\(tree\))0 34616 y(+)f(1)h(*)f(2)g(3)0 36888 y Fn(This)313 b(format)i(is)d (di\256eren)-31 b(t)313 b(from)h(b)31 b(oth)313 b(p)31 b(ost\257x)313 b(and)h(in\257x;)332 b(it)314 b(is)f(another)g(notation) j(called)0 38243 y Fv(pre\257x)p Fn(,)371 b(in)e(whic)-31 b(h)370 b(the)g(op)31 b(erators)369 b(app)31 b(ear)369 b(b)31 b(efore)369 b(their)h(op)31 b(erands.)0 40435 y(Y)-92 b(ou)342 b(migh)-31 b(t)344 b(susp)31 b(ect)341 b(that)i(if)f(y)-31 b(ou)342 b(tra)-31 b(v)g(erse)342 b(the)g(tree)g(in)g(a)g(di\256eren)-31 b(t)342 b(order,)347 b(y)-31 b(ou)343 b(will)g(get)0 41790 y(the)452 b(expression)f(in)h(a)g (di\256eren)-31 b(t)452 b(notation.)742 b(F)-92 b(or)451 b(example,)474 b(if)453 b(y)-31 b(ou)452 b(prin)-31 b(t)452 b(the)g(subtrees)0 43145 y(\257rst)369 b(and)g(then)g(the)h(ro)31 b(ot)370 b(no)31 b(de,)369 b(y)-31 b(ou)370 b(get:)0 45418 y Fk(def)582 b(printTreePostorder\(tree\):)1162 46773 y(if)g(tree)f(==)h(None:)g(return)1162 48127 y (printTreePostorder\(tree.left\))1162 49482 y (printTreePostorder\(tree.right\))1162 50837 y(print)g(tree.cargo,)0 53110 y Fn(The)280 b(result,)298 b Fk(1)581 b(2)g(3)h(*)f(+)p Fn(,)298 b(is)279 b(in)h(p)31 b(ost\257x!)463 b(This)280 b(order)f(of)i(tra)-31 b(v)g(ersal)280 b(is)g(called)h Fv(p)35 b(ostorder)p Fn(.)0 55302 y(Finally)-92 b(,)434 b(to)420 b(tra)-31 b(v)g(erse)419 b(a)h(tree)f Fv(inorder)p Fn(,)433 b(y)-31 b(ou)420 b(prin)-31 b(t)420 b(the)g(left)g(tree,)432 b(then)419 b(the)h(ro)31 b(ot,)433 b(and)0 56657 y(then)369 b(the)h(righ)-31 b(t)370 b(tree:)p eop %%Page: 209 235 209 234 bop 0 -2070 a Fv(20.4)425 b(T)-106 b(ree)425 b(tra)-35 b(v)g(ersal)25877 b(209)p 0 -1627 38191 45 v 0 865 a Fk(def)582 b(printTreeInorder\(tree\):)1162 2220 y(if)g(tree)f(==)h(None:)g(return)1162 3575 y (printTreeInorder\(tree.left\))1162 4930 y(print)g(tree.cargo,)1162 6285 y(printTreeInorder\(tree.right\))0 8694 y Fn(The)369 b(result)h(is)f Fk(1)581 b(+)g(2)h(*)f(3)p Fn(,)369 b(whic)-31 b(h)371 b(is)e(the)g(expression)g(in)h(in\257x.)0 11022 y(T)-92 b(o)277 b(b)31 b(e)277 b(fair,)296 b(w)-31 b(e)278 b(should)f(p)31 b(oin)-31 b(t)278 b(out)g(that)g(w)-31 b(e)277 b(ha)-31 b(v)g(e)278 b(omitted)h(an)f(imp)31 b(ortan)-31 b(t)279 b(complication.)0 12377 y(Sometimes)367 b(when)f(w)-31 b(e)366 b(write)h(an)e(expression)h(in)g(in\257x,)h(w) -31 b(e)366 b(ha)-31 b(v)g(e)367 b(to)f(use)f(paren)-31 b(theses)365 b(to)0 13732 y(preserv)-31 b(e)397 b(the)h(order)f(of)i (op)31 b(erations.)580 b(So)398 b(an)g(inorder)g(tra)-31 b(v)g(ersal)399 b(is)f(not)h(quite)g(su\261cien)-31 b(t)0 15086 y(to)370 b(generate)g(an)f(in\257x)h(expression.)0 17414 y(Nev)-31 b(ertheless,)331 b(with)322 b(a)f(few)g(impro)-31 b(v)g(emen)g(ts,)334 b(the)321 b(expression)f(tree)h(and)g(the)g(three) f(recur-)0 18769 y(siv)-31 b(e)417 b(tra)-31 b(v)g(ersals)417 b(pro)-31 b(vide)416 b(a)h(general)g(w)-31 b(a)g(y)417 b(to)g(translate)h(expressions)d(from)i(one)f(format)0 20124 y(to)370 b(another.)2767 23084 y Fm(As)397 b(an)h(exer)-57 b(cise,)398 b(mo)-57 b(dify)399 b Fk(printTreeInorder)h Fm(so)d(that)f(it)i(puts)e(p)-57 b(ar)g(enthe-)2767 24439 y(ses)325 b(ar)-57 b(ound)326 b(every)g(op)-57 b(er)g(ator)325 b(and)h(p)-57 b(air)326 b(of)g(op)-57 b(er)g(ands.)486 b(Is)325 b(the)g(output)g(c)-57 b(orr)g(e)g(ct)2767 25794 y(and)396 b(unambiguous?)510 b(A)-28 b(r)-57 b(e)396 b(the)g(p)-57 b(ar)g(entheses)396 b(always)f(ne)-57 b(c)g(essary?)0 28753 y Fn(If)346 b(w)-31 b(e)346 b(do)g(an)g(inorder)g(tra)-31 b(v)g(ersal)347 b(and)f(k)-31 b(eep)346 b(trac)-31 b(k)347 b(of)f(what)h(lev)-31 b(el)347 b(in)f(the)g(tree)g(w)-31 b(e)346 b(are)g(on,)0 30108 y(w)-31 b(e)370 b(can)f(generate)h(a)g (graphical)g(represen)-31 b(tation)371 b(of)e(a)h(tree:)0 32517 y Fk(def)582 b(printTreeIndented\(tree,)i(level=0\):)1162 33872 y(if)e(tree)f(==)h(None:)g(return)1162 35227 y (printTreeIndented\(tree.right,)k(level+1\))1162 36582 y(print)c(')1163 b('*level)582 b(+)f(str\(tree.cargo\))1162 37937 y(printTreeIndented\(tree.left,)586 b(level+1\))0 40346 y Fn(The)378 b(parameter)h Fk(level)g Fn(k)-31 b(eeps)378 b(trac)-31 b(k)379 b(of)f(where)g(w)-31 b(e)379 b(are)f(in)g(the)g(tree.)520 b(By)378 b(default,)k(it)d(is)0 41701 y(initially)436 b(0.)681 b(Eac)-31 b(h)433 b(time)g(w)-31 b(e)433 b(mak)-31 b(e)433 b(a)g(recursiv)-31 b(e)431 b(call,)450 b(w)-31 b(e)432 b(pass)g Fk(level+1)h Fn(b)31 b(ecause)432 b(the)0 43056 y(c)-31 b(hild's)410 b(lev)-31 b(el)409 b(is)g(alw)-31 b(a)g(ys)410 b(one)f(greater)g(than)g(the)g (paren)-31 b(t's.)612 b(Eac)-31 b(h)409 b(item)h(is)e(inden)-31 b(ted)410 b(b)-31 b(y)0 44411 y(t)g(w)g(o)371 b(spaces)e(p)31 b(er)368 b(lev)-31 b(el.)494 b(The)369 b(result)g(for)h(the)f(example)i (tree)e(is:)0 46820 y Fk(>>>)582 b(printTreeIndented\(tree\))2325 48175 y(3)1162 49529 y(*)2325 50884 y(2)0 52239 y(+)1162 53594 y(1)0 56003 y Fn(If)405 b(y)-31 b(ou)406 b(lo)31 b(ok)407 b(at)f(the)g(output)h(sidew)-31 b(a)g(ys,)416 b(y)-31 b(ou)406 b(see)f(a)g(simpli\257ed)i(v)-31 b(ersion)406 b(of)g(the)g(original)0 57358 y(\257gure.)p eop %%Page: 210 236 210 235 bop 0 -2070 a Fv(210)33309 b(T)-106 b(rees)p 0 -1627 38191 45 v 0 865 a Fl(20.5)1792 b(Building)599 b(an)e(expression)k(tree)0 3621 y Fn(In)265 b(this)i(section,)287 b(w)-31 b(e)267 b(parse)e(in\257x)h(expressions)g(and)g(build)g(the)g (corresp)31 b(onding)266 b(expression)0 4976 y(trees.)492 b(F)-92 b(or)368 b(example,)k(the)d(expression)g Fk(\(3+7\)*9)h Fn(yields)g(the)f(follo)-31 b(wing)373 b(tree:)13706 6355 y 6380830 6972866 0 0 6380830 6972866 startTexFig 13706 6355 a %%BeginDocument: illustrations/tree3.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: tree3.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Tue Dec 11 18:04:00 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 97 106 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 106 moveto 0 0 lineto 97 0 lineto 97 106 lineto closepath clip newpath -138.0 163.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 2325 2325 m 2775 2325 l 2775 2700 l 2325 2700 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 3075 2325 m 3525 2325 l 3525 2700 l 3075 2700 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 3450 1650 m 3900 1650 l 3900 2025 l 3450 2025 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 2700 1650 m 3150 1650 l 3150 2025 l 2700 2025 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 3075 975 m 3525 975 l 3525 1350 l 3075 1350 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 2893 1639 m 2935 1681 l 3043 1574 l 2937 1638 l 3000 1531 l cp eoclip n 3225 1350 m 2925 1650 l gs col0 s gr gr % arrowhead n 3000 1531 m 2937 1638 l 3043 1574 l col0 s % Polyline gs clippath 3664 1681 m 3706 1639 l 3599 1531 l 3663 1638 l 3556 1574 l cp eoclip n 3375 1350 m 3675 1650 l gs col0 s gr gr % arrowhead n 3556 1574 m 3663 1638 l 3599 1531 l col0 s % Polyline gs clippath 2518 2314 m 2560 2356 l 2668 2249 l 2562 2313 l 2625 2206 l cp eoclip n 2850 2025 m 2550 2325 l gs col0 s gr gr % arrowhead n 2625 2206 m 2562 2313 l 2668 2249 l col0 s % Polyline gs clippath 3289 2356 m 3331 2314 l 3224 2206 l 3288 2313 l 3181 2249 l cp eoclip n 3000 2025 m 3300 2325 l gs col0 s gr gr % arrowhead n 3181 2249 m 3288 2313 l 3224 2206 l col0 s /Helvetica ff 210.00 scf sf 3630 1913 m gs 1 -1 sc (9) col0 sh gr /Helvetica ff 210.00 scf sf 3248 2595 m gs 1 -1 sc (7) col0 sh gr /Helvetica ff 210.00 scf sf 2490 2588 m gs 1 -1 sc (3) col0 sh gr /Helvetica ff 210.00 scf sf 2858 1905 m gs 1 -1 sc (+) col0 sh gr /Helvetica ff 360.00 scf sf 3225 1380 m gs 1 -1 sc (*) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 20320 a Fn(Notice)492 b(that)h(w)-31 b(e)491 b(ha)-31 b(v)g(e)492 b(simpli\257ed)g(the)g(diagram)g(b)-31 b(y)492 b(lea)-31 b(ving)493 b(out)f(the)f(names)g(of)h(the)0 21675 y(attributes.)0 24024 y(The)306 b(parser)f(w)-31 b(e)306 b(will)i(write)e(handles)g(expressions)g(that)h(include)f(n)-31 b(um)g(b)31 b(ers,)319 b(paren)-31 b(theses,)0 25379 y(and)400 b(the)g(op)31 b(erators)399 b Fk(+)h Fn(and)g Fk(*)p Fn(.)583 b(W)-92 b(e)399 b(assume)h(that)g(the)g(input)g(string) g(has)g(already)g(b)31 b(een)0 26734 y(tok)-31 b(enized)371 b(in)-31 b(to)371 b(a)e(Python)h(list.)494 b(The)369 b(tok)-31 b(en)371 b(list)f(for)f Fk(\(3+7\)*9)h Fn(is:)0 29164 y Fk(['\(',)582 b(3,)f('+',)h(7,)g('\)',)f('*',)h(9,)f('end'])0 31594 y Fn(The)389 b Fk(end)g Fn(tok)-31 b(en)390 b(is)f(useful)f(for)h (prev)-31 b(en)g(ting)390 b(the)f(parser)f(from)h(reading)h(past)f(the) g(end)f(of)0 32949 y(the)369 b(list.)2767 35949 y Fm(As)385 b(an)h(exer)-57 b(cise,)389 b(write)c(a)g(function)i(that)d(takes)h(an) h(expr)-57 b(ession)385 b(string)h(and)2767 37304 y(r)-57 b(eturns)396 b(a)g(token)h(list.)0 40304 y Fn(The)548 b(\257rst)f(function)h(w)-31 b(e'll)550 b(write)e(is)f Fk(getToken)p Fn(,)594 b(whic)-31 b(h)548 b(tak)-31 b(es)548 b(a)g(tok)-31 b(en)549 b(list)f(and)g(an)0 41659 y(exp)31 b(ected)544 b(tok)-31 b(en)545 b(as)f(parameters.)1016 b(It)544 b(compares)g(the)g(exp)31 b(ected)544 b(tok)-31 b(en)545 b(to)f(the)g(\257rst)0 43014 y(tok)-31 b(en)374 b(on)f(the)f(list:)501 b(if)373 b(they)g(matc)-31 b(h,)375 b(it)f(remo)-31 b(v)g(es)373 b(the)g(tok)-31 b(en)374 b(from)f(the)g(list)g(and)g(returns)0 44369 y(true;)c(otherwise,)i(it)f (returns)e(false:)0 46799 y Fk(def)582 b(getToken\(tokenList,)i (expected\):)1162 48154 y(if)e(tokenList[0])h(==)e(expected:)2325 49508 y(del)g(tokenList[0])2325 50863 y(return)h(1)1162 52218 y(else:)2325 53573 y(return)g(0)0 56003 y Fn(Since)389 b Fk(tokenList)h Fn(refers)e(to)i(a)f(m)-31 b(utable)391 b(ob)61 b(ject,)396 b(the)389 b(c)-31 b(hanges)390 b(made)g(here)e(are) h(visible)0 57358 y(to)370 b(an)-31 b(y)370 b(other)f(v)-61 b(ariable)371 b(that)f(refers)e(to)i(the)f(same)h(ob)61 b(ject.)p eop %%Page: 211 237 211 236 bop 0 -2070 a Fv(20.5)425 b(Building)f(an)h(expression)h(tree) 18313 b(211)p 0 -1627 38191 45 v 0 865 a Fn(The)712 b(next)h(function,) 800 b Fk(getNumber)p Fn(,)f(handles)713 b(op)31 b(erands.)1521 b(If)711 b(the)i(next)f(tok)-31 b(en)714 b(in)0 2220 y Fk(tokenList)503 b Fn(is)f(a)g(n)-31 b(um)g(b)31 b(er,)535 b Fk(getNumber)503 b Fn(remo)-31 b(v)g(es)502 b(it)h(and)f(returns)e(a) i(leaf)h(no)31 b(de)502 b(con-)0 3575 y(taining)371 b(the)f(n)-31 b(um)g(b)31 b(er;)369 b(otherwise,)i(it)f(returns)e Fk(None)p Fn(.)0 5893 y Fk(def)582 b(getNumber\(tokenList\):)1162 7248 y(x)g(=)f(tokenList[0])1162 8603 y(if)h(type\(x\))g(!=)f (type\(0\):)i(return)f(None)1162 9958 y(del)g(tokenList[0])1162 11312 y(return)g(Tree)g(\(x,)g(None,)g(None\))0 13630 y Fn(Before)447 b(con)-31 b(tin)g(uing,)470 b(w)-31 b(e)447 b(should)h(test)f Fk(getNumber)i Fn(in)e(isolation.)729 b(W)-92 b(e)446 b(assign)i(a)f(list)h(of)0 14985 y(n)-31 b(um)g(b)31 b(ers)257 b(to)g Fk(tokenList)p Fn(,)281 b(extract)258 b(the)g(\257rst,)279 b(prin)-31 b(t)258 b(the)f(result,)280 b(and)257 b(prin)-31 b(t)257 b(what)i(remains)0 16340 y(of)370 b(the)f(tok)-31 b(en)371 b(list:)0 18658 y Fk(>>>)582 b(tokenList)g(=)f([9,)h(11,)g('end'])0 20013 y(>>>)g(x)f(=)g(getNumber\(tokenList\))0 21368 y(>>>)h (printTreePostorder\(x\))0 22723 y(9)0 24078 y(>>>)g(print)f(tokenList) 0 25432 y([11,)h('end'])0 27750 y Fn(The)429 b(next)h(metho)31 b(d)430 b(w)-31 b(e)430 b(need)f(is)g Fk(getProduct)p Fn(,)446 b(whic)-31 b(h)430 b(builds)f(an)h(expression)f(tree)g(for)0 29105 y(pro)31 b(ducts.)492 b(A)370 b(simple)g(pro)31 b(duct)369 b(has)g(t)-31 b(w)g(o)371 b(n)-31 b(um)g(b)31 b(ers)369 b(as)g(op)31 b(erands,)369 b(lik)-31 b(e)370 b Fk(3)582 b(*)f(7)p Fn(.)0 31342 y(Here)369 b(is)g(a)g(v)-31 b(ersion)370 b(of)g Fk(getProduct)g Fn(that)h(handles)e(simple)h(pro)31 b(ducts.)0 33660 y Fk(def)582 b(getProduct\(tokenList\):)1162 35015 y(a)g(=)f(getNumber\(tokenList\))1162 36369 y(if)h (getToken\(tokenList,)i('*'\):)2325 37724 y(b)d(=)g (getNumber\(tokenList\))2325 39079 y(return)h(Tree)f(\('*',)h(a,)g(b\)) 1162 40434 y(else:)2325 41789 y(return)g(a)0 44107 y Fn(Assuming)381 b(that)g Fk(getNumber)g Fn(succeeds)e(and)i(returns)e (a)h(singleton)i(tree,)h(w)-31 b(e)381 b(assign)g(the)0 45462 y(\257rst)451 b(op)31 b(erand)451 b(to)h Fk(a)p Fn(.)739 b(If)452 b(the)f(next)h(c)-31 b(haracter)452 b(is)f Fk(*)p Fn(,)473 b(w)-31 b(e)451 b(get)i(the)e(second)g(n)-31 b(um)g(b)31 b(er)452 b(and)0 46817 y(build)370 b(an)f(expression)g (tree)g(with)i Fk(a)p Fn(,)e Fk(b)p Fn(,)h(and)f(the)h(op)31 b(erator.)0 49054 y(If)365 b(the)g(next)h(c)-31 b(haracter)366 b(is)f(an)-31 b(ything)368 b(else,)e(then)f(w)-31 b(e)366 b(just)g(return)e(the)i(leaf)g(no)31 b(de)365 b(with)h Fk(a)p Fn(.)0 50408 y(Here)j(are)g(t)-31 b(w)g(o)371 b(examples:)0 52726 y Fk(>>>)582 b(tokenList)g(=)f([9,)h('*',)g(11,)f ('end'])0 54081 y(>>>)h(tree)f(=)h(getProduct\(tokenList\))0 55436 y(>>>)g(printTreePostorder\(tree\))0 56791 y(9)f(11)h(*)p eop %%Page: 212 238 212 237 bop 0 -2070 a Fv(212)33309 b(T)-106 b(rees)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(tokenList)g(=)f([9,)h('+',)g (11,)f('end'])0 2220 y(>>>)h(tree)f(=)h(getProduct\(tokenList\))0 3575 y(>>>)g(printTreePostorder\(tree\))0 4930 y(9)0 7037 y Fn(The)402 b(second)g(example)i(implies)f(that)h(w)-31 b(e)402 b(consider)g(a)h(single)g(op)31 b(erand)402 b(to)h(b)31 b(e)401 b(a)i(kind)f(of)0 8392 y(pro)31 b(duct.)484 b(This)345 b(de\257nition)h(of)f(\\pro)31 b(duct")345 b(is)f(coun)-31 b(terin)g(tuitiv)g(e,)354 b(but)344 b(it)h(turns)f(out)h(to)g(b)31 b(e)0 9747 y(useful.)0 11773 y(No)-31 b(w)376 b(w)-31 b(e)375 b(ha)-31 b(v)g(e)376 b(to)g(deal)f(with)h(comp)31 b(ound)376 b(pro)31 b(ducts,)376 b(lik)-31 b(e)376 b(lik)-31 b(e)376 b Fk(3)582 b(*)f(5)g(*)g(13)p Fn(.)510 b(W)-92 b(e)374 b(treat)0 13128 y(this)d(expression)g(as)f(a)h(pro)31 b(duct)371 b(of)g(pro)31 b(ducts,)371 b(namely)h Fk(3)582 b(*)f(\(5)g(*)h(13\))p Fn(.)497 b(The)371 b(resulting)0 14483 y(tree)e(is:)13706 15647 y 6380830 6972866 0 0 6380830 6972866 startTexFig 13706 15647 a %%BeginDocument: illustrations/tree4.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: tree4.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Tue Dec 11 18:03:53 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 97 106 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 106 moveto 0 0 lineto 97 0 lineto 97 106 lineto closepath clip newpath -161.0 163.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 3450 1650 m 3900 1650 l 3900 2025 l 3450 2025 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 2700 1650 m 3150 1650 l 3150 2025 l 2700 2025 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 3075 975 m 3525 975 l 3525 1350 l 3075 1350 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 3075 2325 m 3525 2325 l 3525 2700 l 3075 2700 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline n 3825 2325 m 4275 2325 l 4275 2700 l 3825 2700 l cp gs col7 0.90 shd ef gr gs col0 s gr % Polyline gs clippath 2893 1639 m 2935 1681 l 3043 1574 l 2937 1638 l 3000 1531 l cp eoclip n 3225 1350 m 2925 1650 l gs col0 s gr gr % arrowhead n 3000 1531 m 2937 1638 l 3043 1574 l col0 s % Polyline gs clippath 3664 1681 m 3706 1639 l 3599 1531 l 3663 1638 l 3556 1574 l cp eoclip n 3375 1350 m 3675 1650 l gs col0 s gr gr % arrowhead n 3556 1574 m 3663 1638 l 3599 1531 l col0 s % Polyline gs clippath 3268 2314 m 3310 2356 l 3418 2249 l 3312 2313 l 3375 2206 l cp eoclip n 3600 2025 m 3300 2325 l gs col0 s gr gr % arrowhead n 3375 2206 m 3312 2313 l 3418 2249 l col0 s % Polyline gs clippath 4039 2356 m 4081 2314 l 3974 2206 l 4038 2313 l 3931 2249 l cp eoclip n 3750 2025 m 4050 2325 l gs col0 s gr gr % arrowhead n 3931 2249 m 4038 2313 l 3974 2206 l col0 s /Helvetica ff 360.00 scf sf 3225 1380 m gs 1 -1 sc (*) col0 sh gr /Helvetica ff 210.00 scf sf 2865 1920 m gs 1 -1 sc (3) col0 sh gr /Helvetica ff 360.00 scf sf 3600 2047 m gs 1 -1 sc (*) col0 sh gr /Helvetica ff 210.00 scf sf 3240 2595 m gs 1 -1 sc (5) col0 sh gr /Helvetica ff 210.00 scf sf 3931 2595 m gs 1 -1 sc (13) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 29289 a Fn(With)326 b(a)h(small)g(c)-31 b(hange)327 b(in)f Fk(getProduct)p Fn(,)336 b(w)-31 b(e)327 b(can)f(handle)h(an)f (arbitrarily)h(long)g(pro)31 b(duct:)0 31396 y Fk(def)582 b(getProduct\(tokenList\):)1162 32751 y(a)g(=)f(getNumber\(tokenList\)) 1162 34106 y(if)h(getToken\(tokenList,)i('*'\):)2325 35461 y(b)d(=)g(getProduct\(tokenList\))4071 b(#)582 b(this)f(line)h(changed)2325 36816 y(return)g(Tree)f(\('*',)h(a,)g(b\)) 1162 38171 y(else:)2325 39526 y(return)g(a)0 41633 y Fn(In)290 b(other)h(w)-31 b(ords,)307 b(a)291 b(pro)31 b(duct)290 b(can)h(b)31 b(e)290 b(either)h(a)g(singleton)h(or)f(a)f (tree)h(with)h Fk(*)e Fn(at)h(the)g(ro)31 b(ot,)308 b(a)0 42988 y(n)-31 b(um)g(b)31 b(er)311 b(on)g(the)g(left,)324 b(and)311 b(a)g(pro)31 b(duct)311 b(on)g(the)h(righ)-31 b(t.)474 b(This)311 b(kind)h(of)f(recursiv)-31 b(e)310 b(de\257nition)0 44343 y(should)370 b(b)31 b(e)368 b(starting)j(to)f (feel)f(familiar.)0 46369 y(Let's)g(test)h(the)f(new)h(v)-31 b(ersion)369 b(with)i(a)e(comp)31 b(ound)370 b(pro)31 b(duct:)0 48476 y Fk(>>>)582 b(tokenList)g(=)f([2,)h('*',)g(3,)f('*',)h (5)f(,)h('*',)f(7,)h('end'])0 49831 y(>>>)g(tree)f(=)h (getProduct\(tokenList\))0 51186 y(>>>)g(printTreePostorder\(tree\))0 52541 y(2)f(3)h(5)f(7)g(*)g(*)h(*)0 54648 y Fn(Next)371 b(w)-31 b(e)372 b(will)g(add)f(the)g(abilit)-31 b(y)373 b(to)f(parse)e(sums.)497 b(Again,)373 b(w)-31 b(e)371 b(use)f(a)h(sligh)-31 b(tly)373 b(coun)-31 b(terin-)0 56003 y(tuitiv)g(e)423 b(de\257nition)f(of)g(\\sum.")648 b(F)-92 b(or)420 b(us,)433 b(a)421 b(sum)g(can)g(b)31 b(e)420 b(a)h(tree)g(with)h Fk(+)e Fn(at)i(the)f(ro)31 b(ot,)435 b(a)0 57358 y(pro)31 b(duct)369 b(on)h(the)f(left,)i(and)e(a) h(sum)f(on)g(the)h(righ)-31 b(t.)493 b(Or,)369 b(a)h(sum)f(can)g(b)31 b(e)369 b(just)g(a)h(pro)31 b(duct.)p eop %%Page: 213 239 213 238 bop 0 -2070 a Fv(20.5)425 b(Building)f(an)h(expression)h(tree) 18313 b(213)p 0 -1627 38191 45 v 0 865 a Fn(If)398 b(y)-31 b(ou)399 b(are)f(willing)j(to)d(pla)-31 b(y)400 b(along)g(with)f(this)g (de\257nition,)407 b(it)399 b(has)f(a)g(nice)h(prop)31 b(ert)-31 b(y:)550 b(w)-31 b(e)0 2220 y(can)366 b(represen)-31 b(t)364 b(an)-31 b(y)366 b(expression)f(\(without)j(paren)-31 b(theses\))366 b(as)f(a)h(sum)f(of)h(pro)31 b(ducts.)491 b(This)0 3575 y(prop)31 b(ert)-31 b(y)369 b(is)g(the)h(basis)f(of)h (our)f(parsing)g(algorithm.)0 5813 y Fk(getSum)375 b Fn(tries)f(to)h(build)g(a)g(tree)f(with)h(a)g(pro)31 b(duct)374 b(on)g(the)h(left)g(and)g(a)f(sum)g(on)h(the)f(righ)-31 b(t.)0 7168 y(But)370 b(if)f(it)h(do)31 b(esn't)370 b(\257nd)f(a)g Fk(+)p Fn(,)h(it)g(just)f(builds)h(a)f(pro)31 b(duct.)0 9488 y Fk(def)582 b(getSum\(tokenList\):)1162 10843 y(a)g(=)f (getProduct\(tokenList\))1162 12198 y(if)h(getToken\(tokenList,)i ('+'\):)2325 13552 y(b)d(=)g(getSum\(tokenList\))2325 14907 y(return)h(Tree)f(\('+',)h(a,)g(b\))1162 16262 y(else:)2325 17617 y(return)g(a)0 19937 y Fn(Let's)369 b(test)h(it)g(with)g Fk(9)582 b(*)f(11)g(+)h(5)f(*)g(7)p Fn(:)0 22256 y Fk(>>>)h(tokenList)g(=)f([9,)h('*',)g(11,)f('+',)h(5,)g ('*',)f(7,)h('end'])0 23611 y(>>>)g(tree)f(=)h(getSum\(tokenList\))0 24966 y(>>>)g(printTreePostorder\(tree\))0 26321 y(9)f(11)h(*)f(5)g(7)h (*)f(+)0 28640 y Fn(W)-92 b(e)407 b(are)g(almost)i(done,)417 b(but)408 b(w)-31 b(e)408 b(still)g(ha)-31 b(v)g(e)409 b(to)f(handle)g(paren)-31 b(theses.)606 b(An)-31 b(ywhere)408 b(in)g(an)0 29995 y(expression)256 b(where)g(there)h(can)f(b)31 b(e)256 b(a)h(n)-31 b(um)g(b)31 b(er,)279 b(there)257 b(can)f(also)i(b)31 b(e)256 b(an)g(en)-31 b(tire)257 b(sum)g(enclosed)0 31350 y(in)339 b(paren)-31 b(theses.)482 b(W)-92 b(e)338 b(just)g(need)g(to)i(mo)31 b(dify)340 b Fk(getNumber)f Fn(to)h(handle)f Fv(sub)35 b(expressions)p Fn(:)0 33669 y Fk(def)582 b(getNumber\(tokenList\):)1162 35024 y(if)g(getToken\(tokenList,)i('\('\):)2325 36379 y(x)d(=)g(getSum\(tokenList\))5233 b(#)581 b(get)h(the)g(subexpression) 2325 37734 y(getToken\(tokenList,)i('\)'\))3487 b(#)581 b(remove)h(the)g(closing)g(parenthesis)2325 39089 y(return)g(x)1162 40444 y(else:)2325 41799 y(x)f(=)g(tokenList[0])2325 43154 y(if)g(type\(x\))h(!=)g(type\(0\):)g(return)g(None)2325 44509 y(tokenList[0:1])h(=)e([])2325 45864 y(return)h(Tree)f(\(x,)h (None,)g(None\))0 48183 y Fn(Let's)369 b(test)h(this)g(co)31 b(de)369 b(with)h Fk(9)581 b(*)h(\(11)f(+)h(5\))f(*)g(7)p Fn(:)0 50502 y Fk(>>>)h(tokenList)g(=)f([9,)h('*',)g('\(',)f(11,)h ('+',)g(5,)f('\)',)h('*',)g(7,)f('end'])0 51857 y(>>>)h(tree)f(=)h (getSum\(tokenList\))0 53212 y(>>>)g(printTreePostorder\(tree\))0 54567 y(9)f(11)h(5)f(+)g(7)h(*)f(*)p eop %%Page: 214 240 214 239 bop 0 -2070 a Fv(214)33309 b(T)-106 b(rees)p 0 -1627 38191 45 v 0 865 a Fn(The)386 b(parser)e(handled)j(the)e(paren) -31 b(theses)386 b(correctly;)395 b(the)385 b(addition)j(happ)31 b(ens)385 b(b)31 b(efore)386 b(the)0 2220 y(m)-31 b(ultiplication.)0 4467 y(In)376 b(the)g(\257nal)h(v)-31 b(ersion)376 b(of)h(the)f (program,)j(it)e(w)-31 b(ould)377 b(b)31 b(e)376 b(a)g(go)31 b(o)g(d)377 b(idea)g(to)g(giv)-31 b(e)377 b Fk(getNumber)0 5821 y Fn(a)369 b(name)h(more)g(descriptiv)-31 b(e)370 b(of)g(its)f(new)h(role.)0 10576 y Fl(20.6)1792 b(Handling)599 b(errors)0 13189 y Fn(Throughout)388 b(the)f(parser,)j(w)-31 b(e'v)g(e)388 b(b)31 b(een)386 b(assuming)h(that)h(expressions)e(are)g (w)-31 b(ell-formed.)0 14544 y(F)-92 b(or)458 b(example,)482 b(when)459 b(w)-31 b(e)459 b(reac)-31 b(h)459 b(the)f(end)g(of)h(a)g (sub)31 b(expression,)481 b(w)-31 b(e)459 b(assume)f(that)i(the)0 15898 y(next)345 b(c)-31 b(haracter)344 b(is)g(a)g(close)h(paren)-31 b(thesis.)484 b(If)344 b(there)g(is)g(an)g(error)f(and)i(the)f(next)g (c)-31 b(haracter)0 17253 y(is)369 b(something)i(else,)f(w)-31 b(e)369 b(should)h(deal)g(with)g(it.)0 19581 y Fk(def)582 b(getNumber\(tokenList\):)1162 20936 y(if)g(getToken\(tokenList,)i ('\('\):)2325 22291 y(x)d(=)g(getSum\(tokenList\))2325 23646 y(if)g(not)h(getToken\(tokenList,)i('\)'\):)3487 25001 y(raise)e('BadExpressionError',)i('missing)e(parenthesis')2325 26356 y(return)g(x)1162 27710 y(else:)2325 29065 y(#)f(the)g(rest)h(of) g(the)f(function)i(omitted)0 31393 y Fn(The)350 b Fk(raise)h Fn(statemen)-31 b(t)352 b(creates)e(an)g(exception;)359 b(in)350 b(this)g(case)g(w)-31 b(e)351 b(create)f(a)h(new)f(kind)g(of)0 32748 y(exception,)292 b(called)271 b(a)f Fk(BadExpressionError)p Fn(.)462 b(If)269 b(the)h(function)h(that)g(called)g Fk(getNumber)p Fn(,)0 34103 y(or)388 b(one)g(of)h(the)f(other)h (functions)g(in)f(the)g(tracebac)-31 b(k,)395 b(handles)388 b(the)h(exception,)394 b(then)389 b(the)0 35458 y(program)337 b(can)g(con)-31 b(tin)g(ue.)483 b(Otherwise,)344 b(Python)338 b(will)g(prin)-31 b(t)337 b(an)g(error)e(message)i(and)f(quit.)2767 38260 y Fm(As)360 b(an)f(exer)-57 b(cise,)368 b(\257nd)360 b(other)f(plac)-57 b(es)360 b(in)g(these)g(functions)g(wher)-57 b(e)360 b(err)-57 b(ors)359 b(c)-57 b(an)2767 39615 y(o)g(c)g(cur)479 b(and)e(add)g(appr)-57 b(opriate)476 b Fk(raise)i Fm(statements.)753 b(T)-85 b(est)478 b(your)f(c)-57 b(o)g(de)478 b(with)2767 40970 y(impr)-57 b(op)g(erly)397 b(forme)-57 b(d)397 b(expr)-57 b(essions.)0 45724 y Fl(20.7)1792 b(The)599 b(animal)f(tree)0 48337 y Fn(In)523 b(this)g(section,)563 b(w)-31 b(e)523 b(dev)-31 b(elop)525 b(a)e(small)h(program)g(that)g (uses)e(a)i(tree)f(to)g(represen)-31 b(t)523 b(a)0 49692 y(kno)-31 b(wledge)371 b(base.)0 51938 y(The)439 b(program)h(in)-31 b(teracts)441 b(with)f(the)g(user)e(to)i(create)f(a)h(tree)f(of)g (questions)h(and)g(animal)0 53293 y(names.)493 b(Here)369 b(is)g(a)g(sample)h(run:)p eop %%Page: 215 241 215 240 bop 0 -2070 a Fv(20.7)425 b(The)g(animal)e(tree)24671 b(215)p 0 -1627 38191 45 v 0 865 a Fk(Are)582 b(you)f(thinking)i(of)e (an)g(animal?)i(y)0 2220 y(Is)e(it)h(a)f(bird?)h(n)0 3575 y(What)g(is)f(the)h(animals)g(name?)g(dog)0 4930 y(What)g(question)g(would)g(distinguish)h(a)e(dog)h(from)f(a)h(bird?)g (Can)f(it)h(fly)0 6285 y(If)f(the)h(animal)g(were)g(dog)f(the)h(answer) g(would)g(be?)g(n)0 8995 y(Are)g(you)f(thinking)i(of)e(an)g(animal?)i (y)0 10350 y(Can)f(it)f(fly?)h(n)0 11705 y(Is)f(it)h(a)f(dog?)h(n)0 13059 y(What)g(is)f(the)h(animals)g(name?)g(cat)0 14414 y(What)g(question)g(would)g(distinguish)h(a)e(cat)h(from)f(a)h(dog?)f (Does)h(it)g(bark)0 15769 y(If)f(the)h(animal)g(were)g(cat)f(the)h (answer)g(would)g(be?)g(n)0 18479 y(Are)g(you)f(thinking)i(of)e(an)g (animal?)i(y)0 19834 y(Can)f(it)f(fly?)h(n)0 21189 y(Does)g(it)f(bark?) h(y)0 22544 y(Is)f(it)h(a)f(dog?)h(y)0 23899 y(I)f(rule!)0 26609 y(Are)h(you)f(thinking)i(of)e(an)g(animal?)i(n)0 29271 y Fn(Here)369 b(is)g(the)g(tree)g(this)h(dialog)h(builds:)8206 30650 y 12893224 7235993 0 0 12893224 7235993 startTexFig 8206 30650 a %%BeginDocument: illustrations/tree5.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: tree5.eps %%Creator: fig2dev Version 3.2 Patchlevel 3c %%CreationDate: Sun Dec 30 19:29:04 2001 %%For: downey@rocky.wellesley.edu (Allen B. Downey) %%BoundingBox: 0 0 196 110 %%Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def $F2psDict begin $F2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 110 moveto 0 0 lineto 196 0 lineto 196 110 lineto closepath clip newpath -21.0 118.0 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def $F2psBegin %%Page: 1 1 10 setmiterlimit 0.06000 0.06000 sc % % Fig objects follow % % Polyline 7.500 slw n 480 1650 m 375 1650 375 1845 105 arcto 4 {pop} repeat 375 1950 870 1950 105 arcto 4 {pop} repeat 975 1950 975 1755 105 arcto 4 {pop} repeat 975 1650 480 1650 105 arcto 4 {pop} repeat cp gs col0 s gr % Polyline n 1530 1650 m 1425 1650 1425 1845 105 arcto 4 {pop} repeat 1425 1950 1920 1950 105 arcto 4 {pop} repeat 2025 1950 2025 1755 105 arcto 4 {pop} repeat 2025 1650 1530 1650 105 arcto 4 {pop} repeat cp gs col0 s gr % Polyline n 1350 1200 m 1725 1650 l gs col0 s gr % Polyline n 1050 1200 m 675 1650 l gs col0 s gr % Polyline n 705 900 m 600 900 600 1095 105 arcto 4 {pop} repeat 600 1200 1770 1200 105 arcto 4 {pop} repeat 1875 1200 1875 1005 105 arcto 4 {pop} repeat 1875 900 705 900 105 arcto 4 {pop} repeat cp gs col0 s gr % Polyline n 1800 450 m 1200 900 l gs col0 s gr % Polyline n 1380 150 m 1275 150 1275 345 105 arcto 4 {pop} repeat 1275 450 2820 450 105 arcto 4 {pop} repeat 2925 450 2925 255 105 arcto 4 {pop} repeat 2925 150 1380 150 105 arcto 4 {pop} repeat cp gs col0 s gr % Polyline n 2430 900 m 2325 900 2325 1095 105 arcto 4 {pop} repeat 2325 1200 3495 1200 105 arcto 4 {pop} repeat 3600 1200 3600 1005 105 arcto 4 {pop} repeat 3600 900 2430 900 105 arcto 4 {pop} repeat cp gs col0 s gr % Polyline n 2400 450 m 3000 900 l gs col0 s gr /Helvetica ff 180.00 scf sf 2820 1117 m gs 1 -1 sc (bird) col0 sh gr /Helvetica ff 180.00 scf sf 1275 750 m gs 1 -1 sc (n) col0 sh gr /Helvetica ff 180.00 scf sf 1650 1500 m gs 1 -1 sc (y) col0 sh gr /Helvetica ff 180.00 scf sf 675 1500 m gs 1 -1 sc (n) col0 sh gr /Helvetica ff 180.00 scf sf 2887 750 m gs 1 -1 sc (y) col0 sh gr /Helvetica ff 180.00 scf sf 1687 367 m gs 1 -1 sc (Can it fly?) col0 sh gr /Helvetica ff 180.00 scf sf 697 1118 m gs 1 -1 sc (Does it bark?) col0 sh gr /Helvetica ff 180.00 scf sf 548 1860 m gs 1 -1 sc (cat) col0 sh gr /Helvetica ff 180.00 scf sf 1575 1860 m gs 1 -1 sc (dog) col0 sh gr $F2psEnd rs %%EndDocument endTexFig 0 45292 a Fn(A)-31 b(t)404 b(the)g(b)31 b(eginning)405 b(of)g(eac)-31 b(h)404 b(round,)412 b(the)404 b(program)h(starts)e(at)i (the)f(top)g(of)g(the)g(tree)g(and)0 46647 y(asks)f(the)g(\257rst)g (question.)595 b(Dep)31 b(ending)403 b(on)g(the)h(answ)-31 b(er,)412 b(it)404 b(mo)-31 b(v)g(es)404 b(to)g(the)f(left)h(or)f(righ) -31 b(t)0 48002 y(c)g(hild)348 b(and)f(con)-31 b(tin)g(ues)348 b(un)-31 b(til)348 b(it)g(gets)f(to)h(a)f(leaf)h(no)31 b(de.)485 b(A)-31 b(t)347 b(that)i(p)31 b(oin)-31 b(t,)353 b(it)347 b(mak)-31 b(es)348 b(a)f(guess.)0 49357 y(If)320 b(the)g(guess)f(is)h(not)g(correct,)330 b(it)321 b(asks)e(the)h(user)f (for)h(the)g(name)g(of)h(the)f(new)g(animal)i(and)e(a)0 50712 y(question)366 b(that)h(distinguishes)f(the)f(\(bad\))h(guess)f (from)h(the)f(new)g(animal.)494 b(Then)365 b(it)h(adds)0 52067 y(a)j(no)31 b(de)370 b(to)g(the)f(tree)g(with)h(the)g(new)f (question)i(and)e(the)g(new)h(animal.)0 54648 y(Here)f(is)g(the)g(co)31 b(de:)p eop %%Page: 216 242 216 241 bop 0 -2070 a Fv(216)33309 b(T)-106 b(rees)p 0 -1627 38191 45 v 0 865 a Fk(def)582 b(animal\(\):)1162 2220 y(#)g(start)f(with)h(a)g(singleton)1162 3575 y(root)g(=)f (Tree\("bird"\))1162 6285 y(#)h(loop)f(until)h(the)g(user)g(quits)1162 7640 y(while)g(1:)2325 8995 y(print)2325 10350 y(if)f(not)h(yes\("Are)g (you)g(thinking)g(of)f(an)h(animal?)g("\):)g(break)2325 13059 y(#)f(walk)h(the)f(tree)2325 14414 y(tree)g(=)h(root)2325 15769 y(while)f(tree.getLeft\(\))j(!=)d(None:)3487 17124 y(prompt)h(=)f(tree.getCargo\(\))j(+)d("?)g(")3487 18479 y(if)g(yes\(prompt\):)4649 19834 y(tree)h(=)f(tree.getRight\(\))3487 21189 y(else:)4649 22544 y(tree)h(=)f(tree.getLeft\(\))2325 25254 y(#)g(make)h(a)f(guess)2325 26609 y(guess)g(=)h (tree.getCargo\(\))2325 27964 y(prompt)g(=)f("Is)h(it)f(a)g(")h(+)f (guess)h(+)f("?)h(")2325 29319 y(if)f(yes\(prompt\):)3487 30673 y(print)h("I)f(rule!")3487 32028 y(continue)2325 34738 y(#)g(get)g(new)h(information)2325 36093 y(prompt)1163 b(=)581 b("What)h(is)f(the)h(animal's)g(name?)g(")2325 37448 y(animal)1163 b(=)581 b(raw_input\(prompt\))2325 38803 y(prompt)1163 b(=)581 b("What)h(question)g(would)g(distinguish)h (a)e(\045s)h(from)f(a)h(\045s?)f(")2325 40158 y(question)h(=)f (raw_input\(prompt)j(\045)d(\(animal,guess\)\))2325 42868 y(#)g(add)g(new)h(information)h(to)e(the)h(tree)2325 44223 y(tree.setCargo\(question\))2325 45578 y(prompt)g(=)f("If)h(the)f (animal)h(were)g(\045s)f(the)h(answer)g(would)g(be?)f(")2325 46933 y(if)g(yes\(prompt)i(\045)e(animal\):)3487 48287 y(tree.setLeft\(Tree\(guess\)\))3487 49642 y (tree.setRight\(Tree\(animal\)\))2325 50997 y(else:)3487 52352 y(tree.setLeft\(Tree\(animal\)\))3487 53707 y (tree.setRight\(Tree\(guess\)\))0 56003 y Fn(The)370 b(function)h Fk(yes)f Fn(is)g(a)g(help)31 b(er;)370 b(it)h(prin)-31 b(ts)370 b(a)g(prompt)g(and)g(then)g(tak)-31 b(es)371 b(input)f(from)h(the)0 57358 y(user.)492 b(If)369 b(the)g(resp)31 b(onse)368 b(b)31 b(egins)369 b(with)i Fm(y)e Fn(or)g Fm(Y)p Fn(,)g(the)h(function)h(returns)d(true:)p eop %%Page: 217 243 217 242 bop 0 -2070 a Fv(20.8)425 b(Glossary)28784 b(217)p 0 -1627 38191 45 v 0 865 a Fk(def)582 b(yes\(ques\):)1162 2220 y(from)g(string)g(import)g(lower)1162 3575 y(ans)g(=)f (lower\(raw_input\(ques\)\))1162 4930 y(return)h(\(ans[0])h(==)e('y'\)) 0 7203 y Fn(The)500 b(condition)i(of)f(the)f(outer)g(lo)31 b(op)501 b(is)f Fk(1)p Fn(,)533 b(whic)-31 b(h)501 b(means)f(it)h(will) h(con)-31 b(tin)g(ue)501 b(un)-31 b(til)502 b(the)0 8558 y Fk(break)370 b Fn(statemen)-31 b(t)371 b(executes,)f(if)f(the)h(user) e(is)h(not)h(thinking)h(of)f(an)f(animal.)0 10751 y(The)394 b(inner)g Fk(while)h Fn(lo)31 b(op)395 b(w)-31 b(alks)395 b(the)f(tree)g(from)h(top)f(to)h(b)31 b(ottom,)403 b(guided)394 b(b)-31 b(y)395 b(the)f(user's)0 12106 y(resp)31 b(onses.)0 14298 y(When)314 b(a)h(new)g(no)31 b(de)314 b(is)h(added)g(to)g(the)g (tree,)326 b(the)315 b(new)g(question)g(replaces)g(the)g(cargo,)327 b(and)0 15653 y(the)369 b(t)-31 b(w)g(o)371 b(c)-31 b(hildren)370 b(are)f(the)g(new)h(animal)h(and)f(the)f(original)j(cargo.)0 17845 y(One)342 b(shortcoming)i(of)e(the)g(program)h(is)f(that)i(when)e (it)h(exits,)348 b(it)343 b(forgets)g(ev)-31 b(erything)343 b(y)-31 b(ou)0 19200 y(carefully)370 b(taugh)-31 b(t)372 b(it!)2767 21898 y Fm(As)394 b(an)f(exer)-57 b(cise,)396 b(think)e(of)g(various)f(ways)g(you)h(might)h(save)e(the)h(know)57 b(le)-57 b(dge)2767 23253 y(tr)g(e)g(e)397 b(in)g(a)f(\257le.)510 b(Implement)396 b(the)g(one)h(you)f(think)h(is)f(e)-57 b(asiest.)0 27846 y Fl(20.8)1792 b(Glossary)0 30383 y Fv(binary)424 b(tree:)555 b Fn(A)392 b(tree)g(in)g(whic)-31 b(h)394 b(eac)-31 b(h)392 b(no)31 b(de)393 b(refers)e(to)i(zero,)398 b(one,)h(or)392 b(t)-31 b(w)g(o)394 b(dep)31 b(enden)-31 b(t)2767 31737 y(no)31 b(des.)0 34029 y Fv(ro)k(ot:)555 b Fn(The)369 b(topmost)i(no)31 b(de)369 b(in)h(a)f(tree,)h(with)g(no)g (paren)-31 b(t.)0 36320 y Fv(leaf:)553 b Fn(A)369 b(b)31 b(ottom-most)372 b(no)31 b(de)369 b(in)h(a)f(tree,)h(with)g(no)g(c)-31 b(hildren.)0 38611 y Fv(paren)c(t:)554 b Fn(The)369 b(no)31 b(de)369 b(that)i(refers)d(to)i(a)f(giv)-31 b(en)371 b(no)31 b(de.)0 40902 y Fv(c)-35 b(hild:)552 b Fn(One)369 b(of)h(the)f(no)31 b(des)369 b(referred)f(to)i(b)-31 b(y)369 b(a)h(no)31 b(de.)0 43193 y Fv(siblings:)553 b Fn(No)31 b(des)369 b(that)i(share)d(a)i(common)h(paren)-31 b(t.)0 45484 y Fv(lev)c(el:)553 b Fn(The)369 b(set)g(of)h(no)31 b(des)369 b(equidistan)-31 b(t)371 b(from)f(the)f(ro)31 b(ot.)0 47775 y Fv(binary)424 b(op)35 b(erator:)556 b Fn(An)369 b(op)31 b(erator)370 b(that)g(tak)-31 b(es)370 b(t)-31 b(w)g(o)371 b(op)31 b(erands.)0 50066 y Fv(sub)k(expression:) 556 b Fn(An)362 b(expression)f(in)h(paren)-31 b(theses)362 b(that)h(acts)f(as)g(a)g(single)h(op)31 b(erand)362 b(in)2767 51421 y(a)370 b(larger)f(expression.)0 53712 y Fv(preorder:)556 b Fn(A)369 b(w)-31 b(a)g(y)371 b(to)f(tra)-31 b(v)g(erse)369 b(a)g(tree,)h(visiting)h(eac)-31 b(h)370 b(no)31 b(de)369 b(b)31 b(efore)369 b(its)h(c)-31 b(hildren.)0 56003 y Fv(pre\257x)425 b(notation:)554 b Fn(A)345 b(w)-31 b(a)g(y)347 b(of)e(writing)i(a)e(mathematical)k(expression)c(with)h(eac)-31 b(h)345 b(op)31 b(er-)2767 57358 y(ator)370 b(app)31 b(earing)371 b(b)31 b(efore)369 b(its)g(op)31 b(erands.)p eop %%Page: 218 244 218 243 bop 0 -2070 a Fv(218)33309 b(T)-106 b(rees)p 0 -1627 38191 45 v 0 865 a(p)35 b(ostorder:)556 b Fn(A)378 b(w)-31 b(a)g(y)380 b(to)f(tra)-31 b(v)g(erse)378 b(a)g(tree,)j (visiting)f(the)e(c)-31 b(hildren)379 b(of)g(eac)-31 b(h)378 b(no)31 b(de)378 b(b)31 b(efore)2767 2220 y(the)370 b(no)31 b(de)369 b(itself.)0 4461 y Fv(inorder:)555 b Fn(A)369 b(w)-31 b(a)g(y)371 b(to)f(tra)-31 b(v)g(erse)370 b(a)g(tree,)g(visiting)h(the)f(left)g(subtree,)g(then)f(the)h(ro)31 b(ot,)371 b(and)2767 5815 y(then)f(the)f(righ)-31 b(t)370 b(subtree.)p eop %%Page: 219 245 219 244 bop 0 9923 a Fi(App)72 b(endix)862 b(A)0 16224 y Fo(Debugging)0 22707 y Fn(Di\256eren)-31 b(t)379 b(kinds)g(of)h (errors)d(can)j(o)31 b(ccur)378 b(in)i(a)f(program,)k(and)d(it)f(is)g (useful)h(to)g(distinguish)0 24062 y(among)371 b(them)f(in)f(order)g (to)h(trac)-31 b(k)370 b(them)g(do)-31 b(wn)370 b(more)f(quic)-31 b(kly:)1660 26392 y Fj(\262)554 b Fn(Syn)-31 b(tax)441 b(errors)d(are)g(pro)31 b(duced)439 b(b)-31 b(y)439 b(Python)i(when)e (it)h(is)f(translating)i(the)e(source)2767 27747 y(co)31 b(de)346 b(in)-31 b(to)348 b(b)-31 b(yte)347 b(co)31 b(de.)484 b(They)347 b(usually)g(indicate)h(that)f(there)f(is)f (something)j(wrong)2767 29102 y(with)354 b(the)f(syn)-31 b(tax)353 b(of)g(the)g(program.)488 b(Example:)e(Omitting)355 b(the)e(colon)g(at)g(the)g(end)2767 30457 y(of)286 b(a)f Fk(def)h Fn(statemen)-31 b(t)287 b(yields)f(the)f(somewhat)i(redundan) -31 b(t)286 b(message)f Fk(SyntaxError:)2767 31812 y(invalid)583 b(syntax)p Fn(.)1660 33950 y Fj(\262)554 b Fn(Run)-31 b(time)512 b(errors)d(are)h(pro)31 b(duced)510 b(b)-31 b(y)510 b(the)h(run)-31 b(time)511 b(system)g(if)g(something)h(go)31 b(es)2767 35305 y(wrong)305 b(while)g(the)f(program)h(is)f(running.)471 b(Most)304 b(run)-31 b(time)305 b(error)e(messages)h(include)2767 36660 y(information)345 b(ab)31 b(out)342 b(where)g(the)f(error)g(o)31 b(ccurred)340 b(and)i(what)h(functions)f(w)-31 b(ere)342 b(exe-)2767 38015 y(cuting.)535 b(Example:)522 b(An)382 b(in\257nite)i(recursion)f(ev)-31 b(en)g(tually)385 b(causes)d(a)h(run) -31 b(time)384 b(error)2767 39370 y(of)370 b(\\maxim)-31 b(um)372 b(recursion)d(depth)g(exceeded.")1660 41508 y Fj(\262)554 b Fn(Seman)-31 b(tic)359 b(errors)c(are)h(problems)g (with)i(a)f(program)g(that)g(compiles)h(and)e(runs)g(but)2767 42863 y(do)31 b(esn't)319 b(do)g(the)f(righ)-31 b(t)319 b(thing.)477 b(Example:)469 b(An)318 b(expression)g(ma)-31 b(y)320 b(not)f(b)31 b(e)318 b(ev)-61 b(aluated)2767 44218 y(in)370 b(the)f(order)g(y)-31 b(ou)370 b(exp)31 b(ect,)370 b(yielding)h(an)e(unexp)31 b(ected)369 b(result.)0 46548 y(The)455 b(\257rst)f(step)h(in)g(debugging)i(is)e(to)g(\257gure) g(out)h(whic)-31 b(h)455 b(kind)h(of)f(error)f(y)-31 b(ou)456 b(are)e(deal-)0 47903 y(ing)483 b(with.)835 b(Although)484 b(the)f(follo)-31 b(wing)487 b(sections)c(are)f (organized)i(b)-31 b(y)483 b(error)f(t)-31 b(yp)31 b(e,)512 b(some)0 49258 y(tec)-31 b(hniques)370 b(are)f(applicable)i(in)f(more)f (than)h(one)g(situation.)0 53615 y Fl(A.1)1793 b(Syn)-50 b(tax)600 b(errors)0 56003 y Fn(Syn)-31 b(tax)453 b(errors)d(are)h (usually)i(easy)e(to)h(\257x)g(once)g(y)-31 b(ou)452 b(\257gure)f(out)h(what)h(they)f(are.)739 b(Un-)0 57358 y(fortunately)-92 b(,)697 b(the)630 b(error)e(messages)i(are)f(often)h (not)h(helpful.)1274 b(The)630 b(most)g(common)p eop %%Page: 220 246 220 245 bop 0 -2070 a Fv(220)30338 b(Debugging)p 0 -1627 38191 45 v 0 865 a Fn(messages)532 b(are)g Fk(SyntaxError:)1164 b(invalid)583 b(syntax)533 b Fn(and)f Fk(SyntaxError:)1164 b(invalid)0 2220 y(token)p Fn(,)370 b(neither)g(of)f(whic)-31 b(h)371 b(is)e(v)-31 b(ery)369 b(informativ)-31 b(e.)0 4633 y(On)306 b(the)h(other)g(hand,)320 b(the)307 b(message)g(do)31 b(es)306 b(tell)i(y)-31 b(ou)307 b(where)f(in)h(the)g(program)g(the)g (problem)0 5988 y(o)31 b(ccurred.)611 b(Actually)-92 b(,)421 b(it)409 b(tells)h(y)-31 b(ou)410 b(where)e(Python)j(noticed)f (a)f(problem,)420 b(whic)-31 b(h)409 b(is)g(not)0 7343 y(necessarily)433 b(where)f(the)h(error)f(is.)683 b(Sometimes)435 b(the)e(error)f(is)g(prior)h(to)g(the)g(lo)31 b(cation)435 b(of)0 8698 y(the)369 b(error)g(message,)h(often)g(on)f(the)h (preceding)f(line.)0 11111 y(If)503 b(y)-31 b(ou)504 b(are)f(building)i(the)e(program)h(incremen)-31 b(tally)-92 b(,)540 b(y)-31 b(ou)504 b(should)g(ha)-31 b(v)g(e)504 b(a)f(go)31 b(o)g(d)504 b(idea)0 12466 y(ab)31 b(out)370 b(where)f(the)h(error)e(is.)492 b(It)369 b(will)i(b)31 b(e)369 b(in)h(the)f(last)h(line)g(y)-31 b(ou)370 b(added.)0 14879 y(If)294 b(y)-31 b(ou)296 b(are)e(cop)-31 b(ying)296 b(co)31 b(de)295 b(from)g(a)g(b)31 b(o)g(ok,)310 b(start)296 b(b)-31 b(y)294 b(comparing)j(y)-31 b(our)295 b(co)31 b(de)294 b(to)h(the)g(b)31 b(o)g(ok's)0 16234 y(co)g(de)406 b(v)-31 b(ery)405 b(carefully)-92 b(.)604 b(Chec)-31 b(k)406 b(ev)-31 b(ery)406 b(c)-31 b(haracter.)602 b(A)-31 b(t)407 b(the)f(same)g(time,)416 b(remem)-31 b(b)31 b(er)406 b(that)0 17588 y(the)323 b(b)31 b(o)g(ok)323 b(migh)-31 b(t)325 b(b)31 b(e)322 b(wrong,)333 b(so)323 b(if)g(y)-31 b(ou)323 b(see)f(something)j(that)e(lo)31 b(oks)324 b(lik)-31 b(e)324 b(a)f(syn)-31 b(tax)323 b(error,)0 18943 y(it)370 b(migh)-31 b(t)371 b(b)31 b(e.)0 21356 y(Here)369 b(are)g(some)g(w)-31 b(a)g(ys)371 b(to)f(a)-31 b(v)g(oid)371 b(the)e(most)h(common)h(syn)-31 b(tax)370 b(errors:)1353 24480 y(1.)554 b(Mak)-31 b(e)370 b(sure)e(y)-31 b(ou)370 b(are)f(not)h(using)g(a)f(Python)i(k)-31 b(eyw)g(ord)370 b(for)f(a)h(v)-61 b(ariable)370 b(name.)1353 27181 y(2.)554 b(Chec)-31 b(k)368 b(that)f(y)-31 b(ou)368 b(ha)-31 b(v)g(e)367 b(a)g(colon)h(at)f(the)g(end)f(of)h(the)g(header)f (of)h(ev)-31 b(ery)367 b(comp)31 b(ound)2767 28536 y(statemen)-31 b(t,)372 b(including)f Fk(for)p Fn(,)f Fk(while)p Fn(,)g Fk(if)p Fn(,)g(and)f Fk(def)h Fn(statemen)-31 b(ts.)1353 31237 y(3.)554 b(Chec)-31 b(k)401 b(that)g(inden)-31 b(tation)402 b(is)e(consisten)-31 b(t.)585 b(Y)-92 b(ou)400 b(ma)-31 b(y)401 b(inden)-31 b(t)401 b(with)f(either)g(spaces)2767 32592 y(or)455 b(tabs)g(but)f(it's)i(b)31 b(est)454 b(not)h(to)g(mix)h (them.)749 b(Eac)-31 b(h)456 b(lev)-31 b(el)455 b(should)g(b)31 b(e)454 b(nested)h(the)2767 33946 y(same)370 b(amoun)-31 b(t.)1353 36647 y(4.)554 b(Mak)-31 b(e)370 b(sure)e(that)j(an)-31 b(y)370 b(strings)f(in)g(the)h(co)31 b(de)369 b(ha)-31 b(v)g(e)370 b(matc)-31 b(hing)372 b(quotation)g(marks.)1353 39348 y(5.)554 b(If)440 b(y)-31 b(ou)441 b(ha)-31 b(v)g(e)441 b(m)-31 b(ultiline)443 b(strings)d(with)h(triple)g(quotes)f(\(single)i (or)d(double\),)460 b(mak)-31 b(e)2767 40703 y(sure)505 b(y)-31 b(ou)506 b(ha)-31 b(v)g(e)506 b(terminated)h(the)f(string)f (prop)31 b(erly)-92 b(.)901 b(An)505 b(un)-31 b(terminated)507 b(string)2767 42058 y(ma)-31 b(y)333 b(cause)f(an)g Fk(invalid)582 b(token)332 b Fn(error)f(at)h(the)g(end)g(of)g(y)-31 b(our)332 b(program,)341 b(or)331 b(it)i(ma)-31 b(y)2767 43413 y(treat)429 b(the)g(follo)-31 b(wing)432 b(part)c(of)h(the)g (program)g(as)f(a)h(string)f(un)-31 b(til)430 b(it)f(comes)g(to)g(the) 2767 44768 y(next)361 b(string.)490 b(In)360 b(the)h(second)f(case,)i (it)f(migh)-31 b(t)363 b(not)e(pro)31 b(duce)360 b(an)g(error)f (message)i(at)2767 46123 y(all!)1353 48824 y(6.)554 b(An)435 b(unclosed)f(brac)-31 b(k)g(et|)p Fk(\()p Fn(,)452 b Fk({)p Fn(,)f(or)434 b Fk([)p Fn(|mak)-31 b(es)435 b(Python)h(con)-31 b(tin)g(ue)436 b(with)f(the)f(next)2767 50179 y(line)i(as)e(part)h(of)g (the)g(curren)-31 b(t)434 b(statemen)-31 b(t.)690 b(Generally)-92 b(,)452 b(an)435 b(error)e(o)31 b(ccurs)434 b(almost)2767 51534 y(immediately)373 b(in)c(the)h(next)f(line.)1353 54235 y(7.)554 b(Chec)-31 b(k)370 b(for)g(the)f(classic)h Fk(=)f Fn(instead)h(of)g Fk(==)f Fn(inside)g(a)h(conditional.)0 57358 y(If)f(nothing)i(w)-31 b(orks,)370 b(mo)-31 b(v)g(e)371 b(on)e(to)h(the)f(next)h(section...)p eop %%Page: 221 247 221 246 bop 0 -2070 a Fv(A.2)425 b(Run)-35 b(time)424 b(errors)25360 b(221)p 0 -1627 38191 45 v 0 865 a Fh(A.1.1)1495 b(I)416 b(can't)i(get)e(m)-42 b(y)417 b(program)i(to)e(run)g(no)g (matter)g(what)h(I)e(do.)0 3380 y Fn(If)306 b(the)g(compiler)h(sa)-31 b(ys)306 b(there)g(is)g(an)g(error)f(and)h(y)-31 b(ou)307 b(don't)g(see)e(it,)320 b(that)307 b(migh)-31 b(t)308 b(b)31 b(e)305 b(b)31 b(ecause)0 4735 y(y)-31 b(ou)251 b(and)f(the)h(compiler)g(are)g(not)g(lo)31 b(oking)252 b(at)f(the)g(same)f(co)31 b(de.)453 b(Chec)-31 b(k)251 b(y)-31 b(our)251 b(programming)0 6090 y(en)-31 b(vironmen)g(t)310 b(to)g(mak)-31 b(e)310 b(sure)d(that)j(the)f(program)g(y)-31 b(ou)309 b(are)g(editing)h(is)f(the)f(one)h(Python)h(is)0 7445 y(trying)344 b(to)g(run.)483 b(If)343 b(y)-31 b(ou)343 b(are)g(not)h(sure,)k(try)343 b(putting)h(an)f(ob)-31 b(vious)345 b(and)e(delib)31 b(erate)344 b(syn)-31 b(tax)0 8800 y(error)454 b(at)i(the)f(b)31 b(eginning)456 b(of)g(the)f (program.)750 b(No)-31 b(w)457 b(run)d(\(or)h(imp)31 b(ort\))457 b(it)e(again.)752 b(If)455 b(the)0 10155 y(compiler)465 b(do)31 b(esn't)465 b(\257nd)f(the)g(new)g(error,)487 b(there)464 b(is)g(probably)h(something)h(wrong)f(with)0 11509 y(the)369 b(w)-31 b(a)g(y)371 b(y)-31 b(our)370 b(en)-31 b(vironmen)g(t)371 b(is)e(set)g(up.)0 13822 y(If)360 b(this)g(happ)31 b(ens,)362 b(one)e(approac)-31 b(h)360 b(is)g(to)h(start)f(again)i(with)f(a)f(new)g(program)g(lik)-31 b(e)361 b(\\Hello,)0 15177 y(W)-92 b(orld!,")391 b(and)386 b(mak)-31 b(e)387 b(sure)e(y)-31 b(ou)386 b(can)g(get)h(a)f(kno)-31 b(wn)386 b(program)h(to)f(run.)542 b(Then)386 b(gradually)0 16532 y(add)369 b(the)h(pieces)f(of)h(the)f(new)g(program)h(to)g(the)g (w)-31 b(orking)371 b(one.)0 21486 y Fl(A.2)1793 b(Run)-50 b(time)599 b(errors)0 24191 y Fn(Once)402 b(y)-31 b(our)403 b(program)h(is)e(syn)-31 b(tactically)406 b(correct,)411 b(Python)404 b(can)f(imp)31 b(ort)404 b(it)f(and)g(at)g(least)0 25546 y(start)370 b(running)f(it.)494 b(What)369 b(could)h(p)31 b(ossibly)370 b(go)g(wrong?)0 29929 y Fh(A.2.1)1495 b(My)498 b(program)i(do)42 b(es)498 b(absolutely)i(nothing.)0 32443 y Fn(This)251 b(problem)g(is)f(most)i(common)g(when)e(y)-31 b(our)251 b(\257le)g(consists)f(of)h(functions)h(and)f(classes)f(but)0 33798 y(do)31 b(es)407 b(not)i(actually)h(in)-31 b(v)g(ok)g(e)410 b(an)-31 b(ything)410 b(to)e(start)g(execution.)610 b(This)408 b(ma)-31 b(y)409 b(b)31 b(e)407 b(in)-31 b(ten)g(tional)0 35153 y(if)370 b(y)-31 b(ou)370 b(only)g(plan)g(to)g(imp)31 b(ort)370 b(this)f(mo)31 b(dule)371 b(to)f(supply)f(classes)g(and)g (functions.)0 37466 y(If)520 b(it)h(is)g(not)g(in)-31 b(ten)g(tional,)562 b(mak)-31 b(e)522 b(sure)d(that)j(y)-31 b(ou)521 b(are)g(in)-31 b(v)g(oking)523 b(a)d(function)i(to)f(start)0 38821 y(execution,)448 b(or)431 b(execute)h(one)f(from)h(the)f(in)-31 b(teractiv)g(e)434 b(prompt.)679 b(Also)432 b(see)e(the)i(\\Flo)-31 b(w)432 b(of)0 40176 y(Execution")371 b(section)f(b)31 b(elo)-31 b(w.)0 44559 y Fh(A.2.2)1495 b(My)498 b(program)i(hangs.)0 47073 y Fn(If)307 b(a)h(program)g(stops)f(and)h(seems)f(to)h(b)31 b(e)307 b(doing)i(nothing,)322 b(w)-31 b(e)307 b(sa)-31 b(y)308 b(it)g(is)g(\\hanging.")474 b(Often)0 48428 y(that)370 b(means)g(that)g(it)g(is)f(caugh)-31 b(t)371 b(in)f(an)f(in\257nite)h (lo)31 b(op)371 b(or)e(an)g(in\257nite)h(recursion.)1660 51359 y Fj(\262)554 b Fn(If)361 b(there)g(is)g(a)g(particular)h(lo)31 b(op)362 b(that)g(y)-31 b(ou)362 b(susp)31 b(ect)360 b(is)h(the)g(problem,)j(add)d(a)g Fk(print)2767 52713 y Fn(statemen)-31 b(t)378 b(immediately)i(b)31 b(efore)375 b(the)i(lo)31 b(op)377 b(that)g(sa)-31 b(ys)376 b(\\en)-31 b(tering)377 b(the)f(lo)31 b(op")378 b(and)2767 54068 y(another)370 b(immediately)j(after)d(that)g(sa)-31 b(ys)369 b(\\exiting)j(the)d(lo)31 b(op.")2767 56003 y(Run)350 b(the)g(program.)487 b(If)350 b(y)-31 b(ou)351 b(get)f(the)g(\257rst)g (message)g(and)g(not)h(the)f(second,)k(y)-31 b(ou'v)g(e)2767 57358 y(got)371 b(an)e(in\257nite)i(lo)31 b(op.)493 b(Go)369 b(to)h(the)g(\\In\257nite)g(Lo)31 b(op")370 b(section)g(b)31 b(elo)-31 b(w.)p eop %%Page: 222 248 222 247 bop 0 -2070 a Fv(222)30338 b(Debugging)p 0 -1627 38191 45 v 1660 865 a Fj(\262)554 b Fn(Most)406 b(of)h(the)f(time,)417 b(an)406 b(in\257nite)h(recursion)e(will)j(cause)d(the)h(program)h(to)g (run)e(for)2767 2220 y(a)460 b(while)g(and)f(then)g(pro)31 b(duce)459 b(a)g(\\Run)-31 b(timeError:)673 b(Maxim)-31 b(um)461 b(recursion)e(depth)2767 3575 y(exceeded")434 b(error.)684 b(If)433 b(that)h(happ)31 b(ens,)449 b(go)434 b(to)g(the)g(\\In\257nite)g(Recursion")f(section)2767 4930 y(b)31 b(elo)-31 b(w.)2767 6708 y(If)399 b(y)-31 b(ou)400 b(are)f(not)h(getting)h(this)e(error)f(but)i(y)-31 b(ou)399 b(susp)31 b(ect)399 b(there)g(is)g(a)g(problem)h(with)2767 8063 y(a)493 b(recursiv)-31 b(e)491 b(metho)31 b(d)493 b(or)f(function,)524 b(y)-31 b(ou)493 b(can)f(still)h(use)f(the)g(tec) -31 b(hniques)492 b(in)h(the)2767 9418 y(\\In\257nite)371 b(Recursion")e(section.)1660 11620 y Fj(\262)554 b Fn(If)270 b(neither)f(of)h(those)g(steps)f(w)-31 b(orks,)290 b(start)270 b(testing)h(other)e(lo)31 b(ops)270 b(and)g(other)f(recursiv)-31 b(e)2767 12975 y(functions)371 b(and)e(metho)31 b(ds.)1660 15177 y Fj(\262)554 b Fn(If)487 b(that)h(do)31 b(esn't)487 b(w)-31 b(ork,)517 b(then)487 b(it)h(is)e(p)31 b(ossible)487 b(that)h(y)-31 b(ou)487 b(don't)h(understand)f(the)2767 16532 y(\260o)-31 b(w)331 b(of)e(execution)i(in)e(y)-31 b(our)330 b(program.)480 b(Go)329 b(to)h(the)f(\\Flo)-31 b(w)331 b(of)f(Execution")h(section)2767 17887 y(b)31 b(elo)-31 b(w.)0 21543 y Fv(In\257nite)425 b(Lo)35 b(op)0 23810 y Fn(If)477 b(y)-31 b(ou)478 b(think)h(y)-31 b(ou)478 b(ha)-31 b(v)g(e)478 b(an)g(in\257nite)h(lo)31 b(op)478 b(and)g(y)-31 b(ou)478 b(think)g(y)-31 b(ou)478 b(kno)-31 b(w)479 b(what)g(lo)31 b(op)478 b(is)0 25165 y(causing)376 b(the)f(problem,)j(add)d(a)g Fk(print)h Fn(statemen)-31 b(t)377 b(at)f(the)f(end)g(of)g(the)h(lo)31 b(op)376 b(that)g(prin)-31 b(ts)0 26520 y(the)369 b(v)-61 b(alues)370 b(of)f(the)h(v)-61 b(ariables)370 b(in)f(the)h(condition)h(and)e(the)h (v)-61 b(alue)369 b(of)h(the)g(condition.)0 28643 y(F)-92 b(or)368 b(example:)0 30848 y Fk(while)582 b(x)f(>)g(0)h(and)f(y)h(<)f (0)g(:)1162 32203 y(#)h(do)f(something)i(to)e(x)1162 33558 y(#)h(do)f(something)i(to)e(y)1162 36268 y(print)1163 b("x:)582 b(",)f(x)1162 37623 y(print)1163 b("y:)582 b(",)f(y)1162 38977 y(print)1163 b("condition:)583 b(",)f(\(x)f(>)g(0)h (and)f(y)h(<)f(0\))0 41182 y Fn(No)-31 b(w)509 b(when)e(y)-31 b(ou)509 b(run)d(the)i(program,)544 b(y)-31 b(ou)508 b(will)h(see)e(three)g(lines)h(of)g(output)h(for)e(eac)-31 b(h)0 42537 y(time)336 b(through)f(the)g(lo)31 b(op.)483 b(The)334 b(last)i(time)g(through)f(the)g(lo)31 b(op,)344 b(the)334 b(condition)j(should)e(b)31 b(e)0 43892 y Fk(false)p Fn(.)681 b(If)431 b(the)h(lo)31 b(op)433 b(k)-31 b(eeps)431 b(going,)449 b(y)-31 b(ou)433 b(will)g(b)31 b(e)431 b(able)i(to)f(see)f (the)h(v)-61 b(alues)432 b(of)g Fk(x)g Fn(and)f Fk(y)p Fn(,)0 45247 y(and)369 b(y)-31 b(ou)370 b(migh)-31 b(t)371 b(\257gure)e(out)h(wh)-31 b(y)370 b(they)g(are)f(not)h(b)31 b(eing)370 b(up)31 b(dated)369 b(correctly)-92 b(.)0 48903 y Fv(In\257nite)425 b(Recursion)0 51170 y Fn(Most)331 b(of)h(the)g(time,)341 b(an)331 b(in\257nite)i(recursion)e(will)i (cause)e(the)h(program)g(to)g(run)f(for)g(a)h(while)0 52525 y(and)369 b(then)h(pro)31 b(duce)369 b(a)g Fk(Maximum)582 b(recursion)h(depth)f(exceeded)370 b Fn(error.)0 54648 y(If)395 b(y)-31 b(ou)397 b(susp)31 b(ect)395 b(that)i(a)e(function)j (or)d(metho)31 b(d)397 b(is)e(causing)i(an)e(in\257nite)i(recursion,) 402 b(start)0 56003 y(b)-31 b(y)324 b(c)-31 b(hec)g(king)326 b(to)f(mak)-31 b(e)325 b(sure)e(that)j(there)e(is)g(a)g(base)g(case.) 478 b(In)323 b(other)i(w)-31 b(ords,)334 b(there)324 b(should)0 57358 y(b)31 b(e)492 b(some)i(condition)h(that)f(will)h (cause)e(the)g(function)h(or)f(metho)31 b(d)494 b(to)f(return)g (without)p eop %%Page: 223 249 223 248 bop 0 -2070 a Fv(A.2)425 b(Run)-35 b(time)424 b(errors)25360 b(223)p 0 -1627 38191 45 v 0 865 a Fn(making)413 b(a)e(recursiv)-31 b(e)411 b(in)-31 b(v)g(o)31 b(cation.)621 b(If)411 b(not,)423 b(then)411 b(y)-31 b(ou)412 b(need)f(to)g(rethink)h (the)f(algorithm)0 2220 y(and)369 b(iden)-31 b(tify)372 b(a)d(base)g(case.)0 4480 y(If)436 b(there)h(is)f(a)h(base)f(case)h (but)g(the)f(program)i(do)31 b(esn't)437 b(seem)f(to)i(b)31 b(e)436 b(reac)-31 b(hing)437 b(it,)455 b(add)437 b(a)0 5835 y Fk(print)490 b Fn(statemen)-31 b(t)491 b(at)f(the)g(b)31 b(eginning)491 b(of)f(the)f(function)i(or)e(metho)31 b(d)491 b(that)f(prin)-31 b(ts)490 b(the)0 7190 y(parameters.)h(No)-31 b(w)363 b(when)f(y)-31 b(ou)363 b(run)e(the)h(program,)j(y)-31 b(ou)362 b(will)i(see)d(a)i(few)f(lines)g(of)h(output)0 8544 y(ev)-31 b(ery)367 b(time)h(the)f(function)h(or)f(metho)31 b(d)367 b(is)g(in)-31 b(v)g(ok)g(ed,)370 b(and)d(y)-31 b(ou)367 b(will)i(see)d(the)h(parameters.)0 9899 y(If)357 b(the)g(parameters)h(are)f(not)h(mo)-31 b(ving)359 b(to)-31 b(w)g(ard)359 b(the)e(base)g(case,)j(y)-31 b(ou)358 b(will)h(get)f (some)g(ideas)0 11254 y(ab)31 b(out)370 b(wh)-31 b(y)370 b(not.)0 15252 y Fv(Flo)-35 b(w)424 b(of)h(Execution)0 17692 y Fn(If)371 b(y)-31 b(ou)372 b(are)f(not)i(sure)d(ho)-31 b(w)372 b(the)g(\260o)-31 b(w)372 b(of)g(execution)h(is)e(mo)-31 b(ving)374 b(through)e(y)-31 b(our)372 b(program,)0 19047 y(add)487 b Fk(print)f Fn(statemen)-31 b(ts)488 b(to)f(the)g(b)31 b(eginning)488 b(of)e(eac)-31 b(h)487 b(function)h(with)f(a)g(message)g (lik)-31 b(e)0 20402 y(\\en)g(tering)371 b(function)f Fk(foo)p Fn(,")h(where)e Fk(foo)g Fn(is)g(the)h(name)g(of)f(the)h (function.)0 22662 y(No)-31 b(w)437 b(when)f(y)-31 b(ou)436 b(run)f(the)h(program,)453 b(it)437 b(will)g(prin)-31 b(t)436 b(a)g(trace)g(of)g(eac)-31 b(h)436 b(function)h(as)f(it)g(is)0 24016 y(in)-31 b(v)g(ok)g(ed.)0 28240 y Fh(A.2.3)1495 b(When)499 b(I)e(run)i(the)g(program)h(I)d(get)i(an)g(exception.)0 30680 y Fn(If)323 b(something)i(go)31 b(es)324 b(wrong)g(during)f(run) -31 b(time,)334 b(Python)325 b(prin)-31 b(ts)324 b(a)f(message)h(that)h (includes)0 32035 y(the)g(name)g(of)g(the)g(exception,)335 b(the)325 b(line)g(of)g(the)g(program)g(where)f(the)h(problem)g(o)31 b(ccurred,)0 33390 y(and)369 b(a)h(tracebac)-31 b(k.)0 35650 y(The)471 b(tracebac)-31 b(k)472 b(iden)-31 b(ti\257es)472 b(the)f(function)h(that)h(is)d(curren)-31 b(tly)471 b(running,)497 b(and)472 b(then)f(the)0 37004 y(function)342 b(that)g(in)-31 b(v)g(ok)g(ed)343 b(it,)348 b(and)341 b(then)g(the)g(function)h(that)g (in)-31 b(v)g(ok)g(ed)343 b Fm(that)p Fn(,)j(and)341 b(so)g(on.)483 b(In)0 38359 y(other)448 b(w)-31 b(ords,)469 b(it)449 b(traces)f(the)g(path)h(of)f(function)i(in)-31 b(v)g(o)31 b(cations)451 b(that)e(got)g(y)-31 b(ou)449 b(to)g(where)0 39714 y(y)-31 b(ou)408 b(are.)605 b(It)407 b(also)g(includes)h(the)f(line)g(n)-31 b(um)g(b)31 b(er)407 b(in)g(y)-31 b(our)407 b(\257le)g(where)g(eac)-31 b(h)407 b(of)g(these)g(calls)0 41069 y(o)31 b(ccurs.)0 43329 y(The)379 b(\257rst)g(step)g(is)g(to)h(examine)g(the)f(place)h(in)g (the)f(program)h(where)f(the)g(error)f(o)31 b(ccurred)0 44684 y(and)527 b(see)f(if)h(y)-31 b(ou)528 b(can)f(\257gure)g(out)g (what)h(happ)31 b(ened.)965 b(These)527 b(are)g(some)g(of)g(the)g(most) 0 46039 y(common)371 b(run)-31 b(time)370 b(errors:)0 48867 y Fv(NameError:)555 b Fn(Y)-92 b(ou)342 b(are)g(trying)h(to)g (use)e(a)h(v)-61 b(ariable)343 b(that)g(do)31 b(esn't)343 b(exist)f(in)g(the)g(curren)-31 b(t)2767 50221 y(en)g(vironmen)g(t.)606 b(Remem)-31 b(b)31 b(er)407 b(that)g(lo)31 b(cal)408 b(v)-61 b(ariables)407 b(are)f(lo)31 b(cal.)606 b(Y)-92 b(ou)406 b(cannot)i(refer)2767 51576 y(to)370 b(them)g(from)g(outside)g (the)f(function)i(where)e(they)h(are)f(de\257ned.)0 53992 y Fv(T)-35 b(yp)35 b(eError:)555 b Fn(There)369 b(are)g(sev)-31 b(eral)369 b(p)31 b(ossible)370 b(causes:)4096 56003 y Fj(\262)554 b Fn(Y)-92 b(ou)270 b(are)h(trying)g(to)g(use)f(a)g(v)-61 b(alue)271 b(improp)31 b(erly)-92 b(.)461 b(Example:)445 b(indexing)271 b(a)g(string,)5203 57358 y(list,)370 b(or)f(tuple)h (with)h(something)g(other)e(than)h(an)f(in)-31 b(teger.)p eop %%Page: 224 250 224 249 bop 0 -2070 a Fv(224)30338 b(Debugging)p 0 -1627 38191 45 v 4096 865 a Fj(\262)554 b Fn(There)447 b(is)h(a)g(mismatc)-31 b(h)450 b(b)31 b(et)-31 b(w)g(een)449 b(the)f(items)h(in)f(a)g(format)h (string)g(and)f(the)5203 2220 y(items)326 b(passed)g(for)f(con)-31 b(v)g(ersion.)480 b(This)326 b(can)g(happ)31 b(en)325 b(if)i(either)f(the)g(n)-31 b(um)g(b)31 b(er)325 b(of)5203 3575 y(items)370 b(do)31 b(es)369 b(not)h(matc)-31 b(h)370 b(or)f(an)h(in)-31 b(v)-61 b(alid)370 b(con)-31 b(v)g(ersion)371 b(is)e(called)h(for.)4096 5278 y Fj(\262)554 b Fn(Y)-92 b(ou)502 b(are)h(passing)g(the)g(wrong)g(n)-31 b(um)g(b)31 b(er)502 b(of)h(argumen)-31 b(ts)504 b(to)f(a)g(function)h(or)5203 6633 y(metho)31 b(d.)493 b(F)-92 b(or)369 b(metho)31 b(ds,)370 b(lo)31 b(ok)370 b(at)g(the)g(metho)31 b(d)370 b(de\257nition)h(and)e(c)-31 b(hec)g(k)370 b(that)5203 7988 y(the)486 b(\257rst)f(parameter)i(is)e Fk(self)p Fn(.)843 b(Then)486 b(lo)31 b(ok)487 b(at)g(the)f(metho)31 b(d)486 b(in)-31 b(v)g(o)31 b(cation;)5203 9343 y(mak)-31 b(e)394 b(sure)e(y)-31 b(ou)394 b(are)e(in)-31 b(v)g(oking)396 b(the)d(metho)31 b(d)394 b(on)g(an)f(ob)61 b(ject)394 b(with)h(the)e(righ)-31 b(t)5203 10697 y(t)g(yp)31 b(e)369 b(and)h(pro)-31 b(viding)371 b(the)e(other)h(argumen)-31 b(ts)370 b(correctly)-92 b(.)0 12843 y Fv(KeyError:)555 b Fn(Y)-92 b(ou)488 b(are)f(trying)i(to)g(access)e(an)h(elemen)-31 b(t)489 b(of)g(a)f(dictionary)h(using)f(a)g(k)-31 b(ey)2767 14198 y(v)-61 b(alue)370 b(that)g(the)g(dictionary)h(do)31 b(es)369 b(not)h(con)-31 b(tain.)0 16343 y Fv(A)c(ttributeError:)556 b Fn(Y)-92 b(ou)448 b(are)f(trying)h(to)h(access)e(an)g(attribute)j(or) d(metho)31 b(d)449 b(that)f(do)31 b(es)2767 17698 y(not)370 b(exist.)0 19844 y Fv(IndexError:)555 b Fn(The)302 b(index)g(y)-31 b(ou)302 b(are)f(using)h(to)g(access)f(a)h(list,)316 b(string,)g(or)301 b(tuple)h(is)g(greater)2767 21199 y(than)411 b(its)g(length)g(min)-31 b(us)411 b(one.)616 b(Immediately)413 b(b)31 b(efore)410 b(the)g(site)h(of)f(the)h(error,) 420 b(add)2767 22554 y(a)357 b Fk(print)g Fn(statemen)-31 b(t)358 b(to)f(displa)-31 b(y)357 b(the)g(v)-61 b(alue)357 b(of)f(the)h(index)g(and)f(the)h(length)g(of)g(the)2767 23909 y(arra)-31 b(y)-92 b(.)493 b(Is)369 b(the)g(arra)-31 b(y)370 b(the)f(righ)-31 b(t)370 b(size?)492 b(Is)368 b(the)i(index)f(the)h(righ)-31 b(t)370 b(v)-61 b(alue?)0 27706 y Fh(A.2.4)1495 b(I)545 b(added)g(so)g(man)-42 b(y)546 b Fa(print)c Fh(statemen)-42 b(ts)547 b(I)d(get)h(in)-42 b(undated)4947 29286 y(with)499 b(output.)0 31492 y Fn(One)325 b(of)g(the)g(problems)h(with)g(using)f Fk(print)h Fn(statemen)-31 b(ts)326 b(for)f(debugging)i(is)e(that)h(y)-31 b(ou)326 b(can)0 32847 y(end)410 b(up)f(buried)h(in)g(output.)616 b(There)410 b(are)g(t)-31 b(w)g(o)411 b(w)-31 b(a)g(ys)411 b(to)g(pro)31 b(ceed:)574 b(simplify)412 b(the)e(output)0 34202 y(or)369 b(simplify)i(the)e(program.)0 36265 y(T)-92 b(o)552 b(simplify)h(the)f(output,)599 b(y)-31 b(ou)552 b(can)g(remo)-31 b(v)g(e)552 b(or)g(commen)-31 b(t)553 b(out)f Fk(print)g Fn(statemen)-31 b(ts)0 37620 y(that)470 b(aren't)f(helping,)495 b(or)469 b(com)-31 b(bine)470 b(them,)495 b(or)468 b(format)i(the)f(output)h(so)f(it)g(is)g(easier)f (to)0 38975 y(understand.)0 41038 y(T)-92 b(o)351 b(simplify)i(the)e (program,)356 b(there)351 b(are)f(sev)-31 b(eral)352 b(things)g(y)-31 b(ou)351 b(can)g(do.)487 b(First,)355 b(scale)c(do)-31 b(wn)0 42393 y(the)495 b(problem)h(the)f(program)h(is) f(w)-31 b(orking)497 b(on.)870 b(F)-92 b(or)494 b(example,)529 b(if)495 b(y)-31 b(ou)496 b(are)f(sorting)h(an)0 43748 y(arra)-31 b(y)-92 b(,)402 b(sort)395 b(a)g Fm(smal)57 b(l)394 b Fn(arra)-31 b(y)-92 b(.)570 b(If)395 b(the)g(program)h(tak) -31 b(es)396 b(input)g(from)f(the)h(user,)401 b(giv)-31 b(e)396 b(it)g(the)0 45103 y(simplest)370 b(input)g(that)g(causes)f (the)h(problem.)0 47166 y(Second,)384 b(clean)d(up)g(the)f(program.)528 b(Remo)-31 b(v)g(e)382 b(dead)f(co)31 b(de)380 b(and)h(reorganize)g (the)g(program)0 48521 y(to)468 b(mak)-31 b(e)468 b(it)g(as)f(easy)g (to)h(read)f(as)g(p)31 b(ossible.)786 b(F)-92 b(or)466 b(example,)494 b(if)467 b(y)-31 b(ou)468 b(susp)31 b(ect)466 b(that)j(the)0 49875 y(problem)356 b(is)f(in)h(a)g(deeply)f(nested)h (part)f(of)h(the)g(program,)j(try)d(rewriting)g(that)h(part)f(with)0 51230 y(simpler)422 b(structure.)649 b(If)421 b(y)-31 b(ou)422 b(susp)31 b(ect)421 b(a)g(large)h(function,)437 b(try)421 b(splitting)j(it)e(in)-31 b(to)423 b(smaller)0 52585 y(functions)370 b(and)g(testing)g(them)g(separately)-92 b(.)0 54648 y(Often)377 b(the)f(pro)31 b(cess)375 b(of)i(\257nding)g (the)f(minimal)j(test)e(case)f(leads)h(y)-31 b(ou)377 b(to)g(the)f(bug.)514 b(If)376 b(y)-31 b(ou)0 56003 y(\257nd)350 b(that)i(a)f(program)g(w)-31 b(orks)351 b(in)g(one)f(situation)j(but)e (not)g(in)g(another,)k(that)d(giv)-31 b(es)351 b(y)-31 b(ou)352 b(a)0 57358 y(clue)369 b(ab)31 b(out)371 b(what)f(is)f(going)i (on.)p eop %%Page: 225 251 225 250 bop 0 -2070 a Fv(A.3)425 b(Seman)-35 b(tic)424 b(errors)25130 b(225)p 0 -1627 38191 45 v 0 865 a Fn(Similarly)-92 b(,)394 b(rewriting)388 b(a)f(piece)g(of)g(co)31 b(de)387 b(can)g(help)g(y)-31 b(ou)388 b(\257nd)e(subtle)h(bugs.)546 b(If)386 b(y)-31 b(ou)388 b(mak)-31 b(e)0 2220 y(a)430 b(c)-31 b(hange)430 b(that)h(y)-31 b(ou)430 b(think)g(do)31 b(esn't)430 b(a\256ect)g(the)g(program,)445 b(and)430 b(it)g(do)31 b(es,)445 b(that)431 b(can)e(tip)0 3575 y(y)-31 b(ou)370 b(o\256.)0 8418 y Fl(A.3)1793 b(Seman)-50 b(tic)600 b(errors)0 11072 y Fn(In)413 b(some)i(w)-31 b(a)g(ys,)427 b(seman)-31 b(tic)415 b(errors)e(are)g(the)i(hardest)e (to)i(debug,)426 b(b)31 b(ecause)413 b(the)i(compiler)0 12427 y(and)331 b(the)h(run)-31 b(time)332 b(system)g(pro)-31 b(vide)331 b(no)h(information)i(ab)31 b(out)332 b(what)h(is)e(wrong.) 481 b(Only)331 b(y)-31 b(ou)0 13782 y(kno)g(w)298 b(what)f(the)g (program)g(is)g(supp)31 b(osed)295 b(to)j(do,)311 b(and)297 b(only)h(y)-31 b(ou)297 b(kno)-31 b(w)297 b(that)h(it)f(isn't)h(doing)0 15136 y(it.)0 17412 y(The)251 b(\257rst)f(step)g(is)h(to)g(mak)-31 b(e)252 b(a)f(connection)h(b)31 b(et)-31 b(w)g(een)252 b(the)e(program)i(text)f(and)g(the)g(b)31 b(eha)-31 b(vior)0 18767 y(y)g(ou)270 b(are)f(seeing.)460 b(Y)-92 b(ou)269 b(need)g(a)h(h)-31 b(yp)31 b(othesis)269 b(ab)31 b(out)271 b(what)f(the)f(program)h(is)g(actually)h(doing.)0 20122 y(One)369 b(of)h(the)f(things)h(that)h(mak)-31 b(es)370 b(that)g(hard)f(is)g(that)h(computers)g(run)f(so)g(fast.)0 22398 y(Y)-92 b(ou)312 b(will)h(often)g(wish)f(that)h(y)-31 b(ou)312 b(could)h(slo)-31 b(w)313 b(the)f(program)g(do)-31 b(wn)313 b(to)f(h)-31 b(uman)313 b(sp)31 b(eed,)323 b(and)0 23753 y(with)365 b(some)e(debuggers)h(y)-31 b(ou)364 b(can.)491 b(But)364 b(the)f(time)i(it)f(tak)-31 b(es)364 b(to)h(insert)e(a)h(few)g(w)-31 b(ell-placed)0 25108 y Fk(print)352 b Fn(statemen)-31 b(ts)354 b(is)e(often)g(short)g (compared)h(to)f(setting)h(up)f(the)g(debugger,)k(inserting)0 26463 y(and)489 b(remo)-31 b(ving)491 b(breakp)31 b(oin)-31 b(ts,)520 b(and)489 b(\\w)-31 b(alking")493 b(the)c(program)h(to)f (where)g(the)g(error)f(is)0 27818 y(o)31 b(ccurring.)0 32090 y Fh(A.3.1)1495 b(My)498 b(program)i(do)42 b(esn't)499 b(w)-42 b(ork.)0 34553 y Fn(Y)-92 b(ou)369 b(should)h(ask)f(y)-31 b(ourself)370 b(these)f(questions:)1660 37412 y Fj(\262)554 b Fn(Is)485 b(there)g(something)i(the)e(program)h(w)-31 b(as)486 b(supp)31 b(osed)484 b(to)i(do)g(but)f(whic)-31 b(h)486 b(do)31 b(esn't)2767 38767 y(seem)428 b(to)h(b)31 b(e)427 b(happ)31 b(ening?)669 b(Find)427 b(the)h(section)h(of)f(the)h (co)31 b(de)427 b(that)i(p)31 b(erforms)428 b(that)2767 40122 y(function)371 b(and)e(mak)-31 b(e)371 b(sure)d(it)i(is)f (executing)i(when)e(y)-31 b(ou)370 b(think)g(it)g(should.)1660 42568 y Fj(\262)554 b Fn(Is)383 b(something)i(happ)31 b(ening)385 b(that)g(shouldn't?)536 b(Find)383 b(co)31 b(de)384 b(in)g(y)-31 b(our)383 b(program)i(that)2767 43923 y(p)31 b(erforms)369 b(that)h(function)h(and)e(see)g(if)h(it)g (is)f(executing)h(when)g(it)g(shouldn't.)1660 46369 y Fj(\262)554 b Fn(Is)448 b(a)g(section)h(of)f(co)31 b(de)448 b(pro)31 b(ducing)448 b(an)h(e\256ect)e(that)j(is)d(not)i(what)g(y)-31 b(ou)449 b(exp)31 b(ected?)2767 47724 y(Mak)-31 b(e)448 b(sure)e(that)i(y)-31 b(ou)448 b(understand)f(the)g(co)31 b(de)447 b(in)g(question,)468 b(esp)31 b(ecially)448 b(if)g(it)g(in-)2767 49079 y(v)-31 b(olv)g(es)271 b(in)-31 b(v)g(o)31 b(cations)273 b(to)d(functions)h(or)f(metho)31 b(ds)270 b(in)g(other)g(Python)h(mo)31 b(dules.)460 b(Read)2767 50434 y(the)348 b(do)31 b(cumen)-31 b(tation)349 b(for)e(the)g (functions)h(y)-31 b(ou)348 b(in)-31 b(v)g(ok)g(e.)487 b(T)-92 b(ry)347 b(them)g(out)h(b)-31 b(y)347 b(writing)2767 51789 y(simple)370 b(test)g(cases)f(and)g(c)-31 b(hec)g(king)371 b(the)e(results.)0 54648 y(In)388 b(order)h(to)g(program,)395 b(y)-31 b(ou)390 b(need)e(to)i(ha)-31 b(v)g(e)390 b(a)f(men)-31 b(tal)390 b(mo)31 b(del)390 b(of)g(ho)-31 b(w)389 b(programs)h(w)-31 b(ork.)0 56003 y(If)316 b(y)-31 b(ou)317 b(write)g(a)g(program)g(that)h (do)31 b(esn't)317 b(do)f(what)i(y)-31 b(ou)317 b(exp)31 b(ect,)328 b(v)-31 b(ery)316 b(often)i(the)e(problem)0 57358 y(is)369 b(not)h(in)f(the)h(program;)g(it's)h(in)e(y)-31 b(our)369 b(men)-31 b(tal)372 b(mo)31 b(del.)p eop %%Page: 226 252 226 251 bop 0 -2070 a Fv(226)30338 b(Debugging)p 0 -1627 38191 45 v 0 865 a Fn(The)477 b(b)31 b(est)476 b(w)-31 b(a)g(y)477 b(to)h(correct)e(y)-31 b(our)476 b(men)-31 b(tal)479 b(mo)31 b(del)477 b(is)f(to)h(break)g(the)f(program)i(in)-31 b(to)478 b(its)0 2220 y(comp)31 b(onen)-31 b(ts)410 b(\(usually)h(the)f (functions)g(and)f(metho)31 b(ds\))410 b(and)g(test)f(eac)-31 b(h)410 b(comp)31 b(onen)-31 b(t)411 b(in-)0 3575 y(dep)31 b(enden)-31 b(tly)-92 b(.)751 b(Once)455 b(y)-31 b(ou)455 b(\257nd)g(the)g(discrepancy)g(b)31 b(et)-31 b(w)g(een)456 b(y)-31 b(our)456 b(mo)31 b(del)456 b(and)f(realit)-31 b(y)-92 b(,)0 4930 y(y)-31 b(ou)370 b(can)f(solv)-31 b(e)370 b(the)g(problem.)0 6932 y(Of)422 b(course,)434 b(y)-31 b(ou)423 b(should)f(b)31 b(e)421 b(building)i(and)f(testing)h (comp)31 b(onen)-31 b(ts)423 b(as)e(y)-31 b(ou)423 b(dev)-31 b(elop)423 b(the)0 8286 y(program.)591 b(If)401 b(y)-31 b(ou)403 b(encoun)-31 b(ter)402 b(a)g(problem,)411 b(there)401 b(should)h(b)31 b(e)401 b(only)i(a)f(small)h(amoun)-31 b(t)403 b(of)0 9641 y(new)369 b(co)31 b(de)370 b(that)g(is)f(not)h(kno) -31 b(wn)370 b(to)g(b)31 b(e)369 b(correct.)0 13352 y Fh(A.3.2)1495 b(I'v)-42 b(e)693 b(got)g(a)g(big)h(hairy)f(expression)i (and)e(it)g(do)42 b(esn't)694 b(do)4947 14933 y(what)500 b(I)d(exp)42 b(ect.)0 17078 y Fn(W)-92 b(riting)403 b(complex)h (expressions)e(is)h(\257ne)f(as)h(long)h(as)e(they)h(are)g(readable,) 412 b(but)403 b(they)g(can)0 18433 y(b)31 b(e)379 b(hard)h(to)g(debug.) 524 b(It)380 b(is)f(often)i(a)f(go)31 b(o)g(d)380 b(idea)g(to)h(break)e (a)h(complex)h(expression)f(in)-31 b(to)381 b(a)0 19788 y(series)368 b(of)i(assignmen)-31 b(ts)370 b(to)g(temp)31 b(orary)370 b(v)-61 b(ariables.)0 21789 y(F)-92 b(or)368 b(example:)0 23872 y Fk(self.hands[i].addCard)584 b (\(self.hands[self.findNeighbor\(i\)].popCard\(\)\))0 25955 y Fn(This)370 b(can)f(b)31 b(e)369 b(rewritten)h(as:)0 28037 y Fk(neighbor)582 b(=)g(self.findNeighbor)h(\(i\))0 29392 y(pickedCard)g(=)e(self.hands[neighbor].popCard\(\))0 30747 y(self.hands[i].addCard)j(\(pickedCard\))0 32830 y Fn(The)394 b(explicit)h(v)-31 b(ersion)394 b(is)g(easier)f(to)h(read) g(b)31 b(ecause)393 b(the)h(v)-61 b(ariable)394 b(names)g(pro)-31 b(vide)394 b(addi-)0 34185 y(tional)328 b(do)31 b(cumen)-31 b(tation,)339 b(and)326 b(it)h(is)f(easier)g(to)h(debug)g(b)31 b(ecause)325 b(y)-31 b(ou)327 b(can)g(c)-31 b(hec)g(k)326 b(the)h(t)-31 b(yp)31 b(es)0 35540 y(of)370 b(the)f(in)-31 b(termediate)372 b(v)-61 b(ariables)370 b(and)f(displa)-31 b(y)371 b(their)e(v)-61 b(alues.)0 37541 y(Another)383 b(problem)g(that)h(can)e(o)31 b(ccur)382 b(with)i(big)f(expressions)f (is)g(that)i(the)f(order)f(of)g(ev)-61 b(al-)0 38896 y(uation)460 b(ma)-31 b(y)459 b(not)f(b)31 b(e)458 b(what)h(y)-31 b(ou)459 b(exp)31 b(ect.)759 b(F)-92 b(or)457 b(example,)482 b(if)458 b(y)-31 b(ou)459 b(are)e(translating)k(the)0 40251 y(expression)5710 39815 y Fc(x)p 5468 39996 987 45 v 5468 40633 a Ff(2)p Fc(\274)6956 40251 y Fn(in)-31 b(to)371 b(Python,)g(y)-31 b(ou)370 b(migh)-31 b(t)371 b(write:)0 42334 y Fk(y)581 b(=)h(x)f(/)g(2)g(*)h(math.pi;)0 44417 y Fn(That)256 b(is)e(not)h(correct)f(b)31 b(ecause)254 b(m)-31 b(ultiplication)259 b(and)254 b(division)i(ha)-31 b(v)g(e)256 b(the)e(same)h(precedence)0 45771 y(and)369 b(are)g(ev)-61 b(aluated)371 b(from)f(left)g(to)g(righ)-31 b(t.)494 b(So)369 b(this)h(expression)f(computes)h Fg(x\274)40 b(=)p Fn(2.)0 47773 y(A)451 b(go)31 b(o)g(d)452 b(w)-31 b(a)g(y)453 b(to)f(debug)g(expressions)e(is)i(to)g(add)f(paren)-31 b(theses)451 b(to)i(mak)-31 b(e)452 b(the)g(order)e(of)0 49128 y(ev)-61 b(aluation)372 b(explicit:)581 51211 y Fk(y)581 b(=)h(x)f(/)g(\(2)h(*)f(math.pi\);)0 53293 y Fn(Whenev)-31 b(er)486 b(y)-31 b(ou)488 b(are)f(not)h(sure)e(of)h(the)g (order)g(of)g(ev)-61 b(aluation,)520 b(use)486 b(paren)-31 b(theses.)846 b(Not)0 54648 y(only)407 b(will)h(the)f(program)g(b)31 b(e)406 b(correct)g(\(in)h(the)f(sense)g(of)h(doing)g(what)h(y)-31 b(ou)407 b(in)-31 b(tended\),)417 b(it)0 56003 y(will)357 b(also)f(b)31 b(e)354 b(more)h(readable)h(for)f(other)g(p)31 b(eople)356 b(who)g(ha)-31 b(v)g(en't)357 b(memorized)f(the)f(rules)f (of)0 57358 y(precedence.)p eop %%Page: 227 253 227 252 bop 0 -2070 a Fv(A.3)425 b(Seman)-35 b(tic)424 b(errors)25130 b(227)p 0 -1627 38191 45 v 0 865 a Fh(A.3.3)1495 b(I'v)-42 b(e)599 b(got)g(a)g(function)h(or)f(metho)42 b(d)600 b(that)f(do)42 b(esn't)600 b(return)4947 2446 y(what)500 b(I)d(exp)42 b(ect.)0 4851 y Fn(If)527 b(y)-31 b(ou)528 b(ha)-31 b(v)g(e)528 b(a)f Fk(return)h Fn(statemen)-31 b(t)529 b(with)f(a)g(complex)g(expression,)567 b(y)-31 b(ou)528 b(don't)g(ha)-31 b(v)g(e)0 6206 y(a)515 b(c)-31 b(hance)514 b(to)i(prin)-31 b(t)514 b(the)h Fk(return)g Fn(v)-61 b(alue)515 b(b)31 b(efore)514 b(returning.)929 b(Again,)552 b(y)-31 b(ou)515 b(can)g(use)f(a)0 7560 y(temp)31 b(orary)370 b(v)-61 b(ariable.)494 b(F)-92 b(or)368 b(example,)j(instead)f(of:)0 9876 y Fk(return)582 b(self.hands[i].removeMatches\(\))0 12191 y Fn(y)-31 b(ou)370 b(could)g(write:)0 14506 y Fk(count)582 b(=)f (self.hands[i].removeMatches\(\))0 15861 y(return)h(count)0 18176 y Fn(No)-31 b(w)370 b(y)-31 b(ou)370 b(ha)-31 b(v)g(e)371 b(the)e(opp)31 b(ortunit)-31 b(y)371 b(to)f(displa)-31 b(y)371 b(the)e(v)-61 b(alue)370 b(of)f Fk(count)h Fn(b)31 b(efore)369 b(returning.)0 22323 y Fh(A.3.4)1495 b(I'm)499 b(really)-125 b(,)499 b(really)g(stuc)-42 b(k)499 b(and)g(I)f(need)g (help.)0 24728 y Fn(First,)402 b(try)396 b(getting)i(a)-31 b(w)g(a)g(y)398 b(from)e(the)g(computer)h(for)f(a)g(few)g(min)-31 b(utes.)573 b(Computers)397 b(emit)0 26083 y(w)-31 b(a)g(v)g(es)371 b(that)f(a\256ect)g(the)f(brain,)h(causing)g(these)f(e\256ects:)1660 28862 y Fj(\262)554 b Fn(F)-92 b(rustration)370 b(and/or)g(rage.)1660 31230 y Fj(\262)554 b Fn(Sup)31 b(erstitious)574 b(b)31 b(eliefs)573 b(\(\\the)h(computer)g(hates)f(me"\))h(and)f(magical)j (thinking)2767 32585 y(\(\\the)371 b(program)f(only)g(w)-31 b(orks)370 b(when)f(I)g(w)-31 b(ear)369 b(m)-31 b(y)370 b(hat)g(bac)-31 b(kw)g(ard"\).)1660 34954 y Fj(\262)554 b Fn(Random-w)-31 b(alk)534 b(programming)e(\(the)f(attempt)h(to)f (program)g(b)-31 b(y)531 b(writing)h(ev)-31 b(ery)2767 36309 y(p)31 b(ossible)370 b(program)g(and)f(c)-31 b(ho)31 b(osing)371 b(the)e(one)h(that)g(do)31 b(es)369 b(the)g(righ)-31 b(t)370 b(thing\).)0 39088 y(If)402 b(y)-31 b(ou)404 b(\257nd)e(y)-31 b(ourself)404 b(su\256ering)e(from)h(an)-31 b(y)403 b(of)h(these)e(symptoms,)413 b(get)403 b(up)g(and)f(go)i(for)f (a)0 40443 y(w)-31 b(alk.)569 b(When)393 b(y)-31 b(ou)395 b(are)f(calm,)401 b(think)395 b(ab)31 b(out)395 b(the)f(program.)568 b(What)394 b(is)g(it)h(doing?)567 b(What)0 41798 y(are)401 b(some)g(p)31 b(ossible)401 b(causes)f(of)h(that)h(b)31 b(eha)-31 b(vior?)587 b(When)400 b(w)-31 b(as)402 b(the)f(last)g(time)h (y)-31 b(ou)402 b(had)f(a)0 43153 y(w)-31 b(orking)371 b(program,)f(and)g(what)g(did)g(y)-31 b(ou)370 b(do)f(next?)0 45387 y(Sometimes)454 b(it)g(just)e(tak)-31 b(es)454 b(time)g(to)f(\257nd)f(a)h(bug.)743 b(W)-92 b(e)452 b(often)h(\257nd)g (bugs)f(when)h(w)-31 b(e)453 b(are)0 46742 y(a)-31 b(w)g(a)g(y)369 b(from)f(the)f(computer)g(and)g(let)h(our)f(minds)g(w)-31 b(ander.)492 b(Some)368 b(of)f(the)g(b)31 b(est)367 b(places)g(to)0 48097 y(\257nd)i(bugs)g(are)g(trains,)h(sho)-31 b(w)g(ers,)370 b(and)f(in)h(b)31 b(ed,)369 b(just)g(b)31 b(efore)369 b(y)-31 b(ou)370 b(fall)h(asleep.)0 52244 y Fh(A.3.5)1495 b(No,)499 b(I)f(really)h(need)f(help.)0 54648 y Fn(It)351 b(happ)31 b(ens.)487 b(Ev)-31 b(en)352 b(the)f(b)31 b(est)352 b(programmers)f(o)31 b(ccasionally)355 b(get)d(stuc)-31 b(k.)487 b(Sometimes)353 b(y)-31 b(ou)0 56003 y(w)g(ork)382 b(on)f(a)g(program)g(so)g(long)h(that)g(y)-31 b(ou)382 b(can't)g(see)e(the)h(error.)527 b(A)381 b(fresh)f(pair)h(of)g(ey)-31 b(es)381 b(is)0 57358 y(just)369 b(the)h(thing.)p eop %%Page: 228 254 228 253 bop 0 -2070 a Fv(228)30338 b(Debugging)p 0 -1627 38191 45 v 0 865 a Fn(Before)333 b(y)-31 b(ou)334 b(bring)g(someone)g (else)f(in,)341 b(mak)-31 b(e)335 b(sure)d(y)-31 b(ou)334 b(ha)-31 b(v)g(e)334 b(exhausted)g(the)f(tec)-31 b(hniques)0 2220 y(describ)31 b(ed)388 b(here.)549 b(Y)-92 b(our)388 b(program)h(should)g(b)31 b(e)388 b(as)g(simple)i(as)e(p)31 b(ossible,)394 b(and)388 b(y)-31 b(ou)390 b(should)0 3575 y(b)31 b(e)349 b(w)-31 b(orking)351 b(on)f(the)g(smallest)h(input) f(that)h(causes)e(the)g(error.)485 b(Y)-92 b(ou)350 b(should)g(ha)-31 b(v)g(e)350 b Fk(print)0 4930 y Fn(statemen)-31 b(ts)435 b(in)e(the)h(appropriate)g(places)g(\(and)g(the)f(output)i(they)e(pro) 31 b(duce)433 b(should)g(b)31 b(e)0 6285 y(comprehensible\).)618 b(Y)-92 b(ou)411 b(should)g(understand)f(the)h(problem)g(w)-31 b(ell)412 b(enough)f(to)h(describ)31 b(e)0 7640 y(it)370 b(concisely)-92 b(.)0 9805 y(When)358 b(y)-31 b(ou)360 b(bring)f(someone)g(in)g(to)h(help,)h(b)31 b(e)358 b(sure)g(to)h(giv) -31 b(e)360 b(them)g(the)f(information)i(they)0 11160 y(need:)1660 13805 y Fj(\262)554 b Fn(If)337 b(there)f(is)h(an)f(error) g(message,)344 b(what)338 b(is)e(it)i(and)e(what)i(part)f(of)g(the)g (program)g(do)31 b(es)2767 15160 y(it)370 b(indicate?)1660 17401 y Fj(\262)554 b Fn(What)416 b(w)-31 b(as)415 b(the)g(last)g (thing)h(y)-31 b(ou)415 b(did)g(b)31 b(efore)415 b(this)g(error)e(o)31 b(ccurred?)628 b(What)415 b(w)-31 b(ere)2767 18756 y(the)452 b(last)g(lines)g(of)g(co)31 b(de)452 b(that)g(y)-31 b(ou)453 b(wrote,)473 b(or)451 b(what)i(is)e(the)h(new)g(test)f(case)h(that)2767 20111 y(fails?)1660 22351 y Fj(\262)554 b Fn(What)370 b(ha)-31 b(v)g(e)370 b(y)-31 b(ou)370 b(tried)g(so)f(far,)g(and)h(what) g(ha)-31 b(v)g(e)370 b(y)-31 b(ou)370 b(learned?)0 24997 y(When)323 b(y)-31 b(ou)323 b(\257nd)g(the)g(bug,)333 b(tak)-31 b(e)325 b(a)e(second)g(to)h(think)g(ab)31 b(out)324 b(what)g(y)-31 b(ou)324 b(could)g(ha)-31 b(v)g(e)324 b(done)0 26352 y(to)397 b(\257nd)e(it)i(faster.)573 b(Next)397 b(time)g(y)-31 b(ou)397 b(see)e(something)j(similar,)404 b(y)-31 b(ou)397 b(will)g(b)31 b(e)396 b(able)h(to)f(\257nd)0 27707 y(the)369 b(bug)h(more)f(quic)-31 b(kly)-92 b(.)0 29872 y(Remem)-31 b(b)31 b(er,)348 b(the)342 b(goal)h(is)f(not)h(just)e (to)i(mak)-31 b(e)343 b(the)f(program)h(w)-31 b(ork.)484 b(The)342 b(goal)h(is)f(to)h(learn)0 31227 y(ho)-31 b(w)370 b(to)g(mak)-31 b(e)371 b(the)e(program)h(w)-31 b(ork.)p eop %%Page: 229 255 229 254 bop 0 13863 a Fi(App)72 b(endix)862 b(B)0 24105 y Fo(Creating)1033 b(a)g(new)f(data)i(t)-86 b(yp)86 b(e)0 34528 y Fn(Ob)61 b(ject-orien)-31 b(ted)340 b(programming)g(languages)g (allo)-31 b(w)341 b(programmers)d(to)h(create)f(new)h(data)0 35883 y(t)-31 b(yp)31 b(es)338 b(that)g(b)31 b(eha)-31 b(v)g(e)338 b(m)-31 b(uc)g(h)338 b(lik)-31 b(e)339 b(built-in)g(data)g (t)-31 b(yp)31 b(es.)482 b(W)-92 b(e)337 b(will)i(explore)f(this)g (capabilit)-31 b(y)0 37238 y(b)g(y)467 b(building)h(a)e Fk(Fraction)h Fn(class)g(that)g(w)-31 b(orks)467 b(v)-31 b(ery)466 b(m)-31 b(uc)g(h)467 b(lik)-31 b(e)468 b(the)e(built-in)i(n) -31 b(umeric)0 38593 y(t)g(yp)31 b(es,)370 b(in)-31 b(tegers,)370 b(longs,)h(and)e(\260oats.)0 44588 y(F)-92 b(ractions,)374 b(also)g(kno)-31 b(wn)374 b(as)e(rational)j(n)-31 b(um)g(b)31 b(ers,)374 b(are)e(v)-61 b(alues)373 b(that)h(can)e(b)31 b(e)373 b(expressed)e(as)0 45943 y(a)345 b(ratio)i(of)e(whole)i(n)-31 b(um)g(b)31 b(ers,)350 b(suc)-31 b(h)344 b(as)h(5)p Fg(=)p Fn(6.)486 b(The)345 b(top)h(n)-31 b(um)g(b)31 b(er)345 b(is)g(called)i(the)e(n)-31 b(umerator)0 47298 y(and)369 b(the)h(b)31 b(ottom)371 b(n)-31 b(um)g(b)31 b(er)369 b(is)g(called)i(the)e(denominator.)0 53293 y(W)-92 b(e)407 b(start)h(b)-31 b(y)408 b(de\257ning)g(a)g Fk(Fraction)h Fn(class)e(with)i(an)f(initialization)413 b(metho)31 b(d)408 b(that)h(pro-)0 54648 y(vides)369 b(the)h(n)-31 b(umerator)370 b(and)f(denominator)j(as)d(in)-31 b(tegers:)p eop %%Page: 230 256 230 255 bop 0 -2070 a Fv(230)22020 b(Creating)426 b(a)e(new)h(data)g(t) -35 b(yp)35 b(e)p 0 -1627 38191 45 v 0 865 a Fk(class)582 b(Fraction:)1162 2220 y(def)g(__init__\(self,)h(numerator,)g (denominator=1\):)2325 3575 y(self.numerator)g(=)e(numerator)2325 4930 y(self.denominator)i(=)e(denominator)0 7081 y Fn(The)534 b(denominator)i(is)d(optional.)989 b(A)533 b(F)-92 b(raction)534 b(with)h(just)f(one)g(just)f(one)h(parameter)0 8436 y(represen)-31 b(ts)368 b(a)h(whole)i(n)-31 b(um)g(b)31 b(er.)493 b(If)369 b(the)g(n)-31 b(umerator)370 b(is)f Fg(n)p Fn(,)h(w)-31 b(e)370 b(build)g(the)f(F)-92 b(raction)370 b Fg(n=)p Fn(1.)0 10507 y(The)332 b(next)g(step)f(is)h(to)g(write)h(a)p 13136 10507 349 45 v 13555 10507 V 1168 w Fk(str)p 15716 10507 V 16135 10507 V 1169 w Fn(metho)31 b(d)333 b(that)g(displa)-31 b(ys)332 b(fractions)h(in)f(a)g(w)-31 b(a)g(y)333 b(that)0 11862 y(mak)-31 b(es)370 b(sense.)492 b(The)369 b(form)h(\\n)-31 b(umerator/denominator")374 b(is)369 b(natural)h(here:)0 14013 y Fk(class)582 b(Fraction:)1162 15368 y(...)1162 16723 y(def)g(__str__\(self\):)2325 18078 y(return)g("\045d/\045d")g (\045)f(\(self.numerator,)j(self.denominator\))0 20229 y Fn(T)-92 b(o)341 b(test)h(what)g(w)-31 b(e)341 b(ha)-31 b(v)g(e)342 b(so)f(far,)347 b(w)-31 b(e)342 b(put)f(it)h(in)f(a)g (\257le)h(named)f Fk(Fraction.py)i Fn(and)e(imp)31 b(ort)0 21584 y(it)370 b(in)-31 b(to)371 b(the)e(Python)i(in)-31 b(terpreter.)492 b(Then)370 b(w)-31 b(e)369 b(create)h(a)f(fraction)i (ob)61 b(ject)371 b(and)e(prin)-31 b(t)370 b(it.)0 23736 y Fk(>>>)582 b(from)f(Fraction)i(import)f(Fraction)0 25091 y(>>>)g(spam)f(=)h(Fraction\(5,6\))0 26446 y(>>>)g(print)f("The)h (fraction)h(is",)e(spam)0 27801 y(The)h(fraction)g(is)f(5/6)0 29952 y Fn(As)369 b(usual,)h(the)f Fk(print)h Fn(command)h(in)-31 b(v)g(ok)g(es)371 b(the)p 20890 29952 V 21308 29952 V 1206 w Fk(str)p 23470 29952 V 23889 29952 V 1206 w Fn(metho)31 b(d)370 b(implicitly)-92 b(.)0 34330 y Fl(B.1)1793 b(F)-149 b(raction)598 b(m)-50 b(ultiplication)0 36734 y Fn(W)-92 b(e)431 b(w)-31 b(ould)434 b(lik)-31 b(e)433 b(to)g(b)31 b(e)432 b(able)h(to)g(apply)g(the)f(normal)i(addition,)450 b(subtraction,)g(m)-31 b(ultipli-)0 38089 y(cation,)490 b(and)465 b(division)h(op)31 b(erations)466 b(to)f(fractions.)779 b(T)-92 b(o)465 b(do)g(this,)489 b(w)-31 b(e)465 b(can)f(o)-31 b(v)g(erload)467 b(the)0 39444 y(mathematical)373 b(op)31 b(erators)370 b(for)f Fk(Fraction)h Fn(ob)61 b(jects.)0 41514 y(W)-92 b(e'll)392 b(start)f(with)h(m)-31 b(ultiplication)396 b(b)31 b(ecause)390 b(it)i(is)f(the)g(easiest)h(to)f(implemen)-31 b(t.)561 b(T)-92 b(o)391 b(m)-31 b(ul-)0 42869 y(tiply)410 b(fractions,)420 b(w)-31 b(e)409 b(create)g(a)g(new)g(fraction)h(with)g (a)f(n)-31 b(umerator)410 b(that)f(is)g(the)g(pro)31 b(duct)0 44224 y(of)391 b(the)g(original)h(n)-31 b(umerators)392 b(and)e(a)h(denominator)i(that)e(is)g(a)f(pro)31 b(duct)391 b(of)g(the)g(original)0 45579 y(denominators.)p 7380 45579 V 7799 45579 V 1314 w Fk(mul)p 9960 45579 V 10379 45579 V 1155 w Fn(is)318 b(the)g(name)g(Python)i(uses)c(for)i(a)g (metho)31 b(d)319 b(that)g(o)-31 b(v)g(erloads)320 b(the)0 46934 y Fk(*)369 b Fn(op)31 b(erator:)0 49086 y Fk(class)582 b(Fraction:)1162 50441 y(...)1162 51795 y(def)g(__mul__\(self,)h (object\):)2325 53150 y(return)f (Fraction\(self.numerator*object.numerator,)11623 54505 y(self.denominator*object.denominator\))0 56657 y Fn(W)-92 b(e)368 b(can)i(test)f(this)h(metho)31 b(d)370 b(b)-31 b(y)370 b(computing)h(the)e(pro)31 b(duct)370 b(of)f(t)-31 b(w)g(o)371 b(fractions:)p eop %%Page: 231 257 231 256 bop 0 -2070 a Fv(B.1)424 b(F)-106 b(raction)424 b(m)-35 b(ultiplication)21213 b(231)p 0 -1627 38191 45 v 0 865 a Fk(>>>)582 b(print)f(Fraction\(5,6\))j(*)d(Fraction\(3,4\))0 2220 y(15/24)0 4537 y Fn(It)372 b(w)-31 b(orks,)374 b(but)f(w)-31 b(e)372 b(can)h(do)f(b)31 b(etter!)502 b(W)-92 b(e)371 b(can)i(extend)g(the)f(metho)31 b(d)373 b(to)g(handle)g(m)-31 b(ultipli-)0 5892 y(cation)442 b(b)-31 b(y)440 b(an)g(in)-31 b(teger.)706 b(W)-92 b(e)439 b(use)g(the)h Fk(type)h Fn(function)g(to)g(test)f(if)g Fk(other)h Fn(is)f(an)g(in)-31 b(teger)0 7247 y(and)369 b(con)-31 b(v)g(ert)371 b(it)f(to)g(a)f (fraction)i(if)e(it)h(is.)0 9565 y Fk(class)582 b(Fraction:)1162 10920 y(...)1162 12275 y(def)g(__mul__\(self,)h(other\):)2325 13630 y(if)e(type\(other\))i(==)e(type\(5\):)3487 14984 y(other)h(=)f(Fraction\(other\))2325 16339 y(return)h (Fraction\(self.numerator)1747 b(*)581 b(other.numerator,)11623 17694 y(self.denominator)j(*)d(other.denominator\))0 20012 y Fn(Multiplying)338 b(fractions)e(and)f(in)-31 b(tegers)336 b(no)-31 b(w)336 b(w)-31 b(orks,)343 b(but)335 b(only)h(if)g(the)f(fraction)i(is)e(the)g(left)0 21367 y(op)31 b(erand:)0 23684 y Fk(>>>)582 b(print)f(Fraction\(5,6\))j(*)d (4)0 25039 y(20/6)0 26394 y(>>>)h(print)f(4)h(*)f(Fraction\(5,6\))0 27749 y(TypeError:)i(__mul__)f(nor)f(__rmul__)i(defined)f(for)g(these)f (operands)0 30066 y Fn(T)-92 b(o)261 b(ev)-61 b(aluate)262 b(a)f(binary)h(op)31 b(erator)261 b(lik)-31 b(e)262 b(m)-31 b(ultiplication,)287 b(Python)262 b(c)-31 b(hec)g(ks)261 b(the)g(left)h(op)31 b(erand)0 31421 y(\257rst)320 b(to)h(see)f(if)h (it)h(pro)-31 b(vides)321 b(a)p 12576 31421 349 45 v 12995 31421 V 1157 w Fk(mul)p 15156 31421 V 15575 31421 V 1158 w Fn(that)h(supp)31 b(orts)319 b(the)i(t)-31 b(yp)31 b(e)321 b(of)g(the)g(second)f(op)31 b(erand.)0 32776 y(In)369 b(this)g(case,)h(the)f(built-in)i(in)-31 b(teger)370 b(op)31 b(erator)370 b(do)31 b(esn't)370 b(supp)31 b(ort)369 b(fractions.)0 35013 y(Next,)356 b(Python)d(c)-31 b(hec)g(ks)351 b(the)h(righ)-31 b(t)352 b(op)31 b(erand)351 b(to)i(see)d(if)i(it)g (pro)-31 b(vides)352 b(an)p 30251 35013 V 30670 35013 V 1188 w Fk(rmul)p 33412 35013 V 33831 35013 V 1189 w Fn(metho)31 b(d)0 36368 y(that)441 b(supp)31 b(orts)439 b(the)g(\257rst)g(t)-31 b(yp)31 b(e.)705 b(In)439 b(this)h(case,)457 b(w)-31 b(e)440 b(ha)-31 b(v)g(en't)442 b(pro)-31 b(vided)p 31330 36368 V 31748 36368 V 1277 w Fk(rmul)p 34491 36368 V 34910 36368 V 837 w Fn(,)458 b(so)439 b(it)0 37722 y(fails.)0 39959 y(On)369 b(the)g(other)h(hand,)g(there)f(is)g(a)g (simple)h(w)-31 b(a)g(y)371 b(to)f(pro)-31 b(vide)p 25644 39959 V 26062 39959 V 1207 w Fk(rmul)p 28805 39959 V 29223 39959 V 837 w Fn(:)0 42276 y Fk(class)582 b(Fraction:)1162 43631 y(...)1162 44986 y(__rmul__)h(=)e(__mul__)0 47304 y Fn(This)555 b(assignmen)-31 b(t)555 b(sa)-31 b(ys)555 b(that)g(the)p 15877 47304 V 16296 47304 V 1391 w Fk(rmul)p 19038 47304 V 19457 47304 V 1392 w Fn(is)f(the)g(same)h(as)p 28322 47304 V 28740 47304 V 1391 w Fk(mul)p 30902 47304 V 31320 47304 V 837 w Fn(.)1047 b(No)-31 b(w)556 b(if)e(w)-31 b(e)0 48658 y(ev)-61 b(aluate)334 b Fk(4)582 b(*)f(Fraction\(5,6\))p Fn(,)342 b(Python)334 b(in)-31 b(v)g(ok)g(es)p 22593 48658 V 23012 48658 V 1171 w Fk(rmul)p 25754 48658 V 26173 48658 V 1171 w Fn(on)333 b(the)g Fk(Fraction)g Fn(ob)61 b(ject)0 50013 y(and)369 b(passes)g(4)g(as)g(a)h(parameter:)0 52331 y Fk(>>>)582 b(print)f(4)h(*)f(Fraction\(5,6\))0 53686 y(20/6)0 56003 y Fn(Since)p 2921 56003 V 3340 56003 V 1168 w Fk(rmul)p 6083 56003 V 6501 56003 V 1167 w Fn(is)331 b(the)g(same)f(as)p 14248 56003 V 14666 56003 V 1168 w Fk(mul)p 16828 56003 V 17246 56003 V 837 w Fn(,)339 b(and)p 20424 56003 V 20843 56003 V 1167 w Fk(mul)p 23004 56003 V 23423 56003 V 1168 w Fn(can)331 b(handle)g(an)g(in)-31 b(teger)331 b(param-)0 57358 y(eter,)369 b(w)-31 b(e're)370 b(all)h(set.)p eop %%Page: 232 258 232 257 bop 0 -2070 a Fv(232)22020 b(Creating)426 b(a)e(new)h(data)g(t) -35 b(yp)35 b(e)p 0 -1627 38191 45 v 0 865 a Fl(B.2)1793 b(F)-149 b(raction)598 b(addition)0 3292 y Fn(Addition)442 b(is)e(more)g(complicated)j(than)d(m)-31 b(ultiplication,)463 b(but)440 b(still)i(not)e(to)31 b(o)441 b(bad.)706 b(The)0 4647 y(sum)369 b(of)h Fg(a=b)f Fn(and)h Fg(c=d)g Fn(is)f(the)g (fraction)i Fk(\(a*d+c*b\)/b*d)p Fn(.)0 6741 y(Using)f(the)f(m)-31 b(ultiplication)374 b(co)31 b(de)369 b(as)h(a)f(mo)31 b(del,)371 b(w)-31 b(e)369 b(can)h(write)p 27113 6741 349 45 v 27532 6741 V 1207 w Fk(add)p 29694 6741 V 30112 6741 V 1206 w Fn(and)p 33052 6741 V 33470 6741 V 1206 w Fk(radd)p 36213 6741 V 36632 6741 V 838 w Fn(:)0 8915 y Fk(class)582 b(Fraction:)1162 10270 y(...)1162 11625 y(def)g(__add__\(self,)h(other\):)2325 12980 y(if)e(type\(other\))i(==) e(type\(5\):)3487 14335 y(other)h(=)f(Fraction\(other\))2325 15690 y(return)h(Fraction\(self.numerator)1747 b(*)581 b(other.denominator)i(+)11623 17045 y(self.denominator)h(*)d (other.numerator,)11623 18400 y(self.denominator)j(*)d (other.denominator\))1162 21110 y(__radd__)i(=)e(__add__)0 23284 y Fn(W)-92 b(e)368 b(can)i(test)f(these)g(metho)31 b(ds)370 b(with)h Fk(Fraction)p Fn(s)e(and)h(in)-31 b(tegers.)0 25459 y Fk(>>>)582 b(print)f(Fraction\(5,6\))j(+)d(Fraction\(5,6\))0 26814 y(60/36)0 28169 y(>>>)h(print)f(Fraction\(5,6\))j(+)d(3)0 29524 y(23/6)0 30879 y(>>>)h(print)f(2)h(+)f(Fraction\(5,6\))0 32233 y(17/6)0 34408 y Fn(The)369 b(\257rst)g(t)-31 b(w)g(o)371 b(examples)f(in)-31 b(v)g(ok)g(e)p 14906 34408 V 15325 34408 V 1208 w Fk(add)p 17486 34408 V 17905 34408 V 838 w Fn(;)369 b(the)g(last)h(in)-31 b(v)g(ok)g(es)p 26853 34408 V 27271 34408 V 1208 w Fk(radd)p 30014 34408 V 30433 34408 V 838 w Fn(.)0 38818 y Fl(B.3)1793 b(Euclid's)599 b(algorithm)0 41246 y Fn(In)355 b(the)i(previous)f(example,)k(w)-31 b(e)357 b(computed)g(the)f(sum)g(5)p Fg(=)p Fn(6)221 b(+)f(5)p Fg(=)p Fn(6)357 b(and)f(got)h(60)p Fg(=)p Fn(36.)491 b(That)0 42601 y(is)453 b(correct,)473 b(but)453 b(it's)h(not)f(the)g (b)31 b(est)452 b(w)-31 b(a)g(y)454 b(to)g(represen)-31 b(t)452 b(the)h(answ)-31 b(er.)743 b(T)-92 b(o)453 b Fv(reduce)h Fn(the)0 43955 y(fraction)297 b(to)f(its)g(simplest)g (terms,)311 b(w)-31 b(e)296 b(ha)-31 b(v)g(e)296 b(to)h(divide)f(the)g (n)-31 b(umerator)296 b(and)g(denominator)0 45310 y(b)-31 b(y)369 b(their)h Fv(greatest)426 b(common)f(divisor)g(\(GCD\))p Fn(,)370 b(whic)-31 b(h)370 b(is)f(12.)493 b(The)370 b(result)f(is)g(5)p Fg(=)p Fn(3.)0 47404 y(In)502 b(general,)537 b(whenev)-31 b(er)503 b(w)-31 b(e)503 b(create)g(a)f(new)h Fk(Fraction)h Fn(ob)61 b(ject,)537 b(w)-31 b(e)504 b(should)e(reduce)g (it)0 48759 y(b)-31 b(y)473 b(dividing)i(the)f(n)-31 b(umerator)474 b(and)f(denominator)i(b)-31 b(y)474 b(their)f(GCD.)g(If) g(the)g(fraction)i(is)0 50114 y(already)370 b(reduced,)f(the)h(GCD)e (is)h(1.)0 52207 y(Euclid)465 b(of)f(Alexandria)i(\(appro)-31 b(x.)777 b(325{265)467 b(BCE\))e(presen)-31 b(ted)463 b(an)h(algorithm)j(to)d(\257nd)0 53562 y(the)369 b(GCD)g(for)g(t)-31 b(w)g(o)371 b(in)-31 b(tegers)370 b Fg(m)f Fn(and)h Fg(n)p Fn(:)2767 56003 y(If)324 b Fg(n)h Fn(divides)f Fg(m)g Fn(ev)-31 b(enly)-92 b(,)335 b(then)324 b Fg(n)g Fn(is)g(the)h(GCD.)f (Otherwise)g(the)h(GCD)e(is)h(the)2767 57358 y(GCD)369 b(of)h Fg(n)f Fn(and)h(the)f(remainder)h(of)f Fg(m)g Fn(divided)h(b)-31 b(y)370 b Fg(n)p Fn(.)p eop %%Page: 233 259 233 258 bop 0 -2070 a Fv(B.4)424 b(Comparing)i(fractions)22580 b(233)p 0 -1627 38191 45 v 0 865 a Fn(This)370 b(recursiv)-31 b(e)368 b(de\257nition)j(can)e(b)31 b(e)369 b(expressed)f(concisely)i (as)f(a)h(function:)0 2914 y Fk(def)582 b(gcd)f(\(m,)h(n\):)1162 4268 y(if)g(m)f(\045)g(n)h(==)f(0:)2325 5623 y(return)h(n)1162 6978 y(else:)2325 8333 y(return)g(gcd\(n,)g(m\045n\))0 10382 y Fn(In)392 b(the)h(\257rst)f(line)i(of)f(the)g(b)31 b(o)g(dy)-92 b(,)399 b(w)-31 b(e)393 b(use)f(the)h(mo)31 b(dulus)393 b(op)31 b(erator)394 b(to)f(c)-31 b(hec)g(k)393 b(divisibilit)-31 b(y)-92 b(.)0 11737 y(On)369 b(the)g(last)h(line,)h (w)-31 b(e)370 b(use)e(it)i(to)g(compute)g(the)g(remainder)f(after)h (division.)0 13704 y(Since)399 b(all)h(the)e(op)31 b(erations)400 b(w)-31 b(e'v)g(e)400 b(written)g(create)f(new)f Fk(Fraction)p Fn(s)i(for)e(the)h(result,)406 b(w)-31 b(e)0 15059 y(can)369 b(reduce)g(all)h(results)f(b)-31 b(y)370 b(mo)31 b(difying)371 b(the)f(initialization)k(metho)31 b(d.)0 17107 y Fk(class)582 b(Fraction:)1162 18462 y(def)g(__init__\(self,)h(numerator,)g (denominator=1\):)2325 19817 y(g)e(=)g(gcd)h(\(numerator,)h (denominator\))2325 21172 y(self.numerator)1745 b(=)f(numerator)582 b(/)g(g)2325 22527 y(self.denominator)h(=)e(denominator)i(/)f(g)0 24575 y Fn(No)-31 b(w)370 b(whenev)-31 b(er)370 b(w)-31 b(e)370 b(create)f(a)g Fk(Fraction)p Fn(,)i(it)f(is)f(reduced)g(to)h (its)f(simplest)h(form:)0 26624 y Fk(>>>)582 b(Fraction\(100,-36\))0 27979 y(-25/9)0 30027 y Fn(A)344 b(nice)g(feature)g(of)g Fk(gcd)g Fn(is)g(that)h(if)f(the)g(fraction)h(is)e(negativ)-31 b(e,)352 b(the)344 b(min)-31 b(us)344 b(sign)g(is)g(alw)-31 b(a)g(ys)0 31382 y(mo)g(v)g(ed)371 b(to)f(the)f(n)-31 b(umerator.)0 35616 y Fl(B.4)1793 b(Comparing)598 b(fractions)0 37917 y Fn(Supp)31 b(ose)351 b(w)-31 b(e)352 b(ha)-31 b(v)g(e)353 b(t)-31 b(w)g(o)353 b Fk(Fraction)g Fn(ob)61 b(jects,)357 b Fk(a)351 b Fn(and)h Fk(b)p Fn(,)k(and)c(w)-31 b(e)352 b(ev)-61 b(aluate)353 b Fk(a)581 b(==)h(b)p Fn(.)487 b(The)0 39272 y(default)408 b(implemen)-31 b(tation)410 b(of)d Fk(==)g Fn(tests)f(for)g(shallo)-31 b(w)409 b(equalit)-31 b(y)-92 b(,)418 b(so)406 b(it)h(only)h(returns)d(true)0 40627 y(if)370 b Fk(a)f Fn(and)g Fk(b)g Fn(are)g(the)h(same)f(ob)61 b(ject.)0 42594 y(More)469 b(lik)-31 b(ely)-92 b(,)497 b(w)-31 b(e)470 b(w)-31 b(an)g(t)471 b(to)f(return)f(true)g(if)h Fg(a)f Fn(and)h Fg(b)f Fn(ha)-31 b(v)g(e)471 b(the)e(same)h(v)-61 b(alue|that)471 b(is,)0 43949 y(deep)369 b(equalit)-31 b(y)-92 b(.)0 45917 y(W)g(e)516 b(ha)-31 b(v)g(e)517 b(to)g(teac)-31 b(h)517 b(fractions)h(ho)-31 b(w)517 b(to)g(compare)h(themselv)-31 b(es.)935 b(As)516 b(w)-31 b(e)517 b(sa)-31 b(w)517 b(in)f(Sec-)0 47272 y(tion)373 b(15.4,)h(w)-31 b(e)372 b(can)g(o)-31 b(v)g(erload)373 b(all)g(the)f(comparison)h(op)31 b(erators)371 b(at)i(once)e(b)-31 b(y)372 b(supplying)h(a)p 0 48626 349 45 v 418 48626 V 767 48626 a Fk(cmp)p 2580 48626 V 2999 48626 V 1206 w Fn(metho)31 b(d.)0 50594 y(By)471 b(con)-31 b(v)g(en)g(tion,)500 b(the)p 9888 50594 V 10306 50594 V 1309 w Fk(cmp)p 12468 50594 V 12886 50594 V 1308 w Fn(metho)31 b(d)472 b(returns)e(a)i (negativ)-31 b(e)473 b(n)-31 b(um)g(b)31 b(er)472 b(if)g Fk(self)f Fn(is)g(less)0 51949 y(than)365 b Fk(other)p Fn(,)i(zero)d(if)h(they)g(are)g(the)f(same,)j(and)e(a)f(p)31 b(ositiv)-31 b(e)367 b(n)-31 b(um)g(b)31 b(er)364 b(if)h Fk(self)g Fn(is)g(greater)0 53304 y(than)370 b Fk(other)p Fn(.)0 55271 y(The)397 b(simplest)g(w)-31 b(a)g(y)398 b(to)f(compare)g(fractions)h(is)e(to)i(cross-m)-31 b(ultiply)-92 b(.)576 b(If)396 b Fg(a=b)354 b(>)e(c=d)p Fn(,)405 b(then)0 56626 y Fg(ad)308 b(>)f(bc)p Fn(.)493 b(With)369 b(that)i(in)e(mind,)i (here)d(is)h(the)h(co)31 b(de)369 b(for)p 23814 56626 V 24232 56626 V 1206 w Fk(cmp)p 26394 56626 V 26813 56626 V 837 w Fn(:)p eop %%Page: 234 260 234 259 bop 0 -2070 a Fv(234)22020 b(Creating)426 b(a)e(new)h(data)g(t) -35 b(yp)35 b(e)p 0 -1627 38191 45 v 0 865 a Fk(class)582 b(Fraction:)1162 2220 y(...)1162 3575 y(def)g(__cmp__\(self,)h (other\):)2325 4930 y(diff)e(=)h(\(self.numerator)1164 b(*)581 b(other.denominator)j(-)6974 6285 y(other.numerator)f(*)e (self.denominator\))2325 7640 y(return)h(diff)0 10080 y Fn(If)420 b Fk(self)g Fn(is)g(greater)g(than)h Fk(other)p Fn(,)433 b(then)420 b Fk(diff)h Fn(will)g(b)31 b(e)420 b(p)31 b(ositiv)-31 b(e.)646 b(If)420 b Fk(other)g Fn(is)g(greater,)0 11435 y(then)369 b Fk(diff)h Fn(will)h(b)31 b(e)369 b(negativ)-31 b(e.)494 b(If)369 b(they)h(are)f(the)h(same,)g Fk(diff)f Fn(is)g(zero.)0 16526 y Fl(B.5)1793 b(T)-149 b(aking)598 b(it)g(further)0 19296 y Fn(Of)268 b(course,)287 b(w)-31 b(e)268 b(are)g(not)g(done.)459 b(W)-92 b(e)267 b(still)i(ha)-31 b(v)g(e)268 b(to)h(implemen)-31 b(t)270 b(subtraction)f(b)-31 b(y)267 b(o)-31 b(v)g(erriding)p 0 20651 349 45 v 418 20651 V 767 20651 a Fk(sub)p 2580 20651 V 2999 20651 V 1206 w Fn(and)370 b(division)h(b)-31 b(y)369 b(o)-31 b(v)g(erriding)p 16774 20651 V 17193 20651 V 1208 w Fk(div)p 19355 20651 V 19773 20651 V 837 w Fn(.)0 23010 y(One)517 b(w)-31 b(a)g(y)519 b(to)g(handle)f(those)g(op)31 b(erations)519 b(is)e(to)i(implemen)-31 b(t)520 b(negation)g(b)-31 b(y)517 b(o)-31 b(v)g(erriding)p 0 24365 V 418 24365 V 767 24365 a Fk(neg)p 2580 24365 V 2999 24365 V 1157 w Fn(and)321 b(in)-31 b(v)g(ersion)321 b(b)-31 b(y)320 b(o)-31 b(v)g(erriding)p 17086 24365 V 17504 24365 V 1159 w Fk(invert)p 21409 24365 V 21828 24365 V 837 w Fn(.)477 b(Then)320 b(w)-31 b(e)321 b(can)f(subtract)g(b)-31 b(y)321 b(negat-)0 25720 y(ing)378 b(the)f(second)g(op)31 b(erand)377 b(and)g(adding,)k(and)c(w) -31 b(e)378 b(can)f(divide)h(b)-31 b(y)378 b(in)-31 b(v)g(erting)379 b(the)e(second)0 27075 y(op)31 b(erand)369 b(and)h(m)-31 b(ultiplying.)0 29433 y(Next,)469 b(w)-31 b(e)448 b(ha)-31 b(v)g(e)449 b(to)g(pro)-31 b(vide)p 12970 29433 V 13388 29433 V 1285 w Fk(rsub)p 16131 29433 V 16550 29433 V 1285 w Fn(and)p 19647 29433 V 20065 29433 V 1285 w Fk(rdiv)p 22808 29433 V 23227 29433 V 837 w Fn(.)729 b(Unfortunately)-92 b(,)470 b(w)-31 b(e)448 b(can't)i(use)0 30788 y(the)315 b(same)g(tric)-31 b(k)316 b(w)-31 b(e)315 b(used)f(for)h(addition)i (and)e(m)-31 b(ultiplication,)331 b(b)31 b(ecause)315 b(subtraction)h(and)0 32143 y(division)464 b(are)d(not)i(comm)-31 b(utativ)g(e.)775 b(W)-92 b(e)461 b(can't)j(just)e(set)p 24542 32143 V 24961 32143 V 1298 w Fk(rsub)p 27703 32143 V 28122 32143 V 1300 w Fn(and)p 31248 32143 V 31666 32143 V 1299 w Fk(rdiv)p 34409 32143 V 34827 32143 V 1299 w Fn(equal)0 33498 y(to)p 1436 33498 V 1854 33498 V 1220 w Fk(sub)p 4016 33498 V 4435 33498 V 1219 w Fn(and)p 7401 33498 V 7819 33498 V 1220 w Fk(div)p 9981 33498 V 10400 33498 V 837 w Fn(.)532 b(In)382 b(these)g(op)31 b(erations,)388 b(the)382 b(order)g(of)h(the)f(op)31 b(erands)382 b(mak)-31 b(es)384 b(a)0 34853 y(di\256erence.)0 37212 y(T)-92 b(o)438 b(handle)h Fv(unary)503 b(negation)p Fn(,)457 b(whic)-31 b(h)438 b(is)g(the)g(use)f(of)h(the)g(min)-31 b(us)438 b(sign)g(with)h(a)f(single)0 38567 y(op)31 b(erand,)370 b(w)-31 b(e)369 b(o)-31 b(v)g(erride)p 10503 38567 V 10921 38567 V 1207 w Fk(neg)p 13083 38567 V 13502 38567 V 837 w Fn(.)0 40926 y(W)-92 b(e)293 b(can)i(compute)g(p)31 b(o)-31 b(w)g(ers)294 b(b)-31 b(y)294 b(o)-31 b(v)g(erriding)p 18453 40926 V 18871 40926 V 1133 w Fk(pow)p 21033 40926 V 21451 40926 V 837 w Fn(,)309 b(but)295 b(the)f(implemen)-31 b(tation)298 b(is)c(a)h(little)0 42280 y(tric)-31 b(ky)-92 b(.)481 b(If)331 b(the)g(exp)31 b(onen)-31 b(t)332 b(isn't)h(an)e(in) -31 b(teger,)340 b(then)332 b(it)g(ma)-31 b(y)332 b(not)g(b)31 b(e)331 b(p)31 b(ossible)332 b(to)g(represen)-31 b(t)0 43635 y(the)314 b(result)f(as)h(a)g Fk(Fraction)p Fn(.)475 b(F)-92 b(or)313 b(example,)327 b Fk(Fraction\(2\))582 b(**)g(Fraction\(1,2\))315 b Fn(is)f(the)0 44990 y(square)476 b(ro)31 b(ot)476 b(of)h(2,)503 b(whic)-31 b(h)477 b(is)f(an)g (irrational)j(n)-31 b(um)g(b)31 b(er)476 b(\(it)h(can't)g(b)31 b(e)476 b(represen)-31 b(ted)475 b(as)h(a)0 46345 y(fraction\).)495 b(So)369 b(it's)h(not)g(easy)f(to)h(write)g(the)g(most)g(general)g(v) -31 b(ersion)369 b(of)p 30456 46345 V 30874 46345 V 1207 w Fk(pow)p 33036 46345 V 33455 46345 V 837 w Fn(.)0 48704 y(There)510 b(is)h(one)g(other)g(extension)g(to)h(the)f Fk(Fraction)g Fn(class)g(that)h(y)-31 b(ou)511 b(migh)-31 b(t)513 b(w)-31 b(an)g(t)512 b(to)0 50059 y(think)346 b(ab)31 b(out.)485 b(So)345 b(far,)350 b(w)-31 b(e)345 b(ha)-31 b(v)g(e)346 b(assumed)e(that)i(the)f(n)-31 b(umerator)345 b(and)g(denominator)i(are)0 51414 y(in)-31 b(tegers.)493 b(W)-92 b(e)369 b(migh)-31 b(t)371 b(also)f(w)-31 b(an)g(t)371 b(to)f(allo)-31 b(w)371 b(them)f(to)g(b)31 b(e)369 b(long)h(in)-31 b(tegers.)2767 54433 y Fm(As)430 b(an)g(exer)-57 b(cise,)439 b(\257nish)431 b(the)e(implementation)i(of)g(the)e Fk(Fraction)i Fm(class)e(so)2767 55788 y(that)424 b(it)g(hand)57 b(les)423 b(subtr)-57 b(action,)432 b(division,)h(exp)-57 b(onentiation,)432 b(and)425 b(long)f(inte-)2767 57143 y(gers)396 b(as)g(numer)-57 b(ators)395 b(and)h(denominators.)p eop %%Page: 235 261 235 260 bop 0 -2070 a Fv(B.6)424 b(Glossary)29151 b(235)p 0 -1627 38191 45 v 0 865 a Fl(B.6)1793 b(Glossary)0 3030 y Fv(greatest)426 b(common)f(divisor)g(\(GCD\):)553 b Fn(The)350 b(largest)h(p)31 b(ositiv)-31 b(e)351 b(in)-31 b(teger)350 b(that)h(divides)2767 4385 y(without)373 b(a)d(remainder)h(in)-31 b(to)372 b(b)31 b(oth)371 b(the)f(n)-31 b(umerator)371 b(and)g(denominator)h(of)f(a)g(frac-)2767 5740 y(tion.)0 7981 y Fv(reduce:)554 b Fn(T)-92 b(o)370 b(c)-31 b(hange)370 b(a)g(fraction)g(in)-31 b(to)371 b(an)f(equiv)-61 b(alen)-31 b(t)371 b(form)e(with)i(a)e(GCD)g(of)h(1.)0 10221 y Fv(unary)425 b(negation:)554 b Fn(The)530 b(op)31 b(eration)531 b(that)f(computes)h(an)e(additiv)-31 b(e)532 b(in)-31 b(v)g(erse,)570 b(usually)2767 11576 y(denoted)404 b(with)g(a)f(leading)h(min)-31 b(us)404 b(sign.)594 b(Called)404 b(\\unary")g(b)-31 b(y)403 b(con)-31 b(trast)404 b(with)g(the)2767 12931 y(binary)370 b(min)-31 b(us)370 b(op)31 b(eration,)371 b(whic)-31 b(h)370 b(is)f(subtraction.)p eop %%Page: 236 262 236 261 bop 0 -2070 a Fv(236)22020 b(Creating)426 b(a)e(new)h(data)g(t) -35 b(yp)35 b(e)p 0 -1627 38191 45 v eop %%Page: 237 263 237 262 bop 0 9981 a Fi(App)72 b(endix)862 b(C)0 16340 y Fo(Recommendations)1034 b(for)0 19727 y(further)g(reading)0 26268 y Fn(So)339 b(where)f(do)h(y)-31 b(ou)339 b(go)g(from)g(here?)481 b(There)339 b(are)f(man)-31 b(y)340 b(directions)f(to)g(pursue,)345 b(extending)0 27623 y(y)-31 b(our)369 b(kno)-31 b(wledge)372 b(of)e(Python)g(sp)31 b(eci\257cally)370 b(and)g(computer)g(science)f (in)g(general.)0 29736 y(The)286 b(examples)h(in)f(this)g(b)31 b(o)g(ok)287 b(ha)-31 b(v)g(e)286 b(b)31 b(een)286 b(delib)31 b(erately)287 b(simple,)304 b(but)286 b(they)g(ma)-31 b(y)287 b(not)g(ha)-31 b(v)g(e)0 31091 y(sho)g(wn)366 b(o\256)g(Python's)h(most)f(exciting)i(capabilities.)494 b(Here)365 b(is)h(a)g(sampling)h(of)f(extensions)0 32446 y(to)k(Python)g(and)g(suggestions)g(for)f(pro)61 b(jects)370 b(that)h(use)d(them.)1660 34942 y Fj(\262)554 b Fn(GUI)339 b(\(graphical)j(user)c(in)-31 b(terface\))342 b(programming)f(lets)f(y) -31 b(our)340 b(program)h(use)d(a)i(win-)2767 36297 y(do)-31 b(wing)372 b(en)-31 b(vironmen)g(t)371 b(to)f(in)-31 b(teract)370 b(with)h(the)e(user)f(and)i(displa)-31 b(y)370 b(graphics.)2767 38070 y(The)351 b(oldest)g(graphics)f(pac)-31 b(k)-61 b(age)352 b(for)e(Python)h(is)f(Tkin)-31 b(ter,)356 b(whic)-31 b(h)351 b(is)f(based)g(on)h(Jon)2767 39425 y(Ousterhout's)280 b(Tcl)h(and)e(Tk)h(scripting)h(languages.)464 b(Tkin)-31 b(ter)281 b(comes)f(bundled)g(with)2767 40780 y(the)370 b(Python)g(distribution.)2767 42553 y(Another)360 b(p)31 b(opular)360 b(platform)i(is)d(wxPython,)364 b(whic)-31 b(h)360 b(is)g(essen)-31 b(tially)361 b(a)f(Python)h(v)-31 b(e-)2767 43908 y(neer)300 b(o)-31 b(v)g(er)301 b(wxWindo)-31 b(ws,)316 b(a)301 b(C++)g(pac)-31 b(k)-61 b(age)301 b(whic)-31 b(h)302 b(in)f(turn)f(implemen)-31 b(ts)302 b(windo)-31 b(ws)2767 45263 y(using)300 b(nativ)-31 b(e)301 b(in)-31 b(terfaces)300 b(on)f(Windo)-31 b(ws)300 b(and)f(Unix)h(\(including)i (Lin)-31 b(ux\))300 b(platforms.)2767 46618 y(The)448 b(windo)-31 b(ws)448 b(and)f(con)-31 b(trols)448 b(under)e(wxPython)j (tend)e(to)h(ha)-31 b(v)g(e)448 b(a)f(more)g(nativ)-31 b(e)2767 47973 y(lo)31 b(ok)317 b(and)e(feel)h(than)g(those)f(of)h (Tkin)-31 b(ter)316 b(and)f(are)g(somewhat)i(simpler)f(to)g(program.) 2767 49747 y(An)-31 b(y)420 b(t)-31 b(yp)31 b(e)420 b(of)f(GUI)g (programming)i(will)g(lead)f(y)-31 b(ou)420 b(in)-31 b(to)421 b(ev)-31 b(en)g(t-driv)g(en)420 b(program-)2767 51101 y(ming,)342 b(where)333 b(the)g(user)e(and)i(not)h(the)f (programmer)g(determines)g(the)g(\260o)-31 b(w)334 b(of)f(exe-)2767 52456 y(cution.)489 b(This)354 b(st)-31 b(yle)355 b(of)f(programming)i (tak)-31 b(es)354 b(some)g(getting)i(used)d(to,)358 b(sometimes)2767 53811 y(forcing)371 b(y)-31 b(ou)370 b(to)f(rethink)h(the)g(whole)g (structure)f(of)g(a)h(program.)1660 56003 y Fj(\262)554 b Fn(W)-92 b(eb)344 b(programming)j(in)-31 b(tegrates)346 b(the)f(Python)g(with)h(the)f(In)-31 b(ternet.)484 b(F)-92 b(or)344 b(example,)2767 57358 y(y)-31 b(ou)341 b(can)e(build)h(w)-31 b(eb)340 b(clien)-31 b(t)341 b(programs)f(that)g(op)31 b(en)340 b(and)f(read)h(a)f(remote)h(w)-31 b(eb)340 b(page)p eop %%Page: 238 264 238 263 bop 0 -2070 a Fv(238)15224 b(Recommendations)426 b(for)f(further)h(reading)p 0 -1627 38191 45 v 2767 865 a Fn(\(almost\))411 b(as)d(easily)h(as)e(y)-31 b(ou)409 b(can)f(op)31 b(en)408 b(a)g(\257le)g(on)g(disk.)609 b(There)407 b(are)h(also)h(Python)2767 2220 y(mo)31 b(dules)428 b(that)g(let)g(y)-31 b(ou)428 b(access)e(remote)i(\257les)f(via)h(ftp,) 442 b(and)427 b(mo)31 b(dules)428 b(to)f(let)h(y)-31 b(ou)2767 3575 y(send)265 b(and)h(receiv)-31 b(e)265 b(email.)460 b(Python)266 b(is)g(also)g(widely)g(used)f(for)g(w)-31 b(eb)266 b(serv)-31 b(er)264 b(programs)2767 4930 y(to)370 b(handle)g(input)g(forms.)1660 7442 y Fj(\262)554 b Fn(Databases)534 b(are)e(a)h(bit)g(lik)-31 b(e)534 b(sup)31 b(er)532 b(\257les)g(where)h (data)h(is)e(stored)h(in)g(prede\257ned)2767 8797 y(sc)-31 b(hemas,)386 b(and)381 b(relationships)i(b)31 b(et)-31 b(w)g(een)383 b(data)f(items)h(let)f(y)-31 b(ou)382 b(access)f(the)h (data)h(in)2767 10152 y(v)-61 b(arious)421 b(w)-31 b(a)g(ys.)649 b(Python)422 b(has)e(sev)-31 b(eral)422 b(mo)31 b(dules)421 b(to)g(enable)h(users)d(to)j(connect)f(to)2767 11507 y(v)-61 b(arious)370 b(database)g(engines,)g(b)31 b(oth)370 b(Op)31 b(en)369 b(Source)g(and)g(commercial.)1660 14019 y Fj(\262)554 b Fn(Thread)446 b(programming)i(lets)e(y)-31 b(ou)446 b(run)f(sev)-31 b(eral)445 b(threads)h(of)g(execution)h (within)g(a)2767 15374 y(single)358 b(program.)489 b(If)356 b(y)-31 b(ou)357 b(ha)-31 b(v)g(e)358 b(had)f(the)f(exp)31 b(erience)356 b(of)h(using)g(a)g(w)-31 b(eb)357 b(bro)-31 b(wser)356 b(to)2767 16729 y(scroll)336 b(the)g(b)31 b(eginning)337 b(of)f(a)g(page)h(while)f(the)g(bro)-31 b(wser)336 b(con)-31 b(tin)g(ues)336 b(to)h(load)g(the)e(rest)2767 18084 y(of)370 b(it,)h(then)e(y)-31 b(ou)370 b(ha)-31 b(v)g(e)370 b(a)g(feel)f(for)g(what)i(threads)e(can)g(do.)1660 20597 y Fj(\262)554 b Fn(When)443 b(sp)31 b(eed)442 b(is)i(paramoun)-31 b(t)445 b(Python)f(extensions)g(ma)-31 b(y)445 b(b)31 b(e)443 b(written)h(in)g(a)f(com-)2767 21952 y(piled)465 b(language)h(lik)-31 b(e)466 b(C)e(or)g(C++.)777 b(Suc)-31 b(h)464 b(extensions)h(form)g(the)f(base)g(of)h(man)-31 b(y)2767 23306 y(of)369 b(the)g(mo)31 b(dules)369 b(in)f(the)h(Python)g (library)-92 b(.)493 b(The)369 b(mec)-31 b(hanics)369 b(of)g(linking)h(functions)2767 24661 y(and)340 b(data)i(is)d(somewhat) j(complex.)484 b(SWIG)339 b(\(Simpli\257ed)j(W)-92 b(rapp)31 b(er)338 b(and)i(In)-31 b(terface)2767 26016 y(Generator\))370 b(is)f(a)h(to)31 b(ol)370 b(to)g(mak)-31 b(e)371 b(the)e(pro)31 b(cess)368 b(m)-31 b(uc)g(h)370 b(simpler.)0 30966 y Fl(C.1)1793 b(Python-related)600 b(w)-50 b(eb)599 b(sites)g(and)f(b)50 b(o)g(oks)0 33670 y Fn(Here)369 b(are)g(the)g(authors')h (recommendations)i(for)d(Python)h(resources)e(on)i(the)f(w)-31 b(eb:)1660 36598 y Fj(\262)554 b Fn(The)536 b(Python)g(home)g(page)f (at)h Fk(www.python.org)h Fn(is)e(the)g(place)g(to)h(start)g(y)-31 b(our)2767 37952 y(searc)g(h)268 b(for)g(an)-31 b(y)268 b(Python)i(related)e(material.)461 b(Y)-92 b(ou)268 b(will)i(\257nd)e (help,)288 b(do)31 b(cumen)-31 b(tation,)2767 39307 y(links)301 b(to)g(other)f(sites)g(and)g(SIG)f(\(Sp)31 b(ecial)302 b(In)-31 b(terest)300 b(Group\))g(mailing)i(lists)f(that)g(y)-31 b(ou)2767 40662 y(can)370 b(join.)1660 43175 y Fj(\262)554 b Fn(The)548 b(Op)31 b(en)547 b(Bo)31 b(ok)549 b(Pro)61 b(ject)548 b Fk(www.ibiblio.com/obp)j Fn(con)-31 b(tains)549 b(not)f(only)h(this)2767 44530 y(b)31 b(o)g(ok)417 b(online)g(but)f (also)g(similar)i(b)31 b(o)g(oks)416 b(for)g(Ja)-31 b(v)-61 b(a)416 b(and)g(C++)g(b)-31 b(y)416 b(Allen)h(Do)-31 b(wney)-92 b(.)2767 45885 y(In)420 b(addition)j(there)d(are)g Fm(L)-57 b(essons)443 b(in)h(Ele)-57 b(ctric)444 b(Cir)-57 b(cuits)421 b Fn(b)-31 b(y)420 b(T)-92 b(on)-31 b(y)422 b(R.)e(Kuphaldt,)2767 47239 y Fm(Getting)478 b(down)d(with)h(...)p Fn(,)k(a)457 b(set)f(of)h(tutorials)h(on)f(a)f(range)h(of)g(computer)g (science)2767 48594 y(topics,)384 b(written)d(and)f(edited)h(b)-31 b(y)380 b(high)g(sc)-31 b(ho)31 b(ol)381 b(studen)-31 b(ts,)383 b Fm(Python)405 b(for)h(F)-85 b(un)p Fn(,)383 b(a)d(set)2767 49949 y(of)435 b(case)e(studies)h(in)g(Python)i(b)-31 b(y)434 b(Chris)f(Mey)-31 b(ers,)450 b(and)434 b Fm(The)456 b(Linux)g(Co)-57 b(okb)g(o)g(ok)435 b Fn(b)-31 b(y)2767 51304 y(Mic)g(hael)371 b(Stultz,)g(with)f(300)g(pages)g(of)g(tips)f (and)h(tec)-31 b(hniques.)1660 53817 y Fj(\262)554 b Fn(Finally)483 b(if)e(y)-31 b(ou)482 b(go)g(to)f(Go)31 b(ogle)483 b(and)e(use)f(the)h(searc)-31 b(h)481 b(string)g(\\p)-31 b(ython)483 b(-snak)-31 b(e)481 b(-)2767 55172 y(mon)-31 b(t)g(y")372 b(y)-31 b(ou)370 b(will)h(get)f(ab)31 b(out)370 b(750,000)i(hits.)p eop %%Page: 239 265 239 264 bop 0 -2070 a Fv(C.2)425 b(Recommended)h(general)g(computer)f (science)g(b)35 b(o)g(oks)7727 b(239)p 0 -1627 38191 45 v 0 865 a Fn(And)369 b(here)g(are)g(some)g(b)31 b(o)g(oks)370 b(that)g(con)-31 b(tain)371 b(more)f(material)h(on)e(the)h(Python)g (language:)1660 3348 y Fj(\262)554 b Fm(Cor)-57 b(e)414 b(Python)g(Pr)-57 b(o)g(gr)g(amming)391 b Fn(b)-31 b(y)388 b(W)-92 b(esley)388 b(Ch)-31 b(un)389 b(is)g(a)g(large)g(b)31 b(o)g(ok)389 b(at)g(ab)31 b(out)390 b(750)2767 4703 y(pages.)674 b(The)430 b(\257rst)e(part)i(of)g(the)g(b)31 b(o)g(ok)429 b(co)-31 b(v)g(ers)430 b(the)g(basic)f(Python)i(language)g(fea-)2767 6057 y(tures.)613 b(The)410 b(second)f(part)h(pro)-31 b(vides)410 b(an)f(easy-paced)h(in)-31 b(tro)31 b(duction)412 b(to)e(more)g(ad-)2767 7412 y(v)-61 b(anced)370 b(topics)g(including)g (man)-31 b(y)371 b(of)f(those)f(men)-31 b(tioned)371 b(ab)31 b(o)-31 b(v)g(e.)1660 9600 y Fj(\262)554 b Fm(Python)360 b(Essential)e(R)-57 b(efer)g(enc)g(e)332 b Fn(b)-31 b(y)330 b(Da)-31 b(vid)329 b(M.)g(Beazley)h(is)f(a)h(small)g(b)31 b(o)g(ok,)338 b(but)329 b(it)h(is)2767 10955 y(pac)-31 b(k)g(ed)422 b(with)g(information)i(b)31 b(oth)422 b(on)f(the)g (language)i(itself)f(and)f(the)g(mo)31 b(dules)422 b(in)2767 12310 y(the)370 b(standard)f(library)-92 b(.)493 b(It)370 b(is)f(also)h(v)-31 b(ery)369 b(w)-31 b(ell)371 b(indexed.)1660 14497 y Fj(\262)554 b Fm(Python)545 b(Po)-57 b(cket)544 b(R)-57 b(efer)g(enc)g(e)533 b Fn(b)-31 b(y)531 b(Mark)e(Lutz)i(really) g(do)31 b(es)529 b(\257t)i(in)f(y)-31 b(our)530 b(p)31 b(o)g(c)-31 b(k)g(et.)2767 15852 y(Although)503 b(not)e(as)f(extensiv) -31 b(e)502 b(as)e Fm(Python)517 b(Essential)g(R)-57 b(efer)g(enc)g(e)503 b Fn(it)e(is)g(a)f(handy)2767 17207 y(reference)340 b(for)h(the)f(most)i(commonly)h(used)d(functions)h(and) g(mo)31 b(dules.)484 b(Mark)340 b(Lutz)2767 18562 y(is)301 b(also)g(the)g(author)g(of)g Fm(Pr)-57 b(o)g(gr)g(amming)334 b(Python)p Fn(,)315 b(one)301 b(of)f(the)h(earliest)g(\(and)h (largest\))2767 19917 y(b)31 b(o)g(oks)386 b(on)f(Python)h(and)f(not)h (aimed)g(at)g(the)g(b)31 b(eginning)386 b(programmer.)541 b(His)385 b(later)2767 21272 y(b)31 b(o)g(ok)370 b Fm(L)-57 b(e)g(arning)398 b(Python)369 b Fn(is)g(smaller)i(and)e(more)g (accessible.)1660 23459 y Fj(\262)554 b Fm(Python)405 b(Pr)-57 b(o)g(gr)g(amming)407 b(on)d(Win32)379 b Fn(b)-31 b(y)378 b(Mark)h(Hammond)h(and)f(Andy)f(Robinson)2767 24814 y(is)409 b(a)g(\\m)-31 b(ust)409 b(ha)-31 b(v)g(e")411 b(for)d(an)-31 b(y)g(one)410 b(seriously)f(using)g(Python)h(to)f(dev) -31 b(elop)410 b(Windo)-31 b(ws)2767 26169 y(applications.)491 b(Among)356 b(other)f(things)h(it)f(co)-31 b(v)g(ers)355 b(the)g(in)-31 b(tegration)357 b(of)f(Python)g(and)2767 27524 y(COM,)425 b(builds)f(a)g(small)h(application)i(with)e(wxPython,) 440 b(and)424 b(ev)-31 b(en)424 b(uses)f(Python)2767 28879 y(to)370 b(script)f(windo)-31 b(ws)371 b(applications)h(suc)-31 b(h)369 b(as)g(W)-92 b(ord)369 b(and)g(Excel.)0 33310 y Fl(C.2)1793 b(Recommended)1252 b(general)f(computer)h(science)4483 35342 y(b)50 b(o)g(oks)0 37784 y Fn(The)416 b(follo)-31 b(wing)420 b(suggestions)d(for)e(further)h(reading)h(include)f(man)-31 b(y)417 b(of)g(the)f(authors')g(fa-)0 39139 y(v)-31 b(orite)281 b(b)31 b(o)g(oks.)463 b(They)281 b(deal)f(with)h(go)31 b(o)g(d)281 b(programming)h(practices)e(and)g(computer)h(science)0 40494 y(in)369 b(general.)1660 42976 y Fj(\262)554 b Fm(The)391 b(Pr)-57 b(actic)g(e)392 b(of)f(Pr)-57 b(o)g(gr)g(amming)365 b Fn(b)-31 b(y)364 b(Kernighan)g(and)f(Pik)-31 b(e)365 b(co)-31 b(v)g(ers)363 b(not)h(only)h(the)2767 44331 y(design)h(and)f(co)31 b(ding)366 b(of)g(algorithms)h(and)f(data)g (structures,)f(but)h(also)g(debugging,)2767 45686 y(testing)468 b(and)f(impro)-31 b(ving)469 b(the)d(p)31 b(erformance)467 b(of)g(programs.)785 b(The)467 b(examples)g(are)2767 47041 y(mostly)371 b(C++)f(and)f(Ja)-31 b(v)-61 b(a,)370 b(with)h(none)e(in)h(Python.)1660 49229 y Fj(\262)554 b Fm(The)355 b(Elements)g(of)g(Java)f(Style)325 b Fn(edited)g(b)-31 b(y)325 b(Al)f(V)-92 b(ermeulen)325 b(is)f(another)h(small)g(b)31 b(o)g(ok)2767 50584 y(that)549 b(discusses)d(some)h(of)h(the)f(\257ner) g(p)31 b(oin)-31 b(ts)547 b(of)h(go)31 b(o)g(d)548 b(programming,)594 b(suc)-31 b(h)547 b(as)2767 51938 y(go)31 b(o)g(d)380 b(use)e(of)h(naming)h(con)-31 b(v)g(en)g(tions,)384 b(commen)-31 b(ts,)382 b(and)d(ev)-31 b(en)379 b(whitespace)h(and)f(in-)2767 53293 y(den)-31 b(tation)540 b(\(somewhat)f(of)e(a)g(nonissue)g(in)g (Python\).)997 b(The)537 b(b)31 b(o)g(ok)537 b(also)h(co)-31 b(v)g(ers)2767 54648 y(programming)366 b(b)-31 b(y)363 b(con)-31 b(tract,)366 b(using)d(assertions)g(to)h(catc)-31 b(h)364 b(errors)d(b)-31 b(y)363 b(testing)i(pre-)2767 56003 y(conditions)311 b(and)e(p)31 b(ostconditions,)324 b(and)309 b(prop)31 b(er)308 b(programming)j(with)f(threads)f(and)2767 57358 y(their)370 b(sync)-31 b(hronization.)p eop %%Page: 240 266 240 265 bop 0 -2070 a Fv(240)15224 b(Recommendations)426 b(for)f(further)h(reading)p 0 -1627 38191 45 v 1660 865 a Fj(\262)554 b Fm(Pr)-57 b(o)g(gr)g(amming)428 b(Pe)-57 b(arls)401 b Fn(b)-31 b(y)402 b(Jon)g(Ben)-31 b(tley)403 b(is)f(a)g(classic)g(b)31 b(o)g(ok.)591 b(It)402 b(consists)g(of)g (case)2767 2220 y(studies)461 b(that)i(originally)h(app)31 b(eared)461 b(in)g(the)g(author's)h(column)g(in)f(the)h Fm(Commu-)2767 3575 y(nic)-57 b(ations)509 b(of)f(the)f(A)-28 b(CM)p Fn(.)490 b(The)h(studies)f(deal)h(with)h(tradeo\256s)e(in)h (programming)2767 4930 y(and)405 b(wh)-31 b(y)404 b(it)h(is)f(often)h (an)f(esp)31 b(ecially)406 b(bad)e(idea)h(to)g(run)e(with)i(y)-31 b(our)405 b(\257rst)e(idea)i(for)2767 6285 y(a)433 b(program.)681 b(The)432 b(b)31 b(o)g(ok)432 b(is)g(a)g(bit)h(older)f(than)g(those)g (ab)31 b(o)-31 b(v)g(e)433 b(\(1986\),)451 b(so)432 b(the)g(ex-)2767 7640 y(amples)399 b(are)f(in)g(older)g(languages.)581 b(There)397 b(are)h(lots)h(of)f(problems)g(to)h(solv)-31 b(e,)407 b(some)2767 8995 y(with)307 b(solutions)f(and)f(others)g(with) h(hin)-31 b(ts.)472 b(This)305 b(b)31 b(o)g(ok)305 b(w)-31 b(as)306 b(v)-31 b(ery)305 b(p)31 b(opular)305 b(and)g(w)-31 b(as)2767 10350 y(follo)g(w)g(ed)373 b(b)-31 b(y)369 b(a)g(second)g(v)-31 b(olume.)1660 12590 y Fj(\262)554 b Fm(The)322 b(New)f(T)-85 b(uring)322 b(Omnibus)289 b Fn(b)-31 b(y)288 b(A.K)g(Dewdney)h(pro)-31 b(vides)288 b(a)g(gen)-31 b(tle)290 b(in)-31 b(tro)31 b(duction)2767 13945 y(to)351 b(66)g(topics)g(of)g(computer)g(science)f(ranging)h (from)g(parallel)h(computing)g(to)f(com-)2767 15300 y(puter)400 b(viruses,)408 b(from)400 b(cat)h(scans)f(to)h(genetic)g(algorithms.) 587 b(All)401 b(of)g(the)f(topics)h(are)2767 16655 y(short)376 b(and)g(en)-31 b(tertaining.)514 b(An)376 b(earlier)g(b)31 b(o)g(ok)376 b(b)-31 b(y)375 b(Dewdney)h Fm(The)402 b(A)-28 b(rmchair)401 b(Uni-)2767 18010 y(verse)438 b Fn(is)f(a)h(collection)i (from)e(his)g(column)h Fm(Computer)458 b(R)-57 b(e)g(cr)g(e)g(ations) 440 b Fn(in)e Fm(Scienti\257c)2767 19365 y(A)-28 b(meric)-57 b(an)p Fn(.)494 b(Both)370 b(b)31 b(o)g(oks)369 b(are)g(ric)-31 b(h)369 b(source)g(of)h(ideas)f(for)h(pro)61 b(jects.)1660 21605 y Fj(\262)554 b Fm(T)-85 b(urtles,)354 b(T)-85 b(ermites)344 b(and)g(T)-85 b(r)-57 b(a\261c)344 b(Jams)311 b Fn(b)-31 b(y)313 b(Mitc)-31 b(hel)313 b(Resnic)-31 b(k)312 b(is)g(ab)31 b(out)313 b(the)f(p)31 b(o)-31 b(w)g(er)2767 22960 y(of)357 b(decen)-31 b(tralization)360 b(and)d(ho)-31 b(w)358 b(complex)g(b)31 b(eha)-31 b(vior)357 b(can)g(arise)f(from)h (co)31 b(ordinated)2767 24315 y(simple)313 b(activit)-31 b(y)315 b(of)d(a)g(m)-31 b(ultitude)314 b(of)e(agen)-31 b(ts.)475 b(It)312 b(in)-31 b(tro)31 b(duces)312 b(the)g(language)i (StarL-)2767 25670 y(ogo,)359 b(whic)-31 b(h)354 b(allo)-31 b(ws)355 b(the)e(user)f(to)i(write)g(programs)g(for)f(the)h(agen)-31 b(ts.)488 b(Running)354 b(the)2767 27025 y(program)411 b(demonstrates)g(complex)g(aggregate)h(b)31 b(eha)-31 b(vior,)421 b(whic)-31 b(h)411 b(is)f(often)h(coun-)2767 28380 y(terin)-31 b(tuitiv)g(e.)460 b(Man)-31 b(y)263 b(of)f(the)h(programs)f(in)h(the)f(b)31 b(o)g(ok)262 b(w)-31 b(ere)262 b(dev)-31 b(elop)31 b(ed)263 b(b)-31 b(y)263 b(studen)-31 b(ts)2767 29735 y(in)436 b(middle)h(sc)-31 b(ho)31 b(ol)436 b(and)g(high)g(sc)-31 b(ho)31 b(ol.)692 b(Similar)437 b(programs)f(could)g(b)31 b(e)435 b(written)i(in)2767 31090 y(Python)371 b(using)e(simple)h(graphics)g(and)f(threads.)1660 33330 y Fj(\262)554 b Fm(G\304)-566 b(odel,)387 b(Escher)382 b(and)i(Bach)355 b Fn(b)-31 b(y)355 b(Douglas)i(Hofstadter.)489 b(Put)356 b(simply)-92 b(,)359 b(if)d(y)-31 b(ou)356 b(found)2767 34685 y(magic)549 b(in)e(recursion)f(y)-31 b(ou)547 b(will)i(also)e(\257nd)f(it)i(in)f(this)g(b)31 b(estselling)548 b(b)31 b(o)g(ok.)1025 b(One)2767 36040 y(of)313 b(Hofstadter's)g(themes)f(in)-31 b(v)g(olv)g(es)314 b(\\strange)f(lo)31 b(ops")312 b(where)g(patterns)g(ev)-31 b(olv)g(e)314 b(and)2767 37395 y(ascend)276 b(un)-31 b(til)278 b(they)e(meet)h(themselv)-31 b(es)277 b(again.)463 b(It)276 b(is)g(Hofstadter's)h(con)-31 b(ten)g(tion)279 b(that)2767 38750 y(suc)-31 b(h)392 b(\\strange)h(lo)31 b(ops")393 b(are)f(an)h(essen)-31 b(tial)393 b(part)f(of)h(what)g (separates)f(the)h(animate)2767 40105 y(from)338 b(the)f(inanimate.)485 b(He)337 b(demonstrates)h(suc)-31 b(h)337 b(patterns)g(in)g(the)h(m)-31 b(usic)337 b(of)h(Bac)-31 b(h,)2767 41460 y(the)370 b(pictures)f(of)h (Esc)-31 b(her)368 b(and)i(G\304)-553 b(odel's)369 b(incompleteness)i (theorem.)p eop %%Page: 241 267 241 266 bop 0 10011 a Fi(App)72 b(endix)862 b(D)0 16400 y Fo(GNU)1033 b(F)-258 b(ree)1032 b(Do)86 b(cumen)-86 b(tation)0 19788 y(License)0 26358 y Fn(V)-92 b(ersion)369 b(1.1,)i(Marc)-31 b(h)369 b(2000)0 29856 y(Cop)-31 b(yrigh)g(t)5507 29823 y(c)5200 29856 y Fj(\260)369 b Fn(2000)i(F)-92 b(ree)367 b(Soft)-31 b(w)g(are)372 b(F)-92 b(oundation,)371 b(Inc.)0 31211 y(59)f(T)-92 b(emple)370 b(Place,)h(Suite)f(330,)h (Boston,)f(MA)f(02111-1307)374 b(USA)0 32566 y(Ev)-31 b(ery)g(one)505 b(is)e(p)31 b(ermitted)505 b(to)f(cop)-31 b(y)505 b(and)f(distribute)g(v)-31 b(erbatim)505 b(copies)f(of)h(this)f (license)0 33921 y(do)31 b(cumen)-31 b(t,)371 b(but)e(c)-31 b(hanging)371 b(it)f(is)f(not)h(allo)-31 b(w)g(ed.)0 38401 y Fl(Pream)-50 b(ble)0 40878 y Fn(The)280 b(purp)31 b(ose)278 b(of)i(this)g(License)f(is)g(to)i(mak)-31 b(e)280 b(a)g(man)-31 b(ual,)300 b(textb)31 b(o)g(ok,)299 b(or)280 b(other)f(written)i(do)31 b(c-)0 42233 y(umen)-31 b(t)395 b(\\free")g(in)g(the)g(sense)e(of)i(freedom:)544 b(to)395 b(assure)f(ev)-31 b(ery)g(one)395 b(the)g(e\256ectiv)-31 b(e)395 b(freedom)0 43588 y(to)422 b(cop)-31 b(y)421 b(and)g(redistribute)g(it,)435 b(with)422 b(or)f(without)i(mo)31 b(difying)423 b(it,)435 b(either)421 b(commercially)0 44942 y(or)312 b(noncommercially)-92 b(.)476 b(Secondarily)-92 b(,)326 b(this)312 b(License)g(preserv)-31 b(es)310 b(for)i(the)g (author)h(and)f(pub-)0 46297 y(lisher)351 b(a)h(w)-31 b(a)g(y)352 b(to)g(get)g(credit)f(for)h(their)f(w)-31 b(ork,)356 b(while)d(not)f(b)31 b(eing)351 b(considered)g(resp)31 b(onsible)0 47652 y(for)369 b(mo)31 b(di\257cations)372 b(made)e(b)-31 b(y)369 b(others.)0 49795 y(This)403 b(License)f(is)g(a) h(kind)g(of)f(\\cop)-31 b(yleft,")415 b(whic)-31 b(h)403 b(means)g(that)g(deriv)-61 b(ativ)-31 b(e)404 b(w)-31 b(orks)403 b(of)g(the)0 51150 y(do)31 b(cumen)-31 b(t)341 b(m)-31 b(ust)341 b(themselv)-31 b(es)341 b(b)31 b(e)339 b(free)h(in)g(the)g(same)h(sense.)482 b(It)340 b(complemen)-31 b(ts)342 b(the)e(GNU)0 52505 y(General)369 b(Public)h(License,)g(whic) -31 b(h)370 b(is)f(a)g(cop)-31 b(yleft)372 b(license)d(designed)h(for)f (free)g(soft)-31 b(w)g(are.)0 54648 y(W)-92 b(e)403 b(ha)-31 b(v)g(e)405 b(designed)f(this)g(License)f(in)h(order)f(to)h(use)f(it)i (for)f(man)-31 b(uals)405 b(for)f(free)f(soft)-31 b(w)g(are,)0 56003 y(b)31 b(ecause)463 b(free)f(soft)-31 b(w)g(are)465 b(needs)e(free)f(do)31 b(cumen)-31 b(tation:)684 b(a)463 b(free)g(program)h(should)f(come)0 57358 y(with)486 b(man)-31 b(uals)487 b(pro)-31 b(viding)487 b(the)e(same)h(freedoms)f(that)h(the) f(soft)-31 b(w)g(are)487 b(do)31 b(es.)840 b(But)486 b(this)p eop %%Page: 242 268 242 267 bop 0 -2070 a Fv(242)17042 b(GNU)425 b(F)-106 b(ree)425 b(Do)35 b(cumen)-35 b(tation)426 b(License)p 0 -1627 38191 45 v 0 865 a Fn(License)349 b(is)g(not)i(limited)g(to)f (soft)-31 b(w)g(are)351 b(man)-31 b(uals;)358 b(it)350 b(can)g(b)31 b(e)349 b(used)g(for)g(an)-31 b(y)350 b(textual)i(w)-31 b(ork,)0 2220 y(regardless)414 b(of)h(sub)61 b(ject)416 b(matter)g(or)e(whether)h(it)h(is)e(published)h(as)g(a)g(prin)-31 b(ted)415 b(b)31 b(o)g(ok.)630 b(W)-92 b(e)0 3575 y(recommend)445 b(this)f(License)g(principally)j(for)d(w)-31 b(orks)444 b(whose)h(purp)31 b(ose)443 b(is)i(instruction)g(or)0 4930 y(reference.)0 9670 y Fl(D.1)1794 b(Applicabilit)-50 b(y)600 b(and)e(De\257nitions)0 12276 y Fn(This)352 b(License)e (applies)j(to)e(an)-31 b(y)352 b(man)-31 b(ual)354 b(or)d(other)g(w)-31 b(ork)352 b(that)h(con)-31 b(tains)352 b(a)g(notice)g(placed)0 13631 y(b)-31 b(y)492 b(the)f(cop)-31 b(yrigh)g(t)494 b(holder)e(sa)-31 b(ying)492 b(it)h(can)e(b)31 b(e)491 b(distributed)i(under)d(the)i(terms)g(of)g(this)0 14986 y(License.)891 b(The)502 b(\\Do)31 b(cumen)-31 b(t,")538 b(b)31 b(elo)-31 b(w,)537 b(refers)501 b(to)i(an)-31 b(y)503 b(suc)-31 b(h)501 b(man)-31 b(ual)504 b(or)e(w)-31 b(ork.)892 b(An)-31 b(y)0 16341 y(mem)g(b)31 b(er)369 b(of)h(the)g(public)f(is)h(a)f(licensee,)h(and)f(is)h(addressed)e(as)h (\\y)-31 b(ou.")0 18583 y(A)409 b(\\Mo)31 b(di\257ed)410 b(V)-92 b(ersion")410 b(of)g(the)g(Do)31 b(cumen)-31 b(t)410 b(means)g(an)-31 b(y)410 b(w)-31 b(ork)410 b(con)-31 b(taining)413 b(the)c(Do)31 b(cu-)0 19938 y(men)-31 b(t)447 b(or)f(a)g(p)31 b(ortion)447 b(of)f(it,)467 b(either)446 b(copied)g(v)-31 b(erbatim,)468 b(or)446 b(with)h(mo)31 b(di\257cations)448 b(and/or)0 21293 y(translated)371 b(in)-31 b(to)370 b(another)g(language.)0 23534 y(A)467 b(\\Secondary)h(Section")h(is)e(a)g(named)h(app)31 b(endix)468 b(or)e(a)i(fron)-31 b(t-matter)469 b(section)f(of)g(the)0 24889 y(Do)31 b(cumen)-31 b(t)404 b(that)h(deals)e(exclusiv)-31 b(ely)405 b(with)g(the)e(relationship)i(of)f(the)g(publishers)f(or)g (au-)0 26244 y(thors)299 b(of)h(the)f(Do)31 b(cumen)-31 b(t)300 b(to)g(the)g(Do)31 b(cumen)-31 b(t's)300 b(o)-31 b(v)g(erall)301 b(sub)61 b(ject)300 b(\(or)g(to)g(related)g(matters\))0 27599 y(and)421 b(con)-31 b(tains)422 b(nothing)h(that)f(could)f(fall)h (directly)g(within)h(that)f(o)-31 b(v)g(erall)422 b(sub)61 b(ject.)648 b(\(F)-92 b(or)0 28954 y(example,)463 b(if)443 b(the)g(Do)31 b(cumen)-31 b(t)444 b(is)e(in)h(part)g(a)g(textb)31 b(o)g(ok)445 b(of)e(mathematics,)464 b(a)443 b(Secondary)0 30309 y(Section)339 b(ma)-31 b(y)339 b(not)f(explain)h(an)-31 b(y)339 b(mathematics.\))485 b(The)338 b(relationship)h(could)g(b)31 b(e)337 b(a)h(matter)0 31664 y(of)470 b(historical)h(connection)g(with) g(the)e(sub)61 b(ject)470 b(or)f(with)i(related)f(matters,)496 b(or)469 b(of)h(legal,)0 33019 y(commercial,)372 b(philosophical,)g (ethical,)g(or)d(p)31 b(olitical)372 b(p)31 b(osition)371 b(regarding)f(them.)0 35261 y(The)448 b(\\In)-31 b(v)-61 b(arian)-31 b(t)449 b(Sections")g(are)e(certain)i(Secondary)f(Sections) g(whose)g(titles)h(are)f(des-)0 36616 y(ignated,)459 b(as)440 b(b)31 b(eing)440 b(those)g(of)g(In)-31 b(v)-61 b(arian)-31 b(t)441 b(Sections,)458 b(in)440 b(the)g(notice)g(that)h (sa)-31 b(ys)440 b(that)h(the)0 37971 y(Do)31 b(cumen)-31 b(t)370 b(is)f(released)g(under)g(this)g(License.)0 40212 y(The)396 b(\\Co)-31 b(v)g(er)397 b(T)-92 b(exts")397 b(are)f(certain)h(short)e(passages)h(of)h(text)g(that)g(are)e(listed,) 404 b(as)396 b(F)-92 b(ron)-31 b(t-)0 41567 y(Co)g(v)g(er)355 b(T)-92 b(exts)354 b(or)g(Bac)-31 b(k-Co)g(v)g(er)356 b(T)-92 b(exts,)358 b(in)d(the)f(notice)h(that)h(sa)-31 b(ys)354 b(that)h(the)f(Do)31 b(cumen)-31 b(t)355 b(is)0 42922 y(released)369 b(under)g(this)g(License.)0 45164 y(A)355 b(\\T)-92 b(ransparen)-31 b(t")357 b(cop)-31 b(y)356 b(of)g(the)g(Do)31 b(cumen)-31 b(t)356 b(means)g(a)f(mac)-31 b(hine-readable)358 b(cop)-31 b(y)-92 b(,)359 b(repre-)0 46519 y(sen)-31 b(ted)379 b(in)g(a)g(format)h(whose)f(sp)31 b(eci\257cation)380 b(is)f(a)-31 b(v)-61 b(ailable)381 b(to)f(the)f(general)g(public,)k(whose)0 47874 y(con)-31 b(ten)g(ts)411 b(can)e(b)31 b(e)409 b(view)-31 b(ed)411 b(and)f(edited)g(directly)g(and)g(straigh)-31 b(tforw)g(ardly)413 b(with)e(generic)0 49229 y(text)424 b(editors)g(or)g(\(for)g(images)h (comp)31 b(osed)424 b(of)g(pixels\))g(generic)g(pain)-31 b(t)425 b(programs)f(or)f(\(for)0 50584 y(dra)-31 b(wings\))300 b(some)f(widely)g(a)-31 b(v)-61 b(ailable)301 b(dra)-31 b(wing)300 b(editor,)314 b(and)298 b(that)i(is)e(suitable)i(for)e (input)h(to)0 51938 y(text)364 b(formatters)f(or)g(for)f(automatic)k (translation)f(to)e(a)g(v)-61 b(ariet)-31 b(y)363 b(of)g(formats)h (suitable)g(for)0 53293 y(input)372 b(to)f(text)h(formatters.)499 b(A)371 b(cop)-31 b(y)372 b(made)g(in)f(an)g(otherwise)h(T)-92 b(ransparen)-31 b(t)371 b(\257le)g(format)0 54648 y(whose)362 b(markup)f(has)g(b)31 b(een)361 b(designed)g(to)h(th)-31 b(w)g(art)363 b(or)e(discourage)h(subsequen)-31 b(t)362 b(mo)31 b(di\257ca-)0 56003 y(tion)393 b(b)-31 b(y)393 b(readers)e(is)h(not)h(T)-92 b(ransparen)-31 b(t.)562 b(A)392 b(cop)-31 b(y)393 b(that)g(is)f(not)h(\\T)-92 b(ransparen)-31 b(t")394 b(is)e(called)0 57358 y(\\Opaque.")p eop %%Page: 243 269 243 268 bop 0 -2070 a Fv(D.2)425 b(V)-106 b(erbatim)425 b(Cop)-35 b(ying)23670 b(243)p 0 -1627 38191 45 v 0 865 a Fn(Examples)248 b(of)f(suitable)h(formats)f(for)g(T)-92 b(ransparen)-31 b(t)247 b(copies)g(include)g(plain)h(ASCI)31 b(I)246 b(without)0 2220 y(markup,)543 b(T)-92 b(exinfo)508 b(input)g(format,)544 b(L)16141 1993 y Ff(A)16629 2220 y Fn(T)17243 2458 y(E)17859 2220 y(X)507 b(input)h(format,)544 b(SGML)506 b(or)h(XML)g(using)h(a)0 3575 y(publicly)465 b(a)-31 b(v)-61 b(ailable)467 b(DTD,)c(and)h(standard-conforming)i (simple)f(HTML)f(designed)g(for)0 4930 y(h)-31 b(uman)547 b(mo)31 b(di\257cation.)1025 b(Opaque)546 b(formats)h(include)f(P)-31 b(ostScript,)592 b(PDF,)545 b(proprietary)0 6285 y(formats)283 b(that)h(can)e(b)31 b(e)282 b(read)g(and)h(edited)g(only)g(b)-31 b(y)283 b(proprietary)f(w)-31 b(ord)283 b(pro)31 b(cessors,)299 b(SGML)0 7640 y(or)334 b(XML)g(for)g(whic)-31 b(h)335 b(the)f(DTD)g(and/or)g(pro)31 b(cessing)334 b(to)31 b(ols)335 b(are)f(not)h(generally)h(a)-31 b(v)-61 b(ailable,)0 8995 y(and)262 b(the)g(mac)-31 b(hine-generated)264 b(HTML)e(pro)31 b(duced)262 b(b)-31 b(y)262 b(some)g(w)-31 b(ord)262 b(pro)31 b(cessors)261 b(for)h(output)0 10350 y(purp)31 b(oses)368 b(only)-92 b(.)0 12534 y(The)509 b(\\Title)i(P)-31 b(age")511 b(means,)545 b(for)509 b(a)g(prin)-31 b(ted)510 b(b)31 b(o)g(ok,)544 b(the)510 b(title)g(page)g(itself,)545 b(plus)509 b(suc)-31 b(h)0 13889 y(follo)g(wing)339 b(pages)c(as)g(are) g(needed)f(to)i(hold,)343 b(legibly)-92 b(,)344 b(the)335 b(material)j(this)d(License)g(requires)0 15244 y(to)422 b(app)31 b(ear)421 b(in)g(the)h(title)g(page.)650 b(F)-92 b(or)420 b(w)-31 b(orks)421 b(in)h(formats)g(whic)-31 b(h)422 b(do)f(not)h(ha)-31 b(v)g(e)422 b(an)-31 b(y)422 b(title)0 16599 y(page)327 b(as)e(suc)-31 b(h,)335 b(\\Title)328 b(P)-31 b(age")328 b(means)e(the)g(text)h(near)f(the)g(most)h(prominen) -31 b(t)327 b(app)31 b(earance)0 17954 y(of)370 b(the)f(w)-31 b(ork's)370 b(title,)i(preceding)d(the)g(b)31 b(eginning)371 b(of)f(the)f(b)31 b(o)g(dy)369 b(of)h(the)g(text.)0 22521 y Fl(D.2)1794 b(V)-149 b(erbatim)599 b(Cop)-50 b(ying)0 25047 y Fn(Y)-92 b(ou)281 b(ma)-31 b(y)282 b(cop)-31 b(y)282 b(and)f(distribute)h(the)f(Do)31 b(cumen)-31 b(t)282 b(in)f(an)-31 b(y)282 b(medium,)300 b(either)281 b(commercially)0 26402 y(or)396 b(noncommercially)-92 b(,)407 b(pro)-31 b(vided)397 b(that)h(this)e(License,)404 b(the)396 b(cop)-31 b(yrigh)g(t)399 b(notices,)404 b(and)397 b(the)0 27757 y(license)475 b(notice)h(sa)-31 b(ying)476 b(this)f(License)f(applies)h(to)h(the)e(Do)31 b(cumen)-31 b(t)476 b(are)e(repro)31 b(duced)474 b(in)0 29112 y(all)484 b(copies,)511 b(and)483 b(that)h(y)-31 b(ou)483 b(add)f(no)h(other)g (conditions)h(whatso)31 b(ev)-31 b(er)484 b(to)f(those)g(of)g(this)0 30467 y(License.)f(Y)-92 b(ou)336 b(ma)-31 b(y)338 b(not)g(use)e(tec) -31 b(hnical)338 b(measures)e(to)i(obstruct)f(or)f(con)-31 b(trol)338 b(the)f(reading)0 31821 y(or)503 b(further)f(cop)-31 b(ying)505 b(of)e(the)h(copies)f(y)-31 b(ou)504 b(mak)-31 b(e)504 b(or)f(distribute.)895 b(Ho)-31 b(w)g(ev)g(er,)538 b(y)-31 b(ou)504 b(ma)-31 b(y)0 33176 y(accept)448 b(comp)31 b(ensation)450 b(in)d(exc)-31 b(hange)449 b(for)f(copies.)727 b(If)448 b(y)-31 b(ou)448 b(distribute)g(a)g(large)g(enough)0 34531 y(n)-31 b(um)g(b)31 b(er)369 b(of)h(copies)f(y)-31 b(ou)370 b(m)-31 b(ust)370 b(also)g(follo)-31 b(w)372 b(the)e(conditions)h(in)e(Section)h(3.)0 36716 y(Y)-92 b(ou)303 b(ma)-31 b(y)305 b(also)e(lend)h(copies,)317 b(under)302 b(the)i(same)f(conditions)i(stated)f(ab)31 b(o)-31 b(v)g(e,)318 b(and)303 b(y)-31 b(ou)304 b(ma)-31 b(y)0 38070 y(publicly)371 b(displa)-31 b(y)370 b(copies.)0 42638 y Fl(D.3)1794 b(Cop)-50 b(ying)598 b(in)g(Quan)-50 b(tit)g(y)0 45164 y Fn(If)411 b(y)-31 b(ou)412 b(publish)g(prin)-31 b(ted)412 b(copies)f(of)h(the)g(Do)31 b(cumen)-31 b(t)412 b(n)-31 b(um)g(b)31 b(ering)412 b(more)g(than)g(100,)424 b(and)0 46519 y(the)312 b(Do)31 b(cumen)-31 b(t's)312 b(license)g(notice)h(requires)e(Co)-31 b(v)g(er)313 b(T)-92 b(exts,)324 b(y)-31 b(ou)312 b(m)-31 b(ust)313 b(enclose)f(the)g (copies)0 47874 y(in)267 b(co)-31 b(v)g(ers)267 b(that)h(carry)-92 b(,)287 b(clearly)267 b(and)g(legibly)-92 b(,)290 b(all)268 b(these)e(Co)-31 b(v)g(er)268 b(T)-92 b(exts:)442 b(F)-92 b(ron)-31 b(t-Co)g(v)g(er)268 b(T)-92 b(exts)0 49229 y(on)371 b(the)h(fron)-31 b(t)371 b(co)-31 b(v)g(er,)373 b(and)e(Bac)-31 b(k-Co)g(v)g(er)373 b(T)-92 b(exts)371 b(on)h(the)f(bac)-31 b(k)372 b(co)-31 b(v)g(er.)498 b(Both)372 b(co)-31 b(v)g(ers)371 b(m)-31 b(ust)0 50584 y(also)380 b(clearly)g(and)f(legibly)h(iden)-31 b(tify)381 b(y)-31 b(ou)380 b(as)e(the)h(publisher)g(of)g(these)g(copies.)522 b(The)379 b(fron)-31 b(t)0 51938 y(co)g(v)g(er)450 b(m)-31 b(ust)450 b(presen)-31 b(t)450 b(the)f(full)i(title)g(with)g(all)g(w) -31 b(ords)450 b(of)g(the)g(title)h(equally)g(prominen)-31 b(t)0 53293 y(and)449 b(visible.)732 b(Y)-92 b(ou)448 b(ma)-31 b(y)450 b(add)f(other)g(material)i(on)d(the)h(co)-31 b(v)g(ers)449 b(in)g(addition.)733 b(Cop)-31 b(ying)0 54648 y(with)510 b(c)-31 b(hanges)509 b(limited)i(to)f(the)f(co)-31 b(v)g(ers,)544 b(as)509 b(long)h(as)f(they)g(preserv)-31 b(e)508 b(the)h(title)h(of)g(the)0 56003 y(Do)31 b(cumen)-31 b(t)409 b(and)g(satisfy)g(these)f(conditions,)420 b(can)409 b(b)31 b(e)408 b(treated)h(as)f(v)-31 b(erbatim)410 b(cop)-31 b(ying)410 b(in)0 57358 y(other)369 b(resp)31 b(ects.)p eop %%Page: 244 270 244 269 bop 0 -2070 a Fv(244)17042 b(GNU)425 b(F)-106 b(ree)425 b(Do)35 b(cumen)-35 b(tation)426 b(License)p 0 -1627 38191 45 v 0 865 a Fn(If)297 b(the)h(required)f(texts)h(for)f (either)h(co)-31 b(v)g(er)298 b(are)f(to)31 b(o)299 b(v)-31 b(oluminous)300 b(to)e(\257t)f(legibly)-92 b(,)314 b(y)-31 b(ou)299 b(should)0 2220 y(put)461 b(the)g(\257rst)g(ones)f(listed)i (\(as)f(man)-31 b(y)463 b(as)d(\257t)h(reasonably\))i(on)e(the)g (actual)i(co)-31 b(v)g(er,)485 b(and)0 3575 y(con)-31 b(tin)g(ue)371 b(the)e(rest)g(on)-31 b(to)371 b(adjacen)-31 b(t)370 b(pages.)0 5661 y(If)454 b(y)-31 b(ou)455 b(publish)g(or)f (distribute)i(Opaque)f(copies)f(of)h(the)g(Do)31 b(cumen)-31 b(t)455 b(n)-31 b(um)g(b)31 b(ering)456 b(more)0 7016 y(than)410 b(100,)420 b(y)-31 b(ou)409 b(m)-31 b(ust)410 b(either)f(include)g(a)g(mac)-31 b(hine-readable)412 b(T)-92 b(ransparen)-31 b(t)409 b(cop)-31 b(y)409 b(along)0 8371 y(with)365 b(eac)-31 b(h)363 b(Opaque)h(cop)-31 b(y)-92 b(,)366 b(or)d(state)h(in)g(or)f(with)i(eac)-31 b(h)364 b(Opaque)f(cop)-31 b(y)365 b(a)e(publicly)i(acces-)0 9726 y(sible)339 b(computer-net)-31 b(w)g(ork)342 b(lo)31 b(cation)342 b(con)-31 b(taining)342 b(a)d(complete)i(T)-92 b(ransparen)-31 b(t)339 b(cop)-31 b(y)340 b(of)g(the)0 11081 y(Do)31 b(cumen)-31 b(t,)406 b(free)397 b(of)h(added)g(material,) 407 b(whic)-31 b(h)399 b(the)f(general)g(net)-31 b(w)g(ork-using)400 b(public)e(has)0 12435 y(access)467 b(to)h(do)-31 b(wnload)469 b(anon)-31 b(ymously)470 b(at)e(no)g(c)-31 b(harge)467 b(using)h(public-standard)g(net)-31 b(w)g(ork)0 13790 y(proto)31 b(cols.)481 b(If)332 b(y)-31 b(ou)332 b(use)f(the)h(latter)h (option,)341 b(y)-31 b(ou)332 b(m)-31 b(ust)333 b(tak)-31 b(e)333 b(reasonably)f(pruden)-31 b(t)332 b(steps,)0 15145 y(when)422 b(y)-31 b(ou)423 b(b)31 b(egin)422 b(distribution)i (of)e(Opaque)h(copies)f(in)g(quan)-31 b(tit)g(y)-92 b(,)438 b(to)423 b(ensure)d(that)k(this)0 16500 y(T)-92 b(ransparen)-31 b(t)302 b(cop)-31 b(y)302 b(will)h(remain)f(th)-31 b(us)301 b(accessible)h(at)g(the)f(stated)i(lo)31 b(cation)303 b(un)-31 b(til)303 b(at)f(least)0 17855 y(one)341 b(y)-31 b(ear)341 b(after)g(the)h(last)f(time)h(y)-31 b(ou)342 b(distribute)f(an)h(Opaque)f(cop)-31 b(y)341 b(\(directly)i(or)d (through)0 19210 y(y)-31 b(our)369 b(agen)-31 b(ts)371 b(or)e(retailers\))h(of)g(that)g(edition)h(to)f(the)f(public.)0 21296 y(It)331 b(is)h(requested,)339 b(but)331 b(not)h(required,)339 b(that)333 b(y)-31 b(ou)332 b(con)-31 b(tact)333 b(the)f(authors)g(of)g (the)f(Do)31 b(cumen)-31 b(t)0 22651 y(w)g(ell)373 b(b)31 b(efore)372 b(redistributing)h(an)-31 b(y)372 b(large)h(n)-31 b(um)g(b)31 b(er)372 b(of)g(copies,)h(to)g(giv)-31 b(e)373 b(them)f(a)g(c)-31 b(hance)372 b(to)0 24006 y(pro)-31 b(vide)370 b(y)-31 b(ou)370 b(with)g(an)g(up)31 b(dated)369 b(v)-31 b(ersion)370 b(of)g(the)f(Do)31 b(cumen)-31 b(t.)0 28405 y Fl(D.4)1794 b(Mo)50 b(di\257cations)0 30825 y Fn(Y)-92 b(ou)459 b(ma)-31 b(y)459 b(cop)-31 b(y)459 b(and)g(distribute)g(a)g(Mo)31 b(di\257ed)458 b(V)-92 b(ersion)458 b(of)h(the)g(Do)31 b(cumen)-31 b(t)459 b(under)f(the)0 32180 y(conditions)k(of)e(Sections)h(2)g(and)f(3)g(ab)31 b(o)-31 b(v)g(e,)485 b(pro)-31 b(vided)460 b(that)i(y)-31 b(ou)461 b(release)e(the)i(Mo)31 b(di\257ed)0 33535 y(V)-92 b(ersion)410 b(under)g(precisely)g(this)g(License,)421 b(with)411 b(the)g(Mo)31 b(di\257ed)410 b(V)-92 b(ersion)410 b(\257lling)i(the)f(role)0 34890 y(of)417 b(the)g(Do)31 b(cumen)-31 b(t,)430 b(th)-31 b(us)416 b(licensing)i(distribution)h (and)d(mo)31 b(di\257cation)420 b(of)d(the)g(Mo)31 b(di\257ed)0 36245 y(V)-92 b(ersion)315 b(to)h(who)31 b(ev)-31 b(er)316 b(p)31 b(ossesses)314 b(a)h(cop)-31 b(y)316 b(of)g(it.)476 b(In)314 b(addition,)329 b(y)-31 b(ou)316 b(m)-31 b(ust)316 b(do)g(these)f(things)0 37599 y(in)369 b(the)h(Mo)31 b(di\257ed)369 b(V)-92 b(ersion:)1660 40018 y Fj(\262)554 b Fn(Use)344 b(in)g(the)f(Title)j(P)-31 b(age)345 b(\(and)f(on)g(the)g (co)-31 b(v)g(ers,)349 b(if)344 b(an)-31 b(y\))345 b(a)f(title)i (distinct)f(from)f(that)2767 41373 y(of)459 b(the)f(Do)31 b(cumen)-31 b(t,)481 b(and)459 b(from)f(those)g(of)h(previous)f(v)-31 b(ersions)458 b(\(whic)-31 b(h)459 b(should,)481 b(if)2767 42728 y(there)451 b(w)-31 b(ere)450 b(an)-31 b(y)-92 b(,)471 b(b)31 b(e)450 b(listed)h(in)g(the)g(History)g(section)g(of)g (the)f(Do)31 b(cumen)-31 b(t\).)738 b(Y)-92 b(ou)2767 44083 y(ma)-31 b(y)450 b(use)d(the)i(same)f(title)i(as)e(a)h(previous)f (v)-31 b(ersion)449 b(if)f(the)h(original)h(publisher)e(of)2767 45438 y(that)371 b(v)-31 b(ersion)369 b(giv)-31 b(es)370 b(p)31 b(ermission.)1660 47605 y Fj(\262)554 b Fn(List)328 b(on)g(the)g(Title)i(P)-31 b(age,)338 b(as)327 b(authors,)337 b(one)328 b(or)f(more)h(p)31 b(ersons)327 b(or)g(en)-31 b(tities)330 b(resp)31 b(on-)2767 48960 y(sible)332 b(for)f(authorship) g(of)h(the)f(mo)31 b(di\257cations)333 b(in)f(the)f(Mo)31 b(di\257ed)331 b(V)-92 b(ersion,)339 b(together)2767 50315 y(with)e(at)f(least)g(\257v)-31 b(e)336 b(of)g(the)f(principal)i (authors)f(of)g(the)f(Do)31 b(cumen)-31 b(t)336 b(\(all)h(of)f(its)g (prin-)2767 51670 y(cipal)371 b(authors,)f(if)g(it)g(has)f(less)f(than) i(\257v)-31 b(e\).)1660 53836 y Fj(\262)554 b Fn(State)317 b(on)f(the)g(Title)i(page)e(the)g(name)h(of)f(the)g(publisher)f(of)i (the)f(Mo)31 b(di\257ed)316 b(V)-92 b(ersion,)2767 55191 y(as)370 b(the)f(publisher.)1660 57358 y Fj(\262)554 b Fn(Preserv)-31 b(e)369 b(all)h(the)g(cop)-31 b(yrigh)g(t)371 b(notices)f(of)g(the)f(Do)31 b(cumen)-31 b(t.)p eop %%Page: 245 271 245 270 bop 0 -2070 a Fv(D.4)425 b(Mo)35 b(di\257cations)26364 b(245)p 0 -1627 38191 45 v 1660 865 a Fj(\262)554 b Fn(Add)470 b(an)f(appropriate)i(cop)-31 b(yrigh)g(t)471 b(notice)f(for)g(y)-31 b(our)469 b(mo)31 b(di\257cations)472 b(adjacen)-31 b(t)471 b(to)2767 2220 y(the)370 b(other)f(cop)-31 b(yrigh)g(t)371 b(notices.)1660 4577 y Fj(\262)554 b Fn(Include,)485 b(immediately)464 b(after)e(the)f(cop)-31 b(yrigh)g(t)463 b(notices,)486 b(a)461 b(license)h(notice)g(giving)2767 5932 y(the)350 b(public)h(p)31 b(ermission)350 b(to)g(use)f(the)h(Mo)31 b(di\257ed)350 b(V)-92 b(ersion)350 b(under)f(the)h(terms)f(of)i(this) 2767 7286 y(License,)370 b(in)f(the)h(form)f(sho)-31 b(wn)370 b(in)g(the)f(Addendum)h(b)31 b(elo)-31 b(w.)1660 9643 y Fj(\262)554 b Fn(Preserv)-31 b(e)420 b(in)h(that)h(license)f (notice)h(the)f(full)h(lists)f(of)g(In)-31 b(v)-61 b(arian)-31 b(t)422 b(Sections)g(and)f(re-)2767 10998 y(quired)370 b(Co)-31 b(v)g(er)370 b(T)-92 b(exts)369 b(giv)-31 b(en)371 b(in)e(the)h(Do)31 b(cumen)-31 b(t's)370 b(license)f(notice.)1660 13354 y Fj(\262)554 b Fn(Include)370 b(an)f(unaltered)h(cop)-31 b(y)370 b(of)f(this)h(License.)1660 15711 y Fj(\262)554 b Fn(Preserv)-31 b(e)311 b(the)h(section)h(en)-31 b(titled)313 b(\\History)-92 b(,")325 b(and)312 b(its)g(title,)325 b(and)312 b(add)g(to)g(it)h(an)f(item)2767 17066 y(stating)333 b(at)f(least)g(the)g(title,)341 b(y)-31 b(ear,)339 b(new)332 b(authors,)339 b(and)332 b(publisher)f(of)g(the)h(Mo)31 b(di\257ed)2767 18421 y(V)-92 b(ersion)285 b(as)g(giv)-31 b(en)286 b(on)f(the)h(Title)g(P)-31 b(age.)466 b(If)285 b(there)f(is)h(no)g(section)h(en)-31 b(titled)287 b(\\History")2767 19776 y(in)314 b(the)g(Do)31 b(cumen)-31 b(t,)326 b(create)313 b(one)h(stating)h(the)f(title,)327 b(y)-31 b(ear,)325 b(authors,)g(and)314 b(publisher)2767 21131 y(of)392 b(the)f(Do)31 b(cumen)-31 b(t)391 b(as)g(giv)-31 b(en)392 b(on)f(its)g(Title)i(P)-31 b(age,)398 b(then)391 b(add)g(an)g(item)h (describing)2767 22486 y(the)370 b(Mo)31 b(di\257ed)369 b(V)-92 b(ersion)369 b(as)g(stated)h(in)g(the)f(previous)h(sen)-31 b(tence.)1660 24842 y Fj(\262)554 b Fn(Preserv)-31 b(e)450 b(the)h(net)-31 b(w)g(ork)452 b(lo)31 b(cation,)474 b(if)451 b(an)-31 b(y)-92 b(,)471 b(giv)-31 b(en)452 b(in)f(the)f(Do)31 b(cumen)-31 b(t)452 b(for)e(public)2767 26197 y(access)395 b(to)g(a)h(T)-92 b(ransparen)-31 b(t)395 b(cop)-31 b(y)395 b(of)h(the)f(Do)31 b(cumen)-31 b(t,)402 b(and)396 b(lik)-31 b(ewise)396 b(the)f(net)-31 b(w)g(ork)2767 27552 y(lo)31 b(cations)486 b(giv)-31 b(en)485 b(in)f(the)g(Do)31 b(cumen)-31 b(t)485 b(for)f(previous)g(v)-31 b(ersions)484 b(it)g(w)-31 b(as)485 b(based)e(on.)2767 28907 y(These)403 b(ma)-31 b(y)404 b(b)31 b(e)402 b(placed)h(in)g(the)g(\\History")h(section.)594 b(Y)-92 b(ou)402 b(ma)-31 b(y)404 b(omit)h(a)d(net)-31 b(w)g(ork)2767 30262 y(lo)31 b(cation)354 b(for)c(a)h(w)-31 b(ork)352 b(that)g(w)-31 b(as)351 b(published)g(at)h(least)f(four)g(y) -31 b(ears)351 b(b)31 b(efore)350 b(the)h(Do)31 b(c-)2767 31617 y(umen)-31 b(t)462 b(itself,)485 b(or)461 b(if)g(the)g(original)h (publisher)f(of)g(the)g(v)-31 b(ersion)461 b(it)g(refers)f(to)h(giv)-31 b(es)2767 32972 y(p)31 b(ermission.)1660 35328 y Fj(\262)554 b Fn(In)490 b(an)-31 b(y)490 b(section)g(en)-31 b(titled)492 b(\\Ac)-31 b(kno)g(wledgemen)g(ts")494 b(or)489 b(\\Dedications,")523 b(preserv)-31 b(e)2767 36683 y(the)396 b(section's)h(title,)405 b(and)396 b(preserv)-31 b(e)395 b(in)h(the)g(section)g(all)h(the)f (substance)g(and)g(tone)2767 38038 y(of)552 b(eac)-31 b(h)551 b(of)h(the)f(con)-31 b(tributor)553 b(ac)-31 b(kno)g(wledgemen)g(ts)554 b(and/or)e(dedications)h(giv)-31 b(en)2767 39393 y(therein.)1660 41749 y Fj(\262)554 b Fn(Preserv)-31 b(e)264 b(all)h(the)g(In)-31 b(v)-61 b(arian)-31 b(t)265 b(Sections)g(of)g(the)f(Do)31 b(cumen)-31 b(t,)286 b(unaltered)265 b(in)g(their)f(text)2767 43104 y(and)400 b(in)g(their)g(titles.)586 b(Section)401 b(n)-31 b(um)g(b)31 b(ers)399 b(or)h(the)g(equiv)-61 b(alen)-31 b(t)401 b(are)f(not)g (considered)2767 44459 y(part)370 b(of)g(the)f(section)h(titles.)1660 46816 y Fj(\262)554 b Fn(Delete)429 b(an)-31 b(y)429 b(section)g(en)-31 b(titled)431 b(\\Endorsemen)-31 b(ts.")671 b(Suc)-31 b(h)429 b(a)f(section)i(ma)-31 b(y)429 b(not)g(b)31 b(e)2767 48171 y(included)370 b(in)g(the)f(Mo)31 b(di\257ed)369 b(V)-92 b(ersion.)1660 50527 y Fj(\262)554 b Fn(Do)294 b(not)h(retitle)h(an)-31 b(y)294 b(existing)i(section)f(as)f (\\Endorsemen)-31 b(ts")296 b(or)e(to)h(con\260ict)g(in)f(title)2767 51882 y(with)371 b(an)-31 b(y)370 b(In)-31 b(v)-61 b(arian)-31 b(t)370 b(Section.)0 54648 y(If)429 b(the)h(Mo)31 b(di\257ed)430 b(V)-92 b(ersion)429 b(includes)h(new)f(fron)-31 b(t-matter)432 b(sections)e(or)f(app)31 b(endices)430 b(that)0 56003 y(qualify)435 b(as)e(Secondary)g(Sections)h(and)f(con)-31 b(tain)435 b(no)e(material)i(copied)f(from)f(the)g(Do)31 b(cu-)0 57358 y(men)-31 b(t,)288 b(y)-31 b(ou)266 b(ma)-31 b(y)267 b(at)f(y)-31 b(our)266 b(option)h(designate)g(some)f(or)g(all)g (of)g(these)g(sections)g(as)f(in)-31 b(v)-61 b(arian)-31 b(t.)p eop %%Page: 246 272 246 271 bop 0 -2070 a Fv(246)17042 b(GNU)425 b(F)-106 b(ree)425 b(Do)35 b(cumen)-35 b(tation)426 b(License)p 0 -1627 38191 45 v 0 865 a Fn(T)-92 b(o)351 b(do)f(this,)355 b(add)c(their)f(titles)i(to)f(the)g(list)g(of)g(In)-31 b(v)-61 b(arian)-31 b(t)351 b(Sections)g(in)g(the)f(Mo)31 b(di\257ed)351 b(V)-92 b(er-)0 2220 y(sion's)345 b(license)g(notice.) 486 b(These)345 b(titles)h(m)-31 b(ust)345 b(b)31 b(e)345 b(distinct)h(from)f(an)-31 b(y)345 b(other)g(section)h(titles.)0 4750 y(Y)-92 b(ou)416 b(ma)-31 b(y)417 b(add)f(a)g(section)g(en)-31 b(titled)418 b(\\Endorsemen)-31 b(ts,")429 b(pro)-31 b(vided)417 b(it)f(con)-31 b(tains)417 b(nothing)0 6105 y(but)511 b(endorsemen)-31 b(ts)511 b(of)g(y)-31 b(our)511 b(Mo)31 b(di\257ed)511 b(V)-92 b(ersion)510 b(b)-31 b(y)511 b(v)-61 b(arious)511 b(parties|for)g(example,)0 7460 y(statemen)-31 b(ts)300 b(of)e(p)31 b(eer)297 b(review)i(or)f(that)h (the)f(text)h(has)f(b)31 b(een)297 b(appro)-31 b(v)g(ed)299 b(b)-31 b(y)299 b(an)f(organization)0 8815 y(as)369 b(the)h (authoritativ)-31 b(e)372 b(de\257nition)f(of)f(a)f(standard.)0 11345 y(Y)-92 b(ou)303 b(ma)-31 b(y)304 b(add)g(a)f(passage)h(of)f(up)g (to)h(\257v)-31 b(e)303 b(w)-31 b(ords)303 b(as)g(a)g(F)-92 b(ron)-31 b(t-Co)g(v)g(er)304 b(T)-92 b(ext,)318 b(and)303 b(a)g(passage)0 12700 y(of)341 b(up)f(to)i(25)f(w)-31 b(ords)341 b(as)f(a)h(Bac)-31 b(k-Co)g(v)g(er)342 b(T)-92 b(ext,)348 b(to)341 b(the)g(end)f(of)h(the)g(list)g(of)g(Co)-31 b(v)g(er)342 b(T)-92 b(exts)341 b(in)0 14055 y(the)392 b(Mo)31 b(di\257ed)391 b(V)-92 b(ersion.)559 b(Only)392 b(one)g(passage)g(of)f(F)-92 b(ron)-31 b(t-Co)g(v)g(er)393 b(T)-92 b(ext)392 b(and)g(one)f(of)h(Bac)-31 b(k-)0 15410 y(Co)g(v)g(er)281 b(T)-92 b(ext)281 b(ma)-31 b(y)281 b(b)31 b(e)280 b(added)g(b)-31 b(y)280 b(\(or)g(through)h(arrangemen) -31 b(ts)281 b(made)g(b)-31 b(y\))281 b(an)-31 b(y)280 b(one)h(en)-31 b(tit)g(y)-92 b(.)0 16765 y(If)460 b(the)h(Do)31 b(cumen)-31 b(t)461 b(already)h(includes)f(a)g(co)-31 b(v)g(er)461 b(text)g(for)g(the)g(same)g(co)-31 b(v)g(er,)484 b(previously)0 18119 y(added)456 b(b)-31 b(y)456 b(y)-31 b(ou)456 b(or)g(b)-31 b(y)456 b(arrangemen)-31 b(t)457 b(made)g(b)-31 b(y)456 b(the)f(same)i(en)-31 b(tit)g(y)457 b(y)-31 b(ou)457 b(are)e(acting)j(on)0 19474 y(b)31 b(ehalf)292 b(of,)308 b(y)-31 b(ou)292 b(ma)-31 b(y)292 b(not)g(add)f(another;)319 b(but)291 b(y)-31 b(ou)292 b(ma)-31 b(y)292 b(replace)g(the)f(old)h (one,)308 b(on)291 b(explicit)0 20829 y(p)31 b(ermission)369 b(from)h(the)g(previous)f(publisher)g(that)h(added)g(the)f(old)h(one.)0 23359 y(The)477 b(author\(s\))g(and)g(publisher\(s\))f(of)h(the)g(Do)31 b(cumen)-31 b(t)477 b(do)f(not)h(b)-31 b(y)477 b(this)g(License)f(giv) -31 b(e)0 24714 y(p)31 b(ermission)291 b(to)g(use)f(their)h(names)g (for)g(publicit)-31 b(y)293 b(for)e(or)f(to)i(assert)e(or)g(imply)i (endorsemen)-31 b(t)0 26069 y(of)370 b(an)-31 b(y)370 b(Mo)31 b(di\257ed)369 b(V)-92 b(ersion.)0 31675 y Fl(D.5)1794 b(Com)-50 b(bining)598 b(Do)50 b(cumen)-50 b(ts)0 34684 y Fn(Y)-92 b(ou)381 b(ma)-31 b(y)382 b(com)-31 b(bine)382 b(the)f(Do)31 b(cumen)-31 b(t)381 b(with)h(other)f(do)31 b(cumen)-31 b(ts)381 b(released)g(under)f(this)h(Li-)0 36039 y(cense,)294 b(under)275 b(the)h(terms)f(de\257ned)h(in)g (Section)g(4)g(ab)31 b(o)-31 b(v)g(e)277 b(for)f(mo)31 b(di\257ed)276 b(v)-31 b(ersions,)295 b(pro)-31 b(vided)0 37394 y(that)444 b(y)-31 b(ou)444 b(include)g(in)g(the)f(com)-31 b(bination)447 b(all)d(of)g(the)f(In)-31 b(v)-61 b(arian)-31 b(t)445 b(Sections)f(of)g(all)g(of)g(the)0 38749 y(original)379 b(do)31 b(cumen)-31 b(ts,)380 b(unmo)31 b(di\257ed,)381 b(and)c(list)h(them)f(all)h(as)f(In)-31 b(v)-61 b(arian)-31 b(t)378 b(Sections)g(of)g(y)-31 b(our)0 40104 y(com)g(bined)371 b(w)-31 b(ork)370 b(in)f(its)h(license)f(notice.)0 42634 y(The)450 b(com)-31 b(bined)451 b(w)-31 b(ork)450 b(need)f(only)i(con) -31 b(tain)451 b(one)f(cop)-31 b(y)450 b(of)g(this)g(License,)470 b(and)449 b(m)-31 b(ultiple)0 43989 y(iden)g(tical)482 b(In)-31 b(v)-61 b(arian)-31 b(t)481 b(Sections)f(ma)-31 b(y)480 b(b)31 b(e)479 b(replaced)h(with)h(a)e(single)i(cop)-31 b(y)-92 b(.)824 b(If)479 b(there)g(are)0 45344 y(m)-31 b(ultiple)474 b(In)-31 b(v)-61 b(arian)-31 b(t)473 b(Sections)g(with)g (the)f(same)g(name)g(but)g(di\256eren)-31 b(t)472 b(con)-31 b(ten)g(ts,)500 b(mak)-31 b(e)0 46699 y(the)372 b(title)h(of)f(eac)-31 b(h)372 b(suc)-31 b(h)371 b(section)h(unique)g(b)-31 b(y)371 b(adding)i(at)f(the)g(end)f(of)h(it,)h(in)f(paren)-31 b(theses,)0 48054 y(the)385 b(name)h(of)g(the)f(original)j(author)d(or) g(publisher)g(of)h(that)g(section)g(if)g(kno)-31 b(wn,)391 b(or)385 b(else)g(a)0 49408 y(unique)437 b(n)-31 b(um)g(b)31 b(er.)695 b(Mak)-31 b(e)437 b(the)g(same)g(adjustmen)-31 b(t)438 b(to)g(the)f(section)g(titles)h(in)f(the)g(list)g(of)0 50763 y(In)-31 b(v)-61 b(arian)-31 b(t)370 b(Sections)g(in)g(the)f (license)h(notice)g(of)g(the)f(com)-31 b(bined)371 b(w)-31 b(ork.)0 53293 y(In)456 b(the)i(com)-31 b(bination,)482 b(y)-31 b(ou)458 b(m)-31 b(ust)457 b(com)-31 b(bine)459 b(an)-31 b(y)457 b(sections)h(en)-31 b(titled)459 b(\\History")f(in)g (the)0 54648 y(v)-61 b(arious)558 b(original)h(do)31 b(cumen)-31 b(ts,)606 b(forming)559 b(one)f(section)h(en)-31 b(titled)559 b(\\History";)654 b(lik)-31 b(ewise)0 56003 y(com)g(bine)449 b(an)-31 b(y)448 b(sections)g(en)-31 b(titled)449 b(\\Ac)-31 b(kno)g(wledgemen)g(ts,")472 b(and)448 b(an)-31 b(y)448 b(sections)g(en)-31 b(titled)0 57358 y(\\Dedications.")495 b(Y)-92 b(ou)369 b(m)-31 b(ust)370 b(delete)g(all)h(sections)e(en)-31 b(titled)371 b(\\Endorsemen)-31 b(ts.")p eop %%Page: 247 273 247 272 bop 0 -2070 a Fv(D.6)425 b(Collections)g(of)g(Do)35 b(cumen)-35 b(ts)19676 b(247)p 0 -1627 38191 45 v 0 865 a Fl(D.6)1794 b(Collections)598 b(of)g(Do)50 b(cumen)-50 b(ts)0 3723 y Fn(Y)-92 b(ou)456 b(ma)-31 b(y)456 b(mak)-31 b(e)457 b(a)e(collection)j(consisting)f(of)f(the)f(Do)31 b(cumen)-31 b(t)456 b(and)g(other)f(do)31 b(cumen)-31 b(ts)0 5078 y(released)483 b(under)e(this)i(License,)512 b(and)482 b(replace)h(the)g(individual)i(copies)e(of)g(this)g(License)0 6433 y(in)412 b(the)h(v)-61 b(arious)412 b(do)31 b(cumen)-31 b(ts)412 b(with)i(a)e(single)h(cop)-31 b(y)412 b(that)i(is)e(included)g (in)h(the)f(collection,)0 7787 y(pro)-31 b(vided)390 b(that)h(y)-31 b(ou)390 b(follo)-31 b(w)392 b(the)d(rules)g(of)h(this)f (License)g(for)h(v)-31 b(erbatim)391 b(cop)-31 b(ying)391 b(of)e(eac)-31 b(h)0 9142 y(of)370 b(the)f(do)31 b(cumen)-31 b(ts)370 b(in)g(all)g(other)f(resp)31 b(ects.)0 11564 y(Y)-92 b(ou)485 b(ma)-31 b(y)486 b(extract)g(a)f(single)h(do)31 b(cumen)-31 b(t)486 b(from)g(suc)-31 b(h)484 b(a)h(collection,)517 b(and)485 b(distribute)h(it)0 12919 y(individually)387 b(under)382 b(this)i(License,)k(pro)-31 b(vided)384 b(y)-31 b(ou)384 b(insert)f(a)h(cop)-31 b(y)384 b(of)g(this)g(License)f(in)-31 b(to)0 14274 y(the)375 b(extracted)i(do)31 b(cumen)-31 b(t,)378 b(and)d(follo)-31 b(w)378 b(this)e(License)f(in)g(all)i(other) e(resp)31 b(ects)374 b(regarding)0 15629 y(v)-31 b(erbatim)371 b(cop)-31 b(ying)371 b(of)e(that)i(do)31 b(cumen)-31 b(t.)0 20908 y Fl(D.7)1794 b(Aggregation)597 b(with)i(Indep)50 b(enden)-50 b(t)600 b(W)-149 b(orks)0 23766 y Fn(A)437 b(compilation)k(of)c(the)h(Do)31 b(cumen)-31 b(t)438 b(or)e(its)i(deriv)-61 b(ativ)-31 b(es)438 b(with)g(other)g(separate)f (and)h(in-)0 25121 y(dep)31 b(enden)-31 b(t)410 b(do)31 b(cumen)-31 b(ts)411 b(or)f(w)-31 b(orks,)421 b(in)410 b(or)g(on)g(a)h(v)-31 b(olume)411 b(of)g(a)f(storage)h(or)f (distribution)0 26476 y(medium,)506 b(do)31 b(es)477 b(not)h(as)f(a)h(whole)g(coun)-31 b(t)479 b(as)e(a)h(Mo)31 b(di\257ed)477 b(V)-92 b(ersion)477 b(of)h(the)g(Do)31 b(cumen)-31 b(t,)0 27831 y(pro)g(vided)371 b(no)g(compilation)j(cop)-31 b(yrigh)g(t)372 b(is)e(claimed)i(for)f(the)f(compilation.)500 b(Suc)-31 b(h)371 b(a)f(com-)0 29185 y(pilation)406 b(is)c(called)i(an) f(\\aggregate,")415 b(and)403 b(this)h(License)e(do)31 b(es)403 b(not)g(apply)h(to)g(the)f(other)0 30540 y(self-con)-31 b(tained)359 b(w)-31 b(orks)358 b(th)-31 b(us)357 b(compiled)h(with)g (the)g(Do)31 b(cumen)-31 b(t,)360 b(on)d(accoun)-31 b(t)359 b(of)e(their)g(b)31 b(e-)0 31895 y(ing)319 b(th)-31 b(us)318 b(compiled,)331 b(if)318 b(they)h(are)f(not)h(themselv)-31 b(es)319 b(deriv)-61 b(ativ)-31 b(e)319 b(w)-31 b(orks)319 b(of)f(the)h(Do)31 b(cumen)-31 b(t.)0 34317 y(If)413 b(the)h(Co)-31 b(v)g(er)414 b(T)-92 b(ext)414 b(requiremen)-31 b(t)414 b(of)g(Section)h(3)e(is)g(applicable)j(to)e(these)f(copies)h (of)g(the)0 35672 y(Do)31 b(cumen)-31 b(t,)301 b(then)283 b(if)g(the)g(Do)31 b(cumen)-31 b(t)284 b(is)e(less)h(than)g(one)g (quarter)g(of)g(the)g(en)-31 b(tire)283 b(aggregate,)0 37027 y(the)434 b(Do)31 b(cumen)-31 b(t's)435 b(Co)-31 b(v)g(er)435 b(T)-92 b(exts)435 b(ma)-31 b(y)435 b(b)31 b(e)433 b(placed)i(on)f(co)-31 b(v)g(ers)434 b(that)i(surround)d(only)i (the)0 38382 y(Do)31 b(cumen)-31 b(t)342 b(within)g(the)f(aggregate.) 486 b(Otherwise)341 b(they)g(m)-31 b(ust)342 b(app)31 b(ear)341 b(on)g(co)-31 b(v)g(ers)341 b(around)0 39736 y(the)369 b(whole)i(aggregate.)0 45016 y Fl(D.8)1794 b(T)-149 b(ranslation)0 47874 y Fn(T)-92 b(ranslation)355 b(is)e(considered)h(a)f(kind)h(of)g(mo)31 b(di\257cation,)359 b(so)353 b(y)-31 b(ou)354 b(ma)-31 b(y)355 b(distribute)f(transla-)0 49229 y(tions)408 b(of)g(the)f(Do)31 b(cumen)-31 b(t)408 b(under)f(the)g(terms)g(of)h(Section)g(4.)607 b(Replacing)409 b(In)-31 b(v)-61 b(arian)-31 b(t)408 b(Sec-)0 50584 y(tions)338 b(with)g(translations)h(requires)e(sp)31 b(ecial)337 b(p)31 b(ermission)338 b(from)f(their)g(cop)-31 b(yrigh)g(t)340 b(holders,)0 51938 y(but)308 b(y)-31 b(ou)308 b(ma)-31 b(y)309 b(include)f(translations)h(of)f(some)g(or)f(all)i(In)-31 b(v)-61 b(arian)-31 b(t)309 b(Sections)f(in)g(addition)h(to)0 53293 y(the)356 b(original)j(v)-31 b(ersions)356 b(of)g(these)g(In)-31 b(v)-61 b(arian)-31 b(t)358 b(Sections.)489 b(Y)-92 b(ou)356 b(ma)-31 b(y)357 b(include)g(a)g(translation)0 54648 y(of)477 b(this)f(License)g(pro)-31 b(vided)476 b(that)i(y)-31 b(ou)477 b(also)f(include)h(the)f(original)j(English)e(v)-31 b(ersion)476 b(of)0 56003 y(this)338 b(License.)481 b(In)337 b(case)g(of)h(a)f(disagreemen)-31 b(t)339 b(b)31 b(et)-31 b(w)g(een)338 b(the)f(translation)j(and)d(the)h(original)0 57358 y(English)370 b(v)-31 b(ersion)370 b(of)g(this)f(License,)h(the)f (original)j(English)e(v)-31 b(ersion)370 b(will)g(prev)-61 b(ail.)p eop %%Page: 248 274 248 273 bop 0 -2070 a Fv(248)17042 b(GNU)425 b(F)-106 b(ree)425 b(Do)35 b(cumen)-35 b(tation)426 b(License)p 0 -1627 38191 45 v 0 865 a Fl(D.9)1794 b(T)-149 b(ermination)0 3574 y Fn(Y)-92 b(ou)473 b(ma)-31 b(y)474 b(not)f(cop)-31 b(y)-92 b(,)499 b(mo)31 b(dify)-92 b(,)500 b(sublicense,)f(or)472 b(distribute)i(the)f(Do)31 b(cumen)-31 b(t)473 b(except)g(as)0 4929 y(expressly)395 b(pro)-31 b(vided)396 b(for)f(under)f(this)i (License.)570 b(An)-31 b(y)396 b(other)f(attempt)j(to)e(cop)-31 b(y)-92 b(,)402 b(mo)31 b(dify)-92 b(,)0 6284 y(sublicense,)314 b(or)300 b(distribute)h(the)f(Do)31 b(cumen)-31 b(t)301 b(is)f(v)-31 b(oid,)315 b(and)301 b(will)g(automatically)k(terminate)0 7639 y(y)-31 b(our)431 b(righ)-31 b(ts)430 b(under)g(this)h(License.) 675 b(Ho)-31 b(w)g(ev)g(er,)447 b(parties)431 b(who)g(ha)-31 b(v)g(e)431 b(receiv)-31 b(ed)431 b(copies,)446 b(or)0 8994 y(righ)-31 b(ts,)473 b(from)452 b(y)-31 b(ou)453 b(under)d(this)i(License)f(will)j(not)e(ha)-31 b(v)g(e)453 b(their)e(licenses)h(terminated)h(so)0 10348 y(long)370 b(as)g(suc)-31 b(h)368 b(parties)i(remain)g(in)f(full)i(compliance.)0 15309 y Fl(D.10)1793 b(F)-149 b(uture)599 b(Revisions)g(of)f(This)g (License)0 18018 y Fn(The)426 b(F)-92 b(ree)424 b(Soft)-31 b(w)g(are)427 b(F)-92 b(oundation)427 b(ma)-31 b(y)426 b(publish)g(new,)440 b(revised)425 b(v)-31 b(ersions)426 b(of)f(the)h(GNU)0 19373 y(F)-92 b(ree)542 b(Do)31 b(cumen)-31 b(tation)546 b(License)d(from)h(time)g(to)g(time.)1016 b(Suc)-31 b(h)544 b(new)f(v)-31 b(ersions)543 b(will)i(b)31 b(e)0 20728 y(similar)393 b(in)e(spirit)h(to)g(the)f(presen)-31 b(t)391 b(v)-31 b(ersion,)398 b(but)391 b(ma)-31 b(y)392 b(di\256er)f(in)h(detail)g(to)g(address)f(new)0 22083 y(problems)370 b(or)f(concerns.)492 b(See)369 b(h)-31 b(ttp:///www.gn)g(u.org/cop)g(yleft/.)0 24398 y(Eac)g(h)494 b(v)-31 b(ersion)494 b(of)g(the)f(License)g(is)g(giv)-31 b(en)495 b(a)e(distinguishing)j(v)-31 b(ersion)494 b(n)-31 b(um)g(b)31 b(er.)865 b(If)493 b(the)0 25753 y(Do)31 b(cumen)-31 b(t)396 b(sp)31 b(eci\257es)395 b(that)i(a)f(particular)h (n)-31 b(um)g(b)31 b(ered)396 b(v)-31 b(ersion)396 b(of)h(this)f (License)f("or)h(an)-31 b(y)0 27108 y(later)530 b(v)-31 b(ersion")531 b(applies)f(to)g(it,)571 b(y)-31 b(ou)531 b(ha)-31 b(v)g(e)530 b(the)g(option)h(of)f(follo)-31 b(wing)533 b(the)d(terms)g(and)0 28462 y(conditions)386 b(either)f(of)g(that)h(sp)31 b(eci\257ed)384 b(v)-31 b(ersion)385 b(or)g(of)g(an)-31 b(y)385 b(later)g(v)-31 b(ersion)385 b(that)h(has)e(b)31 b(een)0 29817 y(published)420 b(\(not)g(as)f(a)h(draft\))g(b)-31 b(y)420 b(the)f(F)-92 b(ree)418 b(Soft)-31 b(w)g(are)421 b(F)-92 b(oundation.)645 b(If)419 b(the)g(Do)31 b(cumen)-31 b(t)0 31172 y(do)31 b(es)387 b(not)h(sp)31 b(ecify)387 b(a)h(v)-31 b(ersion)388 b(n)-31 b(um)g(b)31 b(er)387 b(of)h(this)f(License,)392 b(y)-31 b(ou)388 b(ma)-31 b(y)389 b(c)-31 b(ho)31 b(ose)387 b(an)-31 b(y)389 b(v)-31 b(ersion)0 32527 y(ev)g(er)369 b(published)g(\(not)i(as)e(a)g(draft\))i(b)-31 b(y)369 b(the)h(F)-92 b(ree)367 b(Soft)-31 b(w)g(are)372 b(F)-92 b(oundation.)0 37488 y Fl(D.11)1793 b(Addendum:)919 b(Ho)-50 b(w)658 b(to)f(Use)h(This)h(License)g(for)5459 39520 y(Y)-149 b(our)598 b(Do)50 b(cumen)-50 b(ts)0 42229 y Fn(T)-92 b(o)264 b(use)f(this)h(License)f(in)g(a)h(do)31 b(cumen)-31 b(t)265 b(y)-31 b(ou)264 b(ha)-31 b(v)g(e)264 b(written,)287 b(include)264 b(a)f(cop)-31 b(y)265 b(of)f(the)f (License)0 43584 y(in)406 b(the)g(do)31 b(cumen)-31 b(t)406 b(and)g(put)g(the)g(follo)-31 b(wing)409 b(cop)-31 b(yrigh)g(t)408 b(and)d(license)h(notices)h(just)e(after)0 44939 y(the)369 b(title)i(page:)2767 47874 y(Cop)-31 b(yrigh)g(t)8280 47841 y(c)7973 47874 y Fj(\260)374 b Fn(YEAR)h(YOUR)g(NAME.)g(P)-31 b(ermission)376 b(is)e(gran)-31 b(ted)376 b(to)g(cop)-31 b(y)-92 b(,)2767 49229 y(distribute)281 b(and/or)f(mo)31 b(dify)280 b(this)g(do)31 b(cumen)-31 b(t)280 b(under)f(the)g(terms)g (of)h(the)g(GNU)2767 50584 y(F)-92 b(ree)423 b(Do)31 b(cumen)-31 b(tation)426 b(License,)438 b(V)-92 b(ersion)423 b(1.1)i(or)f(an)-31 b(y)424 b(later)h(v)-31 b(ersion)424 b(pub-)2767 51938 y(lished)563 b(b)-31 b(y)562 b(the)g(F)-92 b(ree)560 b(Soft)-31 b(w)g(are)564 b(F)-92 b(oundation;)660 b(with)563 b(the)f(In)-31 b(v)-61 b(arian)-31 b(t)563 b(Sec-)2767 53293 y(tions)276 b(b)31 b(eing)276 b(LIST)e(THEIR)h (TITLES,)h(with)h(the)e(F)-92 b(ron)-31 b(t-Co)g(v)g(er)276 b(T)-92 b(exts)275 b(b)31 b(eing)2767 54648 y(LIST,)358 b(and)f(with)h(the)f(Bac)-31 b(k-Co)g(v)g(er)359 b(T)-92 b(exts)357 b(b)31 b(eing)358 b(LIST.)f(A)g(cop)-31 b(y)357 b(of)h(the)f(li-)2767 56003 y(cense)369 b(is)g(included)h(in)g(the)g (section)g(en)-31 b(titled)371 b(\\GNU)f(F)-92 b(ree)368 b(Do)31 b(cumen)-31 b(tation)2767 57358 y(License.")p eop %%Page: 249 275 249 274 bop 0 -2070 a Fv(D.11)425 b(Addendum:)567 b(Ho)-35 b(w)426 b(to)e(Use)i(This)e(License)g(for)h(Y)-106 b(our)426 b(Do)35 b(cumen)-35 b(ts)491 b(249)p 0 -1627 38191 45 v 0 865 a Fn(If)462 b(y)-31 b(ou)463 b(ha)-31 b(v)g(e)464 b(no)e(In)-31 b(v)-61 b(arian)-31 b(t)464 b(Sections,)487 b(write)463 b(\\with)h(no)f(In)-31 b(v)-61 b(arian)-31 b(t)463 b(Sections")h(instead)0 2220 y(of)491 b(sa)-31 b(ying)493 b(whic)-31 b(h)491 b(ones)g(are)g(in)-31 b(v)-61 b(arian)-31 b(t.)860 b(If)490 b(y)-31 b(ou)492 b(ha)-31 b(v)g(e)492 b(no)f(F)-92 b(ron)-31 b(t-Co)g(v)g(er)492 b(T)-92 b(exts,)522 b(write)0 3575 y(\\no)312 b(F)-92 b(ron)-31 b(t-Co)g(v)g(er)313 b(T)-92 b(exts")312 b(instead)g(of)g(\\F) -92 b(ron)-31 b(t-Co)g(v)g(er)313 b(T)-92 b(exts)312 b(b)31 b(eing)311 b(LIST";)i(lik)-31 b(ewise)313 b(for)0 4930 y(Bac)-31 b(k-Co)g(v)g(er)371 b(T)-92 b(exts.)0 7095 y(If)325 b(y)-31 b(our)326 b(do)31 b(cumen)-31 b(t)327 b(con)-31 b(tains)327 b(non)-31 b(trivial)328 b(examples)f(of)f (program)g(co)31 b(de,)335 b(w)-31 b(e)326 b(recommend)0 8450 y(releasing)430 b(these)f(examples)h(in)f(parallel)i(under)d(y)-31 b(our)429 b(c)-31 b(hoice)430 b(of)g(free)e(soft)-31 b(w)g(are)431 b(license,)0 9805 y(suc)-31 b(h)369 b(as)g(the)g(GNU)g (General)h(Public)g(License,)f(to)h(p)31 b(ermit)370 b(their)f(use)g(in)g(free)g(soft)-31 b(w)g(are.)p eop %%Page: 250 276 250 275 bop 0 -2070 a Fv(250)17042 b(GNU)425 b(F)-106 b(ree)425 b(Do)35 b(cumen)-35 b(tation)426 b(License)p 0 -1627 38191 45 v eop %%Page: 251 277 251 276 bop 0 7206 a Fo(Index)0 12740 y Fm(Make)396 b(Way)g(for)g (Ducklings)p Fn(,)370 b(73)0 14102 y Fm(Python)396 b(Libr)-57 b(ary)397 b(R)-57 b(efer)g(enc)g(e)p Fn(,)373 b(79)0 16674 y(ab)31 b(ecedarian,)371 b(73)0 18035 y(abstract)f(class,)g(204)0 19396 y(abstract)g(data)g(t)-31 b(yp)31 b(e,)371 b Fm(se)-57 b(e)452 b Fn(ADT)0 20757 y(access,)369 b(82)0 22118 y(accum)-31 b(ulator,)372 b(162,)f(165,)g(174)0 23479 y(addition)2214 24841 y(fraction,)g(232)0 26202 y(ADT,)f(189,)h(194,)g(195)2214 27563 y(Priorit)-31 b(y)371 b(Queue,)e(197,)i(201)2214 28924 y(Queue,)e(197)2214 30285 y(Stac)-31 b(k,)371 b(190)0 31646 y(algorithm,)h(9,)e(142,)h(143)0 33008 y(aliasing,)h(89,)e(93,)h (108,)g(133)0 34369 y(am)-31 b(biguit)g(y)-92 b(,)373 b(7,)d(129)2214 35730 y(fundamen)-31 b(tal)372 b(theorem,)e(184)0 37091 y(animal)h(game,)g(214)0 38452 y(app)31 b(end)369 b(metho)31 b(d,)371 b(161)0 39813 y(argumen)-31 b(t,)371 b(21,)g(28,)f(33)0 41174 y(arithmetic)h(sequence,)f(63)0 42536 y(assignmen)-31 b(t,)371 b(12,)g(20,)f(59)2214 43897 y(m)-31 b(ultiple)372 b(,)d(70)2214 45258 y(tuple,)h(96,)h(103,)g (164)0 46619 y(attribute,)g(128,)g(135)2214 47980 y(class,)f(159,)h (165)0 49341 y(A)-31 b(ttributeError,)371 b(224)0 51913 y(base)e(case,)h(42,)g(45)0 53275 y(binary)g(op)31 b(erator,)370 b(207,)h(217)0 54636 y(binary)f(tree,)f(205,)i(217)0 55997 y(blo)31 b(c)-31 b(k,)371 b(37,)f(45)0 57358 y(b)31 b(o)g(dy)-92 b(,)369 b(37,)i(45)23246 12740 y(lo)31 b(op,)371 b(61)21032 14098 y(b)31 b(o)g(olean)371 b(expression,)e(35,)h(45)21032 15456 y(b)31 b(o)g(olean)371 b(function,)g(52,)f(165)21032 16815 y(brac)-31 b(k)g(et)370 b(op)31 b(erator,)371 b(71)21032 18173 y(branc)-31 b(h,)370 b(38,)g(45)21032 19531 y(break)f(statemen) -31 b(t,)372 b(117,)f(124)21032 20889 y(bug,)f(4,)g(9)21032 23406 y(call)23246 24764 y(function,)h(21)21032 26122 y(call)g(graph,)f(110)21032 27481 y(Card,)g(157)21032 28839 y(cargo,)h(179,)g(188,)g(205)21032 30197 y(c)-31 b(hained)370 b(conditional,)j(38)21032 31555 y(c)-31 b(haracter,)370 b(71)21032 32913 y(c)-31 b(haracter)370 b(classi\257cation,)i(78)21032 34271 y(c)-31 b(hild)370 b(class,)g(167,)h(177)21032 35629 y(c)-31 b(hild)370 b(no)31 b(de,)370 b(205,)h(217)21032 36987 y(circular)f(bu\256er,)e (204)21032 38345 y(circular)i(de\257nition,)h(53)21032 39703 y(class,)f(127,)h(135)23246 41061 y(Card,)f(157)23246 42419 y(Golfer,)g(203)23246 43777 y(Link)-31 b(edList,)371 b(186)23246 45135 y(No)31 b(de,)370 b(179)23246 46494 y(OldMaidGame,)h(173)23246 47852 y(OldMaidHand,)g(171)23246 49210 y(paren)-31 b(t,)370 b(168,)h(170)23246 50568 y(P)-31 b(oin)g(t,)372 b(151)23246 51926 y(Stac)-31 b(k,)371 b(190)21032 53284 y(class)e(attribute,)j(159,)f(165)21032 54642 y(classi\257cation)23246 56000 y(c)-31 b(haracter,)370 b(78)21032 57358 y(clien)-31 b(t,)371 b(190,)g(195)p eop %%Page: 252 278 252 277 bop 0 -2070 a Fv(252)33130 b(Index)p 0 -1627 38191 45 v 0 865 a Fn(clone,)370 b(93)0 2243 y(cloning,)h(89,)g(108)0 3621 y(co)31 b(ercion,)370 b(33)2214 4999 y(t)-31 b(yp)31 b(e,)370 b(22,)h(111)0 6377 y(collection,)h(181,)f(190)0 7755 y(column,)g(92)0 9132 y(commen)-31 b(t,)372 b(18,)e(20)0 10510 y(comparable,)h(160)0 11888 y(comparison)2214 13266 y(fraction,)g(233)2214 14644 y(string,)f(74)0 16022 y(compile,)h(2,)f (9)0 17400 y(compile-time)i(error,)d(219)0 18778 y(compiler,)i(219)0 20155 y(complete)g(language,)h(53)0 21533 y(complete)f(ordering,)f(160) 0 22911 y(comp)31 b(osition,)294 b(18,)f(20,)f(24,)h(51,)f(157,)h(161)0 24289 y(comp)31 b(ound)370 b(data)g(t)-31 b(yp)31 b(e,)371 b(71,)f(79,)h(127)0 25667 y(comp)31 b(ound)370 b(statemen)-31 b(t,)372 b(37,)e(45)2214 27045 y(b)31 b(o)g(dy)-92 b(,)369 b(37)2214 28423 y(header,)g(37)2214 29801 y(statemen)-31 b(t)371 b(blo)31 b(c)-31 b(k,)371 b(37)0 31178 y(compression,)f(112)0 32556 y(computational)j(pattern,)e(76)0 33934 y(concatenation,)i(17,)d (20,)h(73,)f(75)2214 35312 y(list,)g(85)0 36690 y(condition,)i(45,)e (61,)h(222)0 38068 y(conditional)2214 39446 y(c)-31 b(hained,)371 b(38)0 40824 y(conditional)h(branc)-31 b(hing,)371 b(37)0 42201 y(conditional)h(execution,)f(37)0 43579 y(conditional)h(op)31 b(erator,)371 b(160)0 44957 y(conditional)h(statemen)-31 b(t,)372 b(45)0 46335 y(constan)-31 b(t)371 b(time,)g(199,)g(204)0 47713 y(constructor,)f(127,)h(135,)g(158)0 49091 y(con)-31 b(tin)g(ue)371 b(statemen)-31 b(t,)372 b(118,)e(124)0 50469 y(con)-31 b(v)g(ersion)2214 51847 y(t)g(yp)31 b(e,)370 b(22)0 53224 y(cop)-31 b(y)370 b(mo)31 b(dule,)371 b(133)0 54602 y(cop)-31 b(ying,)371 b(108,)g(133)0 55980 y(coun)-31 b(ter,)370 b(76,)h(79)0 57358 y(coun)-31 b(ting,)372 b(99,)e(112)21032 865 y(cursor,)f(70)21032 3698 y(data)i(structure) 23246 5074 y(generic,)f(190,)h(191)23246 6450 y(recursiv)-31 b(e,)369 b(179,)i(188,)g(206)21032 7825 y(data)g(t)-31 b(yp)31 b(e)23246 9201 y(comp)g(ound,)371 b(71,)f(127)23246 10577 y(dictionary)-92 b(,)372 b(105)23246 11953 y(imm)-31 b(utable,)373 b(95)23246 13329 y(long)e(in)-31 b(teger,)370 b(111)23246 14705 y(tuple,)h(95)23246 16081 y(user-de\257ned,)e(127,)i (229)21032 17457 y(dead)f(co)31 b(de,)369 b(48,)i(58)21032 18833 y(dealing)g(cards,)e(169)21032 20209 y(debugging,)j(4,)e(9,)f (219)21032 21585 y(dec)-31 b(k,)370 b(161)21032 22960 y(decremen)-31 b(t,)370 b(79)21032 24336 y(deep)f(cop)-31 b(y)-92 b(,)370 b(135)21032 25712 y(deep)f(equalit)-31 b(y)-92 b(,)372 b(130,)f(135)21032 27088 y(de\257nition)23246 28464 y(circular,)f(53)23246 29840 y(function,)h(25)23246 31216 y(recursiv)-31 b(e,)369 b(212)21032 32592 y(deletion)23246 33968 y(list,)i(87)21032 35344 y(delimiter,)h(93,)e(121,)h(192,)g(195) 21032 36720 y(denominator,)h(229)21032 38095 y(deterministic,)g(103) 21032 39471 y(dev)-31 b(elopmen)g(t)23246 40847 y(incremen)g(tal,)372 b(49,)e(143)23246 42223 y(planned,)h(143)21032 43599 y(dev)-31 b(elopmen)g(t)372 b(plan,)e(70)21032 44975 y(dictionary)-92 b(,)372 b(92,)e(105,)h(113,)g(120,)g(224)23246 46351 y(metho)31 b(d,)371 b(107)23246 47727 y(op)31 b(eration,)371 b(106)21032 49103 y(directory)-92 b(,)370 b(121,)h(124)21032 50479 y(division)23246 51855 y(in)-31 b(teger,)371 b(22)21032 53230 y(do)31 b(cumen)-31 b(tation,)373 b(188)21032 54606 y(dot)d(notation,)j(23,)d(33,)g(107,)h(147,)g(150)21032 55982 y(dot)f(pro)31 b(duct,)370 b(152,)h(156)21032 57358 y(Do)-31 b(yle,)371 b(Arth)-31 b(ur)369 b(Conan,)i(5)p eop %%Page: 253 279 253 278 bop 0 -2070 a Fv(Index)33129 b(253)p 0 -1627 38191 45 v 0 865 a Fn(elemen)-31 b(t,)371 b(81,)g(93)0 2220 y(em)-31 b(b)31 b(edded)439 b(reference,)456 b(134,)j(179,)f(188,) 4428 3575 y(205)0 4930 y(encapsulate,)371 b(70)0 6285 y(encapsulation,)h(65,)e(132,)h(189,)g(194)0 7640 y(enco)31 b(de,)370 b(158,)h(165)0 8995 y(encrypt,)f(158)0 10350 y(equalit)-31 b(y)-92 b(,)372 b(130)0 11705 y(error)2214 13059 y(compile-time,)h(219)2214 14414 y(run)-31 b(time,)371 b(5,)f(43,)g(219)2214 15769 y(seman)-31 b(tic,)371 b(5,)f(219,)h(225) 2214 17124 y(syn)-31 b(tax,)371 b(4,)f(219)0 18479 y(error)e(c)-31 b(hec)g(king,)371 b(57)0 19834 y(error)d(handling,)j(214)0 21189 y(error)d(messages,)i(219)0 22544 y(escap)31 b(e)369 b(sequence,)g(64,)h(70)0 23899 y(Euclid,)h(232)0 25254 y(eurek)-61 b(a)369 b(tra)-31 b(v)g(ersal,)371 b(76)0 26609 y(except)f(statemen)-31 b(t,)371 b(122,)g(124)0 27964 y(exception,)g(5,)f(9,)g(122,)h(124,)g(219,)g(223)0 29319 y(executable,)g(9)0 30673 y(execution)2214 32028 y(\260o)-31 b(w,)371 b(223)0 33383 y(expression,)e(16,)i(20,)f(192)2214 34738 y(big)g(and)f(hairy)-92 b(,)370 b(226)2214 36093 y(b)31 b(o)g(olean,)371 b(35,)f(45)0 37448 y(expression)f(tree,)g(207,) i(210)0 39744 y(factorial)h(function,)f(54,)f(57)0 41099 y(Fib)31 b(onacci)370 b(function,)h(56,)g(109)0 42454 y(FIF)-31 b(O,)369 b(197,)i(204)0 43809 y(\257le,)f(115,)h(124)2214 45164 y(text,)g(117)0 46519 y(\260oat,)g(11)0 47874 y(\260oating-p)31 b(oin)-31 b(t,)373 b(20,)e(127)0 49229 y(\260o)-31 b(w)370 b(of)g(execution,)h(28,)f(33,)h(223)0 50584 y(for)e(lo)31 b(op,)371 b(72,)f(84)0 51938 y(formal)h(language,)h(6,)d(9)0 53293 y(format)i(op)31 b(erator,)370 b(118,)h(124,)g(203,)g(224)0 54648 y(format)g(string,)f(118,)h(124)0 56003 y(frab)61 b(juous,)371 b(53)0 57358 y(fraction,)g(229)23246 865 y(addition,)h(232)23246 2221 y(comparison,)f(233)23246 3577 y(m)-31 b(ultiplication,)375 b(230)21032 4933 y(frame,)370 b(30,)h(33,)f(42,)h(110)21032 6289 y(function,)g(25,)g(33,)f(69,)h (137,)g(146)23246 7646 y(argumen)-31 b(t,)371 b(28)23246 9002 y(b)31 b(o)g(olean,)371 b(52,)f(165)23246 10358 y(comp)31 b(osition,)372 b(24,)f(51)23246 11714 y(factorial,)h(54)23246 13070 y(math,)f(23)23246 14426 y(parameter,)g(28)23246 15782 y(recursiv)-31 b(e,)369 b(42)23246 17138 y(tuple)h(as)f(return)g (v)-61 b(alue,)370 b(97)21032 18494 y(function)h(call,)g(21,)f(33)21032 19850 y(function)h(de\257nition,)g(25,)g(33)21032 21206 y(function)g(frame,)f(30,)g(33,)h(42,)f(110)21032 22562 y(function)h(t)-31 b(yp)31 b(e)23246 23918 y(mo)g(di\257er,)370 b(139)23246 25274 y(pure,)f(138)21032 26631 y(functional)453 b(programming)g(st)-31 b(yle,)472 b(140,)25460 27985 y(143)21032 29342 y(fundamen)-31 b(tal)1032 b(am)-31 b(biguit)g(y)1032 b(theorem,)25460 30696 y(188)21032 33179 y(game)23246 34535 y(animal,)372 b(214)21032 35891 y(gamma)g(function,)f(57)21032 37247 y(generalization,)i(65,)e(132,)f (142)21032 38603 y(generalize,)h(70)21032 39959 y(generic)f(data)g (structure,)f(190,)i(191)21032 41315 y(geometric)g(sequence,)e(63)21032 42671 y(Golfer,)h(203)21032 44027 y(greatest)g(common)h(divisor,)g (232,)f(235)21032 45383 y(guardian,)h(58)21032 47866 y(handle)f(exception,)h(122,)g(124)21032 49222 y(handling)g(errors,)d (214)21032 50578 y(hanging,)k(221)21032 51934 y(hello)f(w)-31 b(orld,)370 b(8)21032 53290 y(help)31 b(er)369 b(metho)31 b(d,)371 b(185,)f(188)21032 54646 y(high-lev)-31 b(el)372 b(language,)f(2,)f(9)21032 56002 y(hin)-31 b(t,)371 b(109,)g(113)21032 57358 y(histogram,)h(102,)f(103,)g(112)p eop %%Page: 254 280 254 279 bop 0 -2070 a Fv(254)33130 b(Index)p 0 -1627 38191 45 v 0 865 a Fn(Holmes,)371 b(Sherlo)31 b(c)-31 b(k,)370 b(5)0 3718 y(iden)-31 b(tit)g(y)-92 b(,)372 b(130)0 5096 y(imm)-31 b(utable,)373 b(95)0 6473 y(imm)-31 b(utable)372 b(string,)e(75)0 7850 y(imm)-31 b(utable)372 b(t)-31 b(yp)31 b(e,)370 b(103)0 9227 y(implemen)-31 b(tation)2214 10604 y(Queue,)369 b(197)0 11981 y(impro)-31 b(v)g(ed)371 b(queue,)e(199)0 13358 y(in)g(op)31 b(erator,)371 b(84,)f(164)0 14735 y(incremen)-31 b(t,)371 b(79)0 16112 y(incremen)-31 b(tal)722 b(dev)-31 b(elopmen)g(t,)810 b(49,)e(58,)4428 17467 y(143)0 18844 y(incremen)-31 b(tal)551 b(program)f(dev)-31 b(elopmen)g(t,)4428 20199 y(220)0 21576 y(index,)370 b(72,)h(79,)f(93,)g(105,)h(223)2214 22953 y(negativ)-31 b(e,)372 b(72)0 24330 y(IndexError,)d(224)0 25707 y(in\257nite)h(list,)h(183)0 27085 y(in\257nite)f(lo)31 b(op,)371 b(61,)f(70,)h(221,)g(222)0 28462 y(in\257nite)543 b(recursion,)584 b(43,)i(45,)f(57,)h(221,)4428 29817 y(222)0 31194 y(in\257x,)370 b(192,)h(195,)g(207)0 32571 y(inheritance,)g(167,)g(177)0 33948 y(initialization)j(metho)31 b(d,)371 b(150,)g(156,)g(161)0 35325 y(inorder,)f(208,)g(217)0 36702 y(instance,)g(129,)h(132,)g(135)2214 38079 y(ob)61 b(ject,)371 b(128,)g(146,)g(160)0 39456 y(instan)-31 b(tiate,)373 b(135)0 40833 y(instan)-31 b(tiation,)374 b(128)0 42210 y(in)-31 b(t,)371 b(11)0 43587 y(in)-31 b(teger)2214 44964 y(long,)371 b(111)0 46341 y(in)-31 b(teger)370 b(division,)h(16,)g(20,)f(22)0 47719 y(In)-31 b(tel,)370 b(62)0 49096 y(in)-31 b(terface,)371 b(190,)g(204)0 50473 y(in)-31 b(terpret,)370 b(2,)g(9)0 51850 y(in)-31 b(v)-61 b(arian)-31 b(t,)372 b(187,)f(188)0 53227 y(in)-31 b(v)g(ok)g(e,)372 b(113)0 54604 y(in)-31 b(v)g(oking)372 b(metho)31 b(d,)370 b(107)0 55981 y(irrational,)i(234)0 57358 y(iteration,)g(59,)e(60,)h(70)21032 865 y(join)f(function,)i(92) 21032 3347 y(k)-31 b(ey)-92 b(,)370 b(105,)h(113)21032 4703 y(k)-31 b(ey-v)-61 b(alue)371 b(pair,)f(105,)g(113)21032 6059 y(KeyError,)f(224)21032 7415 y(k)-31 b(eyw)g(ord,)371 b(13,)g(14,)f(20)21032 8771 y(kno)-31 b(wledge)372 b(base,)d(214)21032 11253 y(language,)j(129)23246 12609 y(complete,)f(53)23246 13965 y(formal,)g(6)23246 15321 y(high-lev)-31 b(el,)372 b(2)23246 16677 y(lo)-31 b(w-lev)g(el,)373 b(2)23246 18033 y(natural,)e(6)23246 19389 y(programming,)h(1)23246 20745 y(safe,)e(5)21032 22101 y(leaf)g(no)31 b(de,)370 b(205,)h(217)21032 23457 y(leap)f(of)g(faith,)h(55,)f(182)21032 24813 y(length,)h(83)21032 26169 y(lev)-31 b(el,)371 b(205,)g(217)21032 27525 y(linear)f(time,)h(199,)g(204)21032 28881 y(link,)g(188)21032 30237 y(link)-31 b(ed)371 b(list,)f(179,)h (188)21032 31593 y(link)-31 b(ed)371 b(queue,)e(198,)i(204)21032 32949 y(Link)-31 b(edList,)371 b(186)21032 34305 y(Lin)-31 b(ux,)370 b(6)21032 35661 y(list,)h(81,)f(93,)h(179)23246 37017 y(as)e(parameter,)i(90,)f(181)23246 38374 y(cloning,)i(89)23246 39730 y(elemen)-31 b(t,)371 b(82)23246 41086 y(for)e(lo)31 b(op,)371 b(84)23246 42442 y(in\257nite,)g(183)23246 43798 y(length,)g(83)23246 45154 y(link)-31 b(ed,)371 b(179,)g(188)23246 46510 y(lo)31 b(op,)371 b(183)23246 47866 y(mem)-31 b(b)31 b(ership,)370 b(84)23246 49222 y(mo)31 b(difying,)372 b(184)23246 50578 y(m)-31 b(utable,)372 b(86)23246 51934 y(nested,)e(81,)g(91,)h(108)23246 53290 y(of)f(ob)61 b(jects,)371 b(161)23246 54646 y(prin)-31 b(ting,)371 b(181)23246 56002 y(prin)-31 b(ting)371 b(bac)-31 b(kw)g(ards,)371 b(182)23246 57358 y(slice,)f(86)p eop %%Page: 255 281 255 280 bop 0 -2070 a Fv(Index)33129 b(255)p 0 -1627 38191 45 v 2214 865 a Fn(tra)-31 b(v)g(ersal,)371 b(83,)f(181)2214 2220 y(tra)-31 b(v)g(erse)369 b(recursiv)-31 b(ely)-92 b(,)370 b(182)2214 3575 y(w)-31 b(ell-formed,)372 b(187)0 4930 y(list)e(deletion,)h(87)0 6285 y(list)f(metho)31 b(d,)371 b(112,)g(161)0 7640 y(list)f(op)31 b(eration,)371 b(85)0 8995 y(list)f(tra)-31 b(v)g(ersal,)371 b(93)0 10350 y(literalness,)g(7)0 11705 y(lo)31 b(cal)371 b(v)-61 b(ariable,)370 b(30,)h(33,)f(67)0 13059 y(logarithm,)i(62)0 14414 y(logical)g(op)31 b(erator,)370 b(35,)h(36)0 15769 y(long)f(in)-31 b(teger,)371 b(111)0 17124 y(lo)31 b(op,)371 b(61,)f(70)2214 18479 y(b)31 b(o)g(dy)-92 b(,)369 b(61,)i(70)2214 19834 y(condition,)h(222)2214 21189 y(for)d(lo)31 b(op,)371 b(72)2214 22544 y(in)e(list,)i(183)2214 23899 y(in\257nite,)g(61,)f (222)2214 25254 y(nested,)f(161)2214 26609 y(tra)-31 b(v)g(ersal,)371 b(72)2214 27964 y(while,)g(60)0 29319 y(lo)31 b(op)370 b(v)-61 b(ariable,)371 b(70,)f(169,)h(181)0 30673 y(lo)-31 b(w-lev)g(el)372 b(language,)g(2,)e(9)0 32028 y(lo)-31 b(w)g(ercase,)371 b(78)0 34324 y(map)f(to,)g(158)0 35679 y(math)g(function,)h(23)0 37034 y(mathematical)i(op)31 b(erator,)371 b(230)0 38389 y(matrix,)g(91)2214 39744 y(sparse,)e(108)0 41099 y(McClosk)-31 b(ey)-92 b(,)371 b(Rob)31 b(ert,)369 b(73)0 42454 y(men)-31 b(tal)371 b(mo)31 b(del,)371 b(225)0 43809 y(metho)31 b(d,)371 b(107,)g(113,)f(137,)h(146,)g(156)2214 45164 y(dictionary)-92 b(,)371 b(107)2214 46519 y(help)31 b(er,)369 b(185)2214 47874 y(initialization,)375 b(150,)c(161)2214 49229 y(in)-31 b(v)g(o)31 b(cation,)373 b(107)2214 50584 y(list,)d(112,)h(161)2214 51938 y(wrapp)31 b(er,)369 b(185)0 53293 y(mo)31 b(del)2214 54648 y(men)-31 b(tal,)372 b(225)0 56003 y(mo)31 b(di\257er,)370 b(139,)h(143)0 57358 y(mo)31 b(difying)372 b(lists,)e(184)21032 865 y(mo)31 b(dule,)371 b(23,)f(33,)h(77)23246 2221 y(cop)-31 b(y)-92 b(,)370 b(133)23246 3577 y(string,)g(79)21032 4933 y(mo)31 b(dulus)370 b(op)31 b(erator,)370 b(35,)h(45,)f(169)21032 6289 y(m)-31 b(ultiple)372 b(assignmen)-31 b(t,)371 b(59,)g(70)21032 7646 y(m)-31 b(ultiplication)23246 9002 y(fraction,)371 b(230)21032 10358 y(m)-31 b(utable,)372 b(75,)e(79,)h(95)23246 11714 y(list,)g(86)23246 13070 y(ob)61 b(ject,)371 b(132)21032 14426 y(m)-31 b(utable)371 b(t)-31 b(yp)31 b(e,)370 b(103)21032 16908 y(NameError,)g(223)21032 18264 y(natural)h(language,)h(6,)d(9,)h (129)21032 19620 y(negation,)i(234)21032 20976 y(nested)d(list,)i(91,)f (93,)h(108)21032 22332 y(nested)e(structure,)g(157)21032 23688 y(nesting,)i(45)21032 25045 y(newline,)g(70)21032 26401 y(no)31 b(de,)370 b(179,)h(188,)g(205,)g(217)21032 27757 y(No)31 b(de)370 b(class,)f(179)21032 29113 y(None,)h(48,)h(58) 21032 30469 y(n)-31 b(um)g(b)31 b(er)23246 31825 y(random,)371 b(97)21032 33181 y(n)-31 b(umerator,)371 b(229)21032 35663 y(ob)61 b(ject,)371 b(88,)g(93,)f(127,)h(135)23246 37019 y(list)f(of,)g(161)23246 38375 y(m)-31 b(utable,)372 b(132)21032 39731 y(ob)61 b(ject)371 b(co)31 b(de,)370 b(9)21032 41088 y(ob)61 b(ject)371 b(instance,)f(128,)h(146,)g(160) 21032 42444 y(ob)61 b(ject)371 b(in)-31 b(v)-61 b(arian)-31 b(t,)372 b(187)21032 43800 y(ob)61 b(ject-orien)-31 b(ted)372 b(design,)e(167)21032 45156 y(ob)61 b(ject-orien)-31 b(ted)559 b(programming,)606 b(145,)25460 46511 y(167)21032 47867 y(ob)61 b(ject-orien)-31 b(ted)798 b(programming)f(lan-)25460 49222 y(guage,)371 b(145,)g(156)21032 50578 y(op)31 b(erand,)370 b(16,)g(20)21032 51934 y(op)31 b(eration)23246 53290 y(dictionary)-92 b(,)372 b(106)23246 54646 y(list,)f(85)21032 56002 y(op)31 b(erator,)370 b(16,)h(20)23246 57358 y(binary)-92 b(,)370 b(207,)h(217)p eop %%Page: 256 282 256 281 bop 0 -2070 a Fv(256)33130 b(Index)p 0 -1627 38191 45 v 2214 865 a Fn(brac)-31 b(k)g(et,)371 b(71)2214 2220 y(conditional,)i(160)2214 3575 y(format,)e(118,)g(124,)g(203,)g (224)2214 4930 y(in,)f(84,)g(164)2214 6285 y(logical,)i(35,)f(36)2214 7640 y(mo)31 b(dulus,)370 b(35,)h(169)2214 8995 y(o)-31 b(v)g(erloading,)373 b(152,)d(230)0 10350 y(op)31 b(erator)331 b(o)-31 b(v)g(erloading,)341 b(152,)f(156,)g(160,)4428 11705 y(203)0 13059 y(order)369 b(of)g(ev)-61 b(aluation,)372 b(226)0 14414 y(order)d(of)g(op)31 b(erations,)371 b(16)0 15769 y(ordering,)f(160)0 17124 y(o)-31 b(v)g(er\260o)g(w,)371 b(111)0 18479 y(o)-31 b(v)g(erload,)372 b(230)0 19834 y(o)-31 b(v)g(erloading,)373 b(156)2214 21189 y(op)31 b(erator,)370 b(203)0 22544 y(o)-31 b(v)g(erride,)370 b(156,)h(160)0 24840 y(parameter,)f(28,)h(33,)f(90,)h(129)2214 26195 y(list,)f(90)0 27550 y(paren)-31 b(t)370 b(class,)f(167,)i(168,)g (170,)g(177)0 28905 y(paren)-31 b(t)370 b(no)31 b(de,)369 b(205,)i(217)0 30260 y(parse,)e(7,)h(9,)g(192,)h(195,)g(210)0 31615 y(partial)g(ordering,)f(160)0 32970 y(pass)f(statemen)-31 b(t,)371 b(37)0 34324 y(path,)f(121)0 35679 y(pattern,)g(76)0 37034 y(pattern)g(matc)-31 b(hing,)372 b(103)0 38389 y(P)-31 b(en)g(tium,)372 b(62)0 39744 y(p)31 b(erformance,)370 b(199)0 41099 y(p)31 b(erformance)369 b(hazard,)h(204)0 42454 y(pic)-31 b(kle,)371 b(124)0 43809 y(pic)-31 b(kling,)372 b(121)0 45164 y(planned)e(dev)-31 b(elopmen)g(t,)372 b(143)0 46519 y(p)31 b(o)g(etry)-92 b(,)369 b(7)0 47874 y(P)-31 b(oin)g(t)371 b(class,)f(151)0 49229 y(p)31 b(olymorphic,)371 b(156)0 50584 y(p)31 b(olymorphism,)371 b(153)0 51938 y(p)31 b(op,)370 b(191)0 53293 y(p)31 b(ortabilit)-31 b(y)-92 b(,)372 b(9)0 54648 y(p)31 b(ortable,)371 b(2)0 56003 y(p)31 b(ost\257x,)370 b(192,)h(195,)g(207)0 57358 y(p)31 b(ostorder,)369 b(208,)i(217)21032 865 y(precedence,)e(20,)i (226)21032 2221 y(precondition,)h(183,)f(188)21032 3577 y(pre\257x,)e(208,)i(217)21032 4933 y(preorder,)e(208,)i(217)21032 6289 y(prin)-31 b(t)370 b(statemen)-31 b(t,)372 b(8,)e(9,)g(224)21032 7645 y(prin)-31 b(ting)23246 9001 y(dec)g(k)370 b(ob)61 b(ject,)371 b(161)23246 10357 y(hand)f(of)f(cards,)g(169)23246 11713 y(ob)61 b(ject,)371 b(129,)g(146)21032 13070 y(priorit)-31 b(y)-92 b(,)371 b(203)21032 14426 y(priorit)-31 b(y)371 b(queue,)e(197,)i(204)23246 15782 y(ADT,)f(201)21032 17138 y(priorit)-31 b(y)371 b(queueing,)f(197)21032 18494 y(problem-solving,)i(9)21032 19850 y(pro)31 b(duct,)370 b(212)21032 21206 y(program,)h(9)23246 22562 y(dev)-31 b(elopmen)g(t,)372 b(70)21032 23918 y(program)e(dev)-31 b(elopmen)g(t)23246 25274 y(encapsulation,)372 b(65)23246 26630 y(generalization,)h(65)21032 27986 y(programming)f(language,)f(1) 21032 29342 y(prompt,)g(43,)f(45)21032 30698 y(prose,)f(7)21032 32054 y(protot)-31 b(yp)31 b(e)371 b(dev)-31 b(elopmen)g(t,)372 b(141)21032 33410 y(pro)-31 b(vider,)370 b(190,)h(195)21032 34766 y(pseudo)31 b(co)g(de,)370 b(232)21032 36122 y(pseudorandom,)h (103)21032 37478 y(pure)e(function,)i(138,)g(143)21032 38834 y(push,)e(191)21032 41316 y(queue,)h(197,)h(204)23246 42672 y(impro)-31 b(v)g(ed)371 b(implemen)-31 b(tation,)374 b(199)23246 44028 y(link)-31 b(ed)371 b(implemen)-31 b(tation,)374 b(198)23246 45384 y(List)c(implemen)-31 b(tation,)374 b(197)21032 46740 y(Queue)369 b(ADT,)h(197)21032 48096 y(queueing)g(p)31 b(olicy)-92 b(,)371 b(197,)g(204)21032 50578 y(raise)e(exception,)i(122,)g(124)21032 51934 y(random,)g(163) 21032 53290 y(random)f(n)-31 b(um)g(b)31 b(er,)370 b(97)21032 54646 y(randrange,)g(163)21032 56002 y(rank,)g(157)21032 57358 y(rational,)i(229)p eop %%Page: 257 283 257 282 bop 0 -2070 a Fv(Index)33129 b(257)p 0 -1627 38191 45 v 0 865 a Fn(rectangle,)371 b(131)0 2220 y(recursion,)572 b(40,)h(42,)h(45,)f(53,)h(55,)f(207,)4428 3575 y(208)2214 4930 y(base)369 b(case,)h(42)2214 6285 y(in\257nite,)h(43,)f(57,)h(222) 0 7640 y(recursiv)-31 b(e)513 b(data)j(structure,)550 b(179,)i(188,)4428 8995 y(206)0 10350 y(recursiv)-31 b(e)369 b(de\257nition,)i(212)0 11705 y(reduce,)e(232,)i(235)0 13059 y(redundancy)-92 b(,)369 b(7)0 14414 y(reference,)g(179)2214 15769 y(aliasing,)j(89)2214 17124 y(em)-31 b(b)31 b(edded,)370 b(134,)h(179,)g(188)0 18479 y(regular)f(expression,)f(192)0 19834 y(remo)-31 b(ving)371 b(cards,)e(164)0 21189 y(rep)31 b(etition)2214 22544 y(list,)370 b(85)0 23899 y(return)f(statemen)-31 b(t,)371 b(40,)g(227)0 25254 y(return)e(v)-61 b(alue,)370 b(21,)g(33,)h(47,)f(58,)g(132)2214 26609 y(tuple,)g(97)0 27964 y(role)2214 29319 y(v)-61 b(ariable,)371 b(184)0 30673 y(ro)31 b(ot)370 b(no)31 b(de,)369 b(205,)i(217)0 32028 y(ro)-31 b(w,)370 b(92)0 33383 y(rules)f(of)g(precedence,)g(16,)i (20)0 34738 y(run)-31 b(time)459 b(error,)480 b(5,)h(9,)g(43,)h(72,)g (75,)f(83,)4428 36093 y(96,)296 b(107,)i(109,)f(111,)g(116,)g(119,)4428 37448 y(219,)371 b(223)0 39744 y(safe)e(language,)j(5)0 41099 y(sameness,)d(129)0 42454 y(sca\256olding,)i(48,)g(58)0 43809 y(scalar)f(m)-31 b(ultiplication,)374 b(152,)d(156)0 45164 y(script,)f(9)0 46519 y(seman)-31 b(tic)371 b(error,)d(5,)i(9,)g (97,)h(219,)g(225)0 47874 y(seman)-31 b(tics,)371 b(5,)f(9)0 49229 y(sequence,)f(81,)i(93)0 50584 y(shallo)-31 b(w)371 b(cop)-31 b(y)-92 b(,)370 b(135)0 51938 y(shallo)-31 b(w)371 b(equalit)-31 b(y)-92 b(,)372 b(130,)f(135)0 53293 y(sh)-31 b(u\262e,)370 b(163)0 54648 y(sibling)h(no)31 b(de,)369 b(217)0 56003 y(singleton,)i(185,)g(186,)g(188)0 57358 y(slice,)f(74,)g(79,)h(86)21032 865 y(source)e(co)31 b(de,)369 b(9)21032 2220 y(split)h(function,)h(92)21032 3575 y(Stac)-31 b(k,)371 b(190)21032 4930 y(stac)-31 b(k,)371 b(190)21032 6285 y(stac)-31 b(k)370 b(diagram,)i(30,)e(33,)h (42)21032 7640 y(state)f(diagram,)i(12,)e(20)21032 8995 y(statemen)-31 b(t,)372 b(20)23246 10350 y(assignmen)-31 b(t,)372 b(12,)e(59)23246 11705 y(blo)31 b(c)-31 b(k,)371 b(37)23246 13059 y(break,)f(117,)h(124)23246 14414 y(comp)31 b(ound,)371 b(37)23246 15769 y(conditional,)i(45)23246 17124 y(con)-31 b(tin)g(ue,)371 b(118,)g(124)23246 18479 y(except,)f(122)23246 19834 y(pass,)f(37)23246 21189 y(prin)-31 b(t,)370 b(8,)g(9,)g(224)23246 22544 y(return,)f(40,)i(227) 23246 23899 y(try)-92 b(,)370 b(122)23246 25254 y(while,)h(60)21032 26609 y(straigh)-31 b(t)371 b(\260ush,)e(170)21032 27964 y(string,)h(11)23246 29319 y(imm)-31 b(utable,)373 b(75)23246 30673 y(length,)e(72)23246 32028 y(slice,)f(74)21032 33383 y(string)g(comparison,)h(74)21032 34738 y(string)f(mo)31 b(dule,)370 b(77,)h(79)21032 36093 y(string)f(op)31 b(eration,)371 b(17)21032 37448 y(sub)31 b(class,)369 b(167,)i(170,)g(177)21032 38803 y(sub)31 b(expression,)369 b(213)21032 40158 y(suit,)h(157)21032 41513 y(sum,)g(212)21032 42868 y(sw)-31 b(ap,)371 b(164)21032 44223 y(syn)-31 b(tax,)371 b(4,)f(9,)g(220)21032 45578 y(syn)-31 b(tax)371 b(error,)d(4,)i(9,)g(219)21032 47874 y(tab,)h(70)21032 49229 y(table,)g(62)23246 50584 y(t)-31 b(w)g(o-dimensional,)374 b(64)21032 51938 y(temp)31 b(orary)370 b(v)-61 b(ariable,)371 b(48,)f(58,)h(226)21032 53293 y(text)f(\257le,)g(117,)h(124)21032 54648 y(theorem)23246 56003 y(fundamen)-31 b(tal)372 b(am)-31 b(biguit)g(y)-92 b(,)373 b(184)21032 57358 y(tok)-31 b(en,)371 b(9,)f(192,)h(195,)g(210) p eop %%Page: 258 284 258 283 bop 0 -2070 a Fv(258)33130 b(Index)p 0 -1627 38191 45 v 0 865 a Fn(tracebac)-31 b(k,)371 b(31,)f(33,)h(43,)f(123,)h (223)0 2220 y(tra)-31 b(v)g(ersal,)371 b(72,)f(76,)h(84,)f(172)2214 3575 y(list,)g(83)0 4930 y(tra)-31 b(v)g(erse,)352 b(79,)h(181,)h(182,) f(202,)h(207,)f(208)0 6285 y(tree,)369 b(205)2214 7640 y(empt)-31 b(y)-92 b(,)371 b(206)2214 8995 y(expression,)e(207,)i(210) 2214 10350 y(tra)-31 b(v)g(ersal,)371 b(207,)g(208)0 11705 y(tree)e(no)31 b(de,)370 b(205)0 13059 y(try)-92 b(,)370 b(124)0 14414 y(try)f(statemen)-31 b(t,)372 b(122)0 15769 y(tuple,)e(95,)h(97,)f(103)0 17124 y(tuple)g(assignmen)-31 b(t,)371 b(96,)g(103,)g(164)0 18479 y(T)-92 b(uring)370 b(Thesis,)f(53)0 19834 y(T)-92 b(uring,)370 b(Alan,)h(53)0 21189 y(t)-31 b(yp)31 b(e,)370 b(11,)h(20)2214 22544 y(\260oat,)g(11)2214 23899 y(in)-31 b(t,)371 b(11)2214 25254 y(string,)f(11)0 26609 y(t)-31 b(yp)31 b(e)370 b(c)-31 b(hec)g(king,)371 b(57)0 27964 y(t)-31 b(yp)31 b(e)370 b(co)31 b(ercion,)370 b(22,)g(111)0 29319 y(t)-31 b(yp)31 b(e)370 b(con)-31 b(v)g(ersion,)370 b(22)0 30673 y(T)-31 b(yp)31 b(eError,)370 b(223)0 33135 y(unary)f(negation,)j(235)0 34490 y(unary)d(op)31 b(erator,)370 b(234)0 35845 y(underscore)e(c)-31 b(haracter,)370 b(13)0 37200 y(upp)31 b(ercase,)369 b(78)0 38555 y(user-de\257ned)f(data)i(t)-31 b(yp)31 b(e,)371 b(127)0 41017 y(v)-61 b(alue,)370 b(11,)h(20,)f(88)2214 42372 y(tuple,)g(97)0 43727 y(v)-61 b(ariable,)371 b(12,)f(20)2214 45082 y(lo)31 b(cal,)371 b(30,)g(67)2214 46437 y(lo)31 b(op,)371 b(169)2214 47792 y(roles,)f(184)2214 49146 y(temp)31 b(orary)-92 b(,)370 b(48,)h(58,)f(226)0 50501 y(v)-31 b(eneer,)369 b(191,)i(204)0 52963 y(while)f(statemen)-31 b(t,)372 b(60)0 54318 y(whitespace,)f(78,)f(79)0 55673 y(wrapp)31 b(er,)369 b(188)0 57028 y(wrapp)31 b(er)369 b(metho)31 b(d,)370 b(185)p eop %%Page: 259 285 259 284 bop 0 -2070 a Fv(Index)33129 b(259)p 0 -1627 38191 45 v eop %%Page: 260 286 260 285 bop 0 -2070 a Fv(260)33130 b(Index)p 0 -1627 38191 45 v eop %%Page: 261 287 261 286 bop 0 -2070 a Fv(Index)33129 b(261)p 0 -1627 38191 45 v eop %%Page: 262 288 262 287 bop 0 -2070 a Fv(262)33130 b(Index)p 0 -1627 38191 45 v eop %%Trailer end userdict /end-hook known{end-hook}if %%EOF