[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.

Danny Yoo dyoo at hashcollision.org
Tue Feb 4 21:51:34 CET 2014


On Tue, Feb 4, 2014 at 11:31 AM, Thomas Maher
<TMaher1 at 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 at 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/


More information about the Tutor mailing list