<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word"><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content=Word.Document name=ProgId>
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<META content="Microsoft Word 11" name=Originator><LINK
href="cid:filelist.xml@01C6D58A.231723C0" rel=File-List><!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:Zoom>90</w:Zoom>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:DocumentKind>DocumentEmail</w:DocumentKind>
<w:EnvelopeVis/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:UseWord2002TableStyleRules/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
</w:LatentStyles>
</xml><![endif]-->
<STYLE>@font-face {
font-family: Courier;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; mso-header-margin: .5in; mso-footer-margin: .5in; mso-paper-source: 0; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
A:link {
COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.EmailStyle17 {
COLOR: windowtext; FONT-FAMILY: Arial; mso-style-type: personal-compose; mso-style-noshow: yes; mso-ansi-font-size: 10.0pt; mso-bidi-font-size: 10.0pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial
}
SPAN.code1 {
FONT-FAMILY: Courier; mso-ansi-font-size: 10.0pt; mso-bidi-font-size: 10.0pt; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-style-name: code1
}
DIV.Section1 {
page: Section1
}
</STYLE>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
</style>
<![endif]--><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US style="tab-interval: .5in" vLink=purple link=blue>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff size=2>Dear
John,</FONT></SPAN></DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff size=2>This
is a switch. In other words if you have two variables, a and b, switch the
values. The author of the exercise is trying to point out that without the
sequence operation, you must do it the same way as in nearly all other
languages. That is:</FONT></SPAN></DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff size=2>tmp =
a</FONT></SPAN></DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff size=2>a = b
</FONT></SPAN></DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff size=2>b =
tmp</FONT></SPAN></DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff size=2>Python
gives you the ability to switch two variables with just a single
statement. To perform the above with a sequence assignment would
be:</FONT></SPAN></DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff size=2>a, b =
b, a</FONT></SPAN></DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff size=2>Your
example only slightly complicated this by using an array. The answer you
are looking for is:</FONT></SPAN></DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff size=2>
<P class=MsoNormal><SPAN class=code1><SPAN
style="FONT-SIZE: 10pt; COLOR: black"><SPAN class=953474616-11092006>tmp =
self.cards[i]</SPAN></SPAN></SPAN></P>
<P class=MsoNormal><SPAN class=code1><SPAN
style="FONT-SIZE: 10pt; COLOR: black"><SPAN
class=953474616-11092006>self.cards[i] = self.cards[j]</SPAN></SPAN></SPAN></P>
<P class=MsoNormal><SPAN class=code1><SPAN
style="FONT-SIZE: 10pt; COLOR: black"><SPAN
class=953474616-11092006>self.cards[j] =
tmp</SPAN></SPAN></SPAN></P></FONT></SPAN></DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff size=2>Let me
know if you need any more help!</FONT></SPAN></DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff size=2>Yours
truly,</FONT></SPAN></DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff
size=2>Richard Morello</FONT></SPAN></DIV>
<DIV><SPAN class=953474616-11092006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B>
python-list-bounces+richard=sneakerfish.com@python.org
[mailto:python-list-bounces+richard=sneakerfish.com@python.org] <B>On Behalf
Of </B>John Shappell<BR><B>Sent:</B> Monday, September 11, 2006 12:23
PM<BR><B>To:</B> python-list@python.org<BR><B>Subject:</B> assistance with
python coding<BR><BR></FONT></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I don’t understand what this
question is asking; can you clarify for me and maybe point me in the right
direction?<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><I><FONT face="Times New Roman" color=black size=3><SPAN
style="FONT-SIZE: 12pt; COLOR: black; FONT-STYLE: italic">As an exercise,
rewrite this line of code without using a sequence
assignment.</SPAN></FONT></I><FONT color=black><SPAN style="COLOR: black">
<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><SPAN class=code1><FONT face=Courier color=black
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black">self.cards[i],
self.cards[j] = self.cards[j], self.cards[i]</SPAN></FONT></SPAN><FONT
face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-no-proof: yes">V/R</SPAN></FONT><SPAN
style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt; mso-no-proof: yes"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-no-proof: yes">CW2 John
Shappell</SPAN></FONT><SPAN style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-no-proof: yes">931-980-4707</SPAN></FONT><SPAN
style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-no-proof: yes">FAX
775-618-2455</SPAN></FONT><SPAN
style="mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-no-proof: yes"><A
href="mailto:john.j.shappelljr@us.army.mil">john.j.shappelljr@us.army.mil</A></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P></DIV></BLOCKQUOTE></BODY></HTML>