DEV Community

Eddie
Eddie

Posted on

1

# 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

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay