Commit 25c31458 by Sanjay Krishnan

### first homework assigment

parent 5b1428c3
Showing with 150 additions and 0 deletions
 # Three-Way Iterator Matching *Due 4/19/19 11:59 PM* In this assignment, you will write a 3-way match operator similar to the 2-way match operator you saw in lecture. Consider the following example where you are given three iterable objects i1,i2,i3:  >> i1 = [ 1,7,2,4,6, ... ] # iterable >> i2 = [ 3,6,7,2,1, ... ] # iterable >> i3 = [ 10,6,1,2,3, ... ] # iterable  You should be able to construct a ThreeWayMatchOperator object:  >> threeWayIter = ThreeWayMatchOperator( (i1,i2,i3) )  and this operator should iterate over all values that appear in ALL three iterators. The order is not important  >> for i in threeWayIter: ... print(i) [2,2,2] [1,1,1] [6,6,6]  ## Getting Started Acquaint yourselves with the basic homework submission procedures and please ask us if you have any question on Piazza or during office hours BEFORE the deadline. Remember there are no "slip days" in this class, it is your responsibility to know how to complete and submit the homework assignments. We will run a tutorial on how to use git on Thursday 4/11 2-3 (in 223 JCL). A summary is below: [https://mit.cs.uchicago.edu/skr/cmsc13600-public/tree/master/using-git] * First, pull the most recent changes from the cmsc13600-public repository:  $git pull  * Then, copy the hw0 folder to your submission repository. Change directories to enter your submission repository. * Your code will go into match.py this is the only file that you will modify. * Add match.py using git add $ git add match.py $git commit -m'initialized homework'  ## Doing the homework You will have to implement __next__ and __iter__ to write a 3-way matching operator. One edge case to watch out for is if any of the iterators is empty. In this case, raise an exception. We have provided a series of basic tests in test.py, these tests are incomplete and are not meant to comprehensively grade your assignment. After you finish the assignment you can submit your code with: $ git push