Difference between revisions of "CSC111 Final Exam 2015b"

From dftwiki3
Jump to: navigation, search
Line 72: Line 72:
 
* Make sure your program is documented well, and that your name is written at the top of the header.
 
* Make sure your program is documented well, and that your name is written at the top of the header.
 
<br />
 
<br />
 +
<!-- ============================================================= -->
 
=Problem 2: Find the Largest Element of a List of Lists=
 
=Problem 2: Find the Largest Element of a List of Lists=
 
<br />
 
<br />
Line 118: Line 119:
 
==Your Assignment==
 
==Your Assignment==
 
<br />
 
<br />
Using the program above as inspiration, write a program called '''final2.py'''  that contains a '''recursive''' function called findMax().  Your program will get a list from the user, then it will compute and display the largest element of the list.  The list entered by the user may contain sub-lists, as illustrated above.   
+
Using the program above as ''inspiration'', write a program called '''final2.py'''  that contains a '''recursive''' function that will be used to find the largest integer in a list of lists.  Your program will get the main list from the user, then it will compute and print out only the largest element of the list.  The list entered by the user may contain sub-lists, as illustrated above.   
 
<br />
 
<br />
 
==Additional Information==
 
==Additional Information==
Line 127: Line 128:
 
==Restrictions==
 
==Restrictions==
 
<br />
 
<br />
You must use the main function shown below in your program:
+
Your program should
 +
# input a list from the user,
 +
# output a line with the string -o- in it,
 +
# output the largest integer found in the list.
 
<br />
 
<br />
::<source lang="python">
+
Example:
def main():
+
<br />
    # get a list from the user, and evaluate it as a Python list
+
    L = eval( input( "Enter a list: " ) )
+
>>>
    print()
+
Enter a list: [ 1, 2, [3, 4], 5, [6, 7], [8,[9,100] ], (11, 12) ]
 
+
-o-
    # display the largest element in the list.
+
100
    print( findMax( L ) )
+
>>>
 
+
</source>
 
 
<br />
 
<br />
 
==Submission==
 
==Submission==
Line 144: Line 147:
 
* Submit your program to the Final PB 2 section on Moodle.  The automatic evaluation of the program is turned off for this exam.  Make sure it works well with all kinds of lists!
 
* Submit your program to the Final PB 2 section on Moodle.  The automatic evaluation of the program is turned off for this exam.  Make sure it works well with all kinds of lists!
 
<br />
 
<br />
 +
<!-- ============================================================= -->
 +
 
=Problem 3: Frogger Game=
 
=Problem 3: Frogger Game=
 
<br />
 
<br />

Revision as of 17:47, 12 December 2015

--D. Thiebaut (talk) 21:22, 6 December 2015 (EST)


This exam is a take-home exam given under the rules of the Smith College Honor-Code. Please make sure you read it and understand it.

The exam is open book, open notes, and open Web.

You have to do the work individually. No pair-programming allowed! You cannot seek help from anybody for this exam. The TAs will not have consulting hours, and will not be allowed to answer questions relating to Python or the class material. All questions relating to this Final should be directed to your instructor, and posted on Piazza. Posts on piazza should not contain any code. Only questions meant to clarify the exam are allowed. No debugging-related questions will be answered.

The deadline for the exam is Friday, Dec. 22, at 4:00 p.m.' While you are given 8 days on this exam, the programming should not take you more than a day, two at most, so organize your time well. No extensions will be granted beyond the due date and time.


...