Homework help

Dan Upton upton at virginia.edu
Tue Apr 1 14:00:19 EDT 2008


>  > Write a function zip(lst1, lst2) such that zip accepts two equal
>  > length lists and returns a list of pairs. For example, zip(['a', 'b',
>  > 'c'], [10, 20, 30]) should evaluate to the list [('a', 10), ('b', 20),
>  > ('c', 30)].
>
>  Hey not even a rebinding necessary.  :-)
>

We had some exercises like this in Scheme in my undergrad programming
languages class (specifically, rewriting map/mapcar).  It's not that
the method doesn't already exist in the language, it's more about
understanding what's going on at a lower level.



More information about the Python-list mailing list