Difference between revisions of "CSC111 Homework 5 Solution Programs 2014"

From dftwiki3
Jump to: navigation, search
(Program 2)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
--[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 16:02, 12 March 2014 (EDT)
 
--[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 16:02, 12 March 2014 (EDT)
 
----
 
----
 +
 +
<onlydft>
 +
 
=Program #1=
 
=Program #1=
  
Line 163: Line 166:
 
from hw5data import secondWordIndex
 
from hw5data import secondWordIndex
 
from hw5data import thirdWordIndex
 
from hw5data import thirdWordIndex
 +
 +
# Swap words 1, 2, and 3 in place.
 +
# The array originally contains words 1, 2, 3 in this order.
 +
# After the swap it contains words 2, 3, 1 in this order.
  
 
for i in range(secondWordIndex):
 
for i in range(secondWordIndex):
Line 175: Line 182:
 
     array[i] = temp2             
 
     array[i] = temp2             
  
print(array)
+
print( "The new array now contains: ", array )
 
</source>
 
</source>
 +
</onlydft>
 +
 
<br />
 
<br />
 
<br />
 
<br />

Latest revision as of 20:39, 9 January 2015

--D. Thiebaut (talk) 16:02, 12 March 2014 (EDT)



...