Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics (2015) Python Data Types Index

Arikaturika Tumojenko
Arikaturika Tumojenko
8,897 Points

The difference between alpha[1] and alpha_list[1]?

What is the difference between these two? Why do we need to split string alpha into a list so we can work with these methods?

1 Answer

Steven Parker
Steven Parker
229,921 Points

It's indexing that is being demonstrated here, and you're right, there's not much difference between lists and strings in that regard. You could very likely be able to accomplish what you want without any conversion.

But since you mentioned methods, there are different methods available to strings and lists, so perhaps making use of them might be a reason to convert. This isn't covered in this particular video, though. Perhaps you will see some examples in later videos.

Arikaturika Tumojenko
Arikaturika Tumojenko
8,897 Points

Thank you. After further reading I came to the conclusion that the only difference was that alpha was a string and alpha_list was converted to a list, from a string. So i guess the purpose was working with 2 different things.