DEV Community

loading...

# Playing with Python lists

Eddie
I'm a noob. I was making HTML 1 with Notepad in 1995. Coming back to it and drinking from a firehose. Love it!
・1 min read

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.

Pythonista on iPad

Discussion (0)