Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def nested_list_equal(obj1: Union[int, List], obj2: Union[int, List]) -> bool: Return whether two nested lists are equal, i.e., have the same value. Note: order matters. You

def nested_list_equal(obj1: Union[int, List], obj2: Union[int, List]) -> bool: """Return whether two nested lists are equal, i.e., have the same value. Note: order matters. You should only use == in the base case. Do NOT use it to compare otherwise (as that defeats the purpose of this exercise)! >>> nested_list_equal(17, [1, 2, 3]) False >>> nested_list_equal([1, 2, [1, 2], 4], [1, 2, [1, 2], 4]) True >>> nested_list_equal([1, 2, [1, 2], 4], [4, 2, [2, 1], 3]) False """ # HINT: You'll need to modify the basic pattern to loop over indexes, # so that you can iterate through both obj1 and obj2 in parallel.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

LO2 Distinguish among three types of performance information.

Answered: 1 week ago