Difference between revisions of "CSC111 Midterm Exam Preparation 2015"

From dftwiki3
Jump to: navigation, search
Line 119: Line 119:
  
 
main()
 
main()
 +
</source>
 +
<br />
 +
=Question 11=
 +
<br />>
 +
Assume that we have a list called '''numbers''' (shown below) containing many numbers.  We only show 5 numbers, but the list contain much more.  Write the code that will add up all the numbers and print out their sum.
 +
<br />
 +
::<source lang="python">
 +
numbers = [ 1, 10, -3, 20, ... 5 ]
 
</source>
 
</source>
 
<br />
 
<br />
  
 
+
=Question 12=
 +
<br />
 +
Assume that farm is a Python list that contains several names of animals.  It contains more than 20 different animals.  Only four are shown in the code below, for simplicity.
 +
::<source lang="python">
 +
farm = [ "dog", "cat", "horse", ... , "mouse" ]
 +
</source>
 +
Write the code that will
 
</onlydft>
 
</onlydft>

Revision as of 20:32, 28 February 2015

--D. Thiebaut (talk) 18:08, 28 February 2015 (EST)


Midterm Exam Prep

The midterm is an in-class exam given under the rules of the honor code. It lasts 70 minutes. It will be closed books, closed notes, closed computers.



...