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 (Retired) Shopping List Lists

Philipp Werminghausen
Philipp Werminghausen
1,271 Points

List vs Array?

Whats the difference between an array in say JavaScript vs a list in ruby? They seem like the same thing, why give them a different name?

1 Answer

In python you can think of a list as something very much like an array. Some languages force arrays to only contain one type object in every position in the array (like, an array of strings or an array of ints) , others allow any type of object in each position. Python lists allow any object type in any slot.

Philipp Werminghausen
Philipp Werminghausen
1,271 Points

Ah okay, that makes sense. So comparing it to a javascript array they would be identical while comparing it to an array from a different language the only difference would be the singular type restriction?