Assignment 6
- Due Jul 19, 2017 by 11:59am
- Points 3
- Submitting a file upload
Write a recursive function called is_equal() that takes two lists and decides if they are equal.
is_equal(lst1, lst2)
Challenge:
You cannot use the Python == or != functions to compare lists. You can use == or != to compare things that are not lists.
Hint: you will want to use the type() function to decide if an element of a list is another list.
Write a program that calls your function on some examples, including those below.
[1, 2, 3, 4] [1, 2, 3, 4] # True
[1, 2, 3, 4] [1, 2, 3] # False
['a', 2, 3.1] ['a', 2, 3.1] # True
['a', 3.1,2 ] ['a', 2, 3.1] # False
[1, 2, [3, 4, [5, 6]]] [1, 2, [3, 4, [5, 6]]] # True
[1, 2, [3, 4, [5, 6]]] [1, 2, [3, 4, [5]]] # False