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 Introducing Lists Meet Lists Creation

Jorge Delgado
Jorge Delgado
1,460 Points

What's the difference between using () and [] for lists?

I've seen a couple of people using parenthesis instead of [] for lists, is there any difference between them? Thanks

Mark Nembhard
Mark Nembhard
1,387 Points

What is confusing is that the banner = list ("Congratulations") you have this little jump in knowledge I think, where you create a list from the word Congratulations that has been introduced in an unexplained way.I understand Tuples are different from list but there is no explanation on the use of "list("Congratulations")" example and this is confusing

3 Answers

Steven Parker
Steven Parker
231,269 Points

Brackets [] will create lists, parentheses () create tuples. They can be used in similar ways, but one of the differences is that tuples are immutable.

There's a another course similar to this one called Introducing Tuples that you might enjoy.

Like Steven said, brackets will create what is known in other programming language as arrays and parenthesis will create what is known as tuples. If you want to learn more about the difference between tuples and lists, here is a I have a link for you: https://www.afternerd.com/blog/difference-between-list-tuple/

Rommel Rodriguez
Rommel Rodriguez
2,548 Points

in the video banner = list() the "word" list in front of the () make it a list and not automatically a tuple?

Steven Parker
Steven Parker
231,269 Points

Both types of symbols have different meanings when placed after an identifier. The meanings discussed above only apply when they are used by themselves.