Archive for the ‘Lists’ Category

Things I’ve Learned


Things I Have Learned while studying Lists:

  1. What a “set” is
  2. Sets are faster for membership testing than lists (Stackoverflow.com)
  3. Stackoverflow.com is an awesome resource (actually just confirmed it)
  4. The Zen of Python: I have the key.

If you want to attain the Zen of Python, comment regarding something significant that you have learned in this unit. It can be short but must be well written and thoughtful. I will then award you the key. (10 pts)

.join( )


As we were studying lists and the .join( ) method, I thought the syntax was odd. If you remember, we discussed that for a list such as,

>>> s = ['ratta', 'tata', 'tata', 'tat']

we could convert it to a string using .join( ) and a delimiter (in this case a space):

>>> ” “.join(t)

This would produce:

(“ratta tata tata tat”)

” “.join(t) looks odd to me. I thought it would should be t.join(” “). So I did some searching on the intertubes. I found my answer, not too shockingly, at stackoverflow.com.

Click the link, read the questions and responses then comment as to why you think  ” “.join(t) was selected by Python developers to convert a list into a string.

Homework: 10 pts.

Think Python, Chapter 10, Lists: 10-1 & 10-2


Read 10-1 thru 10-2 in Think Python.

After reading, add a comment (question or question) on this post regarding a question you have after the reading and doing examples or a comment which summarizes your understanding.  Your comment must

  • Show depth of understanding
  • Can be an extension of the reading as in something you know about the subject but was not covered
  • Will be proof you have read the two sections
  • Merely quoting the text is not acceptable

Comments will account for 10% of your grade for this part of the unit.

We will do the examples in class tomorrow.

Return top