[Tutor] Final review

Scott W Dunning scott.w.d at cox.net
Thu May 1 07:21:41 CEST 2014


Hello, I am new to python and have a final review coming up and was hoping you could help me answer a few questions I came across while studying.


So, I get a little confused about lists sometimes.  This one is a little hard to make heads or tails of.  I get confused about how to tell how many lists are within one list like the one below.   How many lists are located inside alist is it 1 or 2, 3??  Also, do spaces count as an index in lists?  

>>> alist = [3, 67, "cat”, [56, 57, “dog”], [], 3.14, False]
>>> print alist[4:]
[[], 3.14, False]


The ouput for below is 2 when it seems like there should be 3 lists located inside x.  Is it [10,20] that is not consider inside of x?    Any tips on how to tell how to spot them more clearly?  

x = ['a', [2.0, 5, [10, 20]]]
print len(x)



I have a few more questions too but I figured I send this email for now while compile my other questions you guys can hopefully help to shed light on. 

Thanks for any help!!

Scott 


More information about the Tutor mailing list