Can somone please


(Tuan nguyen) #1

hey yo Can somone please provide a practical example where list attributes would be used against set attributes and vice versa? I’ve looked at all the dog, pear, peach, zebra…examples and doesn’t really ring.

Here’s how I see a use of list & set attributes: ( I need a little nudge to see how I can use them in this context)


(eastgate) #2

A list is a bag of things. For example, we might look out the window and list the colors of passing cars:

MyList: blue; yellow; black; white; blue

We can examine this and say there were five cars, and that two of them were black. We can also say that the first car was blue.

A set is a collection that has no duplicates. If we watched the passing cars and kept the colors in a set, we might have

MySet: blue; yellow; black; white

Now, we can see that there are four distinct colors. (That might be easy to see from the list if it’s a small list, be it would be tedious to learn in we had 1000 cars.). We don’t know how many cars there were — only how many different colors.


(Paul Walters) #3

Did this thread not help?