[Tutor] I am teaching my students Python the second semester using www.LearnStreet.com ( http://www.learnstreet.com/ ). I am in need of some help. I am having a problem with the Lists-Set 1 exercise 18. The problem is below. I have put in several codes and the output is 5, which is the right answer. But it is asking for List's index logic. I have tried support with LearnStreet but they have yet to respond. Thank you for your time.

Thomas Maher TMaher1 at escambia.k12.fl.us
Mon Feb 3 21:43:34 CET 2014


I am teaching my students Python the second semester using www.LearnStreet.com ( http://www.learnstreet.com/ ).  I am in need of some help.  I am having a problem with the Lists-Set 1 exercise 18.  The problem is below.  I have put in several codes and the output is 5, which is the right answer.  But it is asking for List's index logic.  I have tried support with LearnStreet but they have yet to respond.  Thank you for your time.
 
 
Tommy Maher
18 : Finding the length of nested lists.

Create two lists list1 = [1,2,3,4,5] and list2 = [6,7,8,list1]. Write a code to find the length of list1 in list2 using for loop. 

Use the if statement to check elements in the list2.

 
def len_of_innerlist(list2):
    # your code here

list1 = [1,2,3,4,5]
print len_of_innerlist([6,7,8,list1])
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140203/f485c666/attachment.html>


More information about the Tutor mailing list