DEV Community

Eddie
Eddie

Posted on

# 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"]
Enter fullscreen mode Exit fullscreen mode

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.

Pythonista on iPad

Top comments (0)