Thomas Maher wrote:

> 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])

Was the isinstance() function already explained in the course?

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to