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

Saikat Chowdhury
Saikat Chowdhury
3,128 Points

Confusion on list creation

why we are creating with list('Congratulation') command. Whenever we know [ ] use for list creation. video link : https://teamtreehouse.com/library/creation-2 time 03.34

Can you provide a link to the video?

1 Answer

Ben Slivinn
Ben Slivinn
10,156 Points

The end result is the same whether you use [ ] or list(). There is a difference in performance, though. [ ] is more performant than the alternative, list(), mainly because using list() involves the overhead of symbol lookup and function invocation.

In my opinion, using [ ] is more pythonic. This notation allows you to take advantage of list comprehension more easily (In my opinion).