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 trialEnzo Cnop
5,157 PointsThe 'list' function/method was not covered in the previous lesson. What can it be used for alone?
Around 10 seconds into the video, the instructor types "list(5)" and gets an 'int' error. However, in the previous lesson, the instructor never used just the 'list' phrase. He showed us how to make a list (EX: list_numbers = [1, 2, 3] ), but just using list alone wasn't covered. How would one use just list() ? Since the list needs to be 'tied' to a variable to be 'called' into action, isn't this impossible/useless? If I'm being ridiculous, and this was covered, please show me where. If not, how would just "list()" be used?
2 Answers
Christopher Shaw
Python Web Development Techdegree Graduate 58,248 PointsYou can use list(iterable) to create a list from an iterable, such as a string. For example:
list("fred")
Will print ['f', 'r', 'e', 'd']
Eric Fernandez
Python Development Techdegree Student 3,008 Pointsthe list method was covered in the first 3 mins of the video.
Enzo Cnop
5,157 PointsEnzo Cnop
5,157 PointsIf I want to call that list of individual letters, what variable would be used?