Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 11 - Multidimensional Lists - Programming Exercises - Page 391: 11.29

Answer

code

Work Step by Step

# 11.29 (Identical lists) The two-dimensional lists m1 and m2 are identical if they have the # same contents. Write a function that returns True if m1 and m2 are identical, using # the following header: # def equals(m1, m2): # Write a test program that prompts the user to enter two lists of integers and displays # whether the two are identical. def equals(m1, m2): for x in m1: if not(m2.__contains__(x)): return False return True m1 = input("Enter list1: ").split() m2 = input("Enter list2: ").split() if equals(m1, m2): print("Two lists are identical") else: print("Two lists are not identical")
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.