Difference between revisions of "CSC111 Final Exam 2018"

From dftwiki3
Jump to: navigation, search
Line 257: Line 257:
 
<br />
 
<br />
 
<br />
 
<br />
Write a program containing a recursive function, that prompts the user for a list of integers, and prints out "True" if there are two numbers in the list that are consecutive and have the same value, and it prints "False" otherwise.
+
Write a program called '''final4.py''' containing a recursive function similar to the functions we created in class, using Dave and Gru as example.  Your program will prompt the user for a list of integers, and will print "True" if there are two numbers in the list that are consecutive and have the same value, and it prints "False" otherwise.
 
<br />
 
<br />
Your program must use a recursive function to determine if the there exist two consecutive numbers that have the same value.  Programs that do not contain a recursive solution will get 0/100.
+
Your program must use a recursive function to determine if the there exist two consecutive numbers that have the same value.  Programs that solve the problem using an iterative loop, and not using recursion will automatically get 0/100.
 
<br />
 
<br />
 
Examples of interactions with the program:
 
Examples of interactions with the program:
Line 306: Line 306:
  
 
def main():
 
def main():
     bananas = eval(input( "> " ) )
+
     bananas = eval( input( "> " ) )
 
     print()
 
     print()
 
     success = lookFor2( bananas )
 
     success = lookFor2( bananas )

Revision as of 11:23, 29 April 2018

D. Thiebaut (talk) 11:39, 26 April 2018 (EDT)



...