On Tue, Feb 4, 2014 at 11:31 AM, Thomas Maher <tmah...@escambia.k12.fl.us> wrote: > Thank you for helping me. I used a similar code, but with an if statement. > if list1 in list2: > return len(list2[-1]) > > This is the code they sent me this morning. > > def len_of_innerlist(list2): > for ele in list2: > if isinstance(ele, list): > return len(ele) > > list1 = [1,2,3,4,5] > print len_of_innerlist([6,7,8,list1]) > > Tommy Maher
+cc:tutor@python.org ... Wow. Holy wow. Ok. I don't know the LearnStreet folks, but if that's the quality of the problem set, that's a big warning sign for me. If that's their response, then I do stand by what I said earlier. Any "beginning tutorial" material that is using isinstance() there, as a motivating reason to use basic loops and conditions, is not to be trusted. That sounds like the school of "take grab-bag random features of the language and dole them out in lessons." I'd recommend a curriculum that respects their audience. Alan Gauld has written a good tutorial, which you can find here: http://www.alan-g.me.uk/ Also consider "How to Think like a Computer Scientist". http://www.greenteapress.com/thinkpython/ _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor