Difference between revisions of "CSC111 Final Exam 2018"
Line 257: | Line 257: | ||
<br /> | <br /> | ||
<br /> | <br /> | ||
− | Write a program containing a recursive function, | + | 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 | + | 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 ) |