Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def compare(lst1, lst2): if len(lst1) != len(lst2): return False elif(lst1[0] == lst2[0]): return compare(lst1[1:],lst2[1:]) Example output: >>> compare(['ispython',2,3],['ispython',2,3]) True >>> compare(['ispython',2,3],['ISpython',2,3]) False >>> compare(['ispython',2,3],[1,2,3,4]) False

def compare(lst1, lst2):

if len(lst1) != len(lst2):

return False

elif(lst1[0] == lst2[0]):

return compare(lst1[1:],lst2[1:])

Example output:

>>> compare(['ispython',2,3],['ispython',2,3])

True

>>> compare(['ispython',2,3],['ISpython',2,3])

False

>>> compare(['ispython',2,3],[1,2,3,4])

False

The error code Im getting tell me \"list index out of range\". Any help would be really valuable!

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

Pro Android Graphics

Authors: Wallace Jackson

1st Edition

1430257857, 978-1430257851

More Books

Students also viewed these Programming questions

Question

What would you do if the bullies were in your classes?

Answered: 1 week ago