Playing with Python lists

For the #100DaysOfCode I make sure to do something everyday. I went back and reread a chapter on lists and tuples. It seemed straightforward enough the first time. I can comprehend it, but I don’t grok it. It’s the little things.

At the end of the chapter, it said to “create a list of favorite bands”. So here are some bands…

favorite_bands = ["Concrete Blonde", "Slayer", "Yngwie Malmsteen"]

Simple enough. And I was able to pull one band from that list with a simple print(favorite_bands[2]) bit. I ran a .append() method and all was good.

Then I ran into trouble in printing two lists. The operation and didn’t do it, only printing the last variable. Through trial and error I got it to work with a comma. But when I checked the type of obscure, it returned a string, not a list.

Just goes to show, I have a lot to learn.

Published by Eddie

I'm a goofball. I like Doctor Who, Star Wars (yes, all of them), and of course Firefly. I think that "Out of Gas" from Firefly is the single greatest episode of any SciFi. Closely followed by "All Great Things..." from Star Trek: The Next Generation. I'm an Apple geek. Seriously, I brought a 2013 MBP and two iPads with me on deployment. Every year I watch all the Apple Keynotes. Someday I'd like to learn Swift, as I've got some ideas for some useful apps that I'd like to use. One might find me at a coffee shop, at the LGS getting more Magic: The Gathering cards, on some trail in the mountains of Oregon, on one of my Macs, running a trail, or who knows.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: