Building lists

Mon Oct 20 23:25:31 CEST 2014

```On Mon, 20 Oct 2014 20:48:54 +0000 (UTC), John Gordon
<gordon at panix.com> wrote:

>In <obja4a5ij57rtuaivtvcuqsufhuhk3a2su at 4ax.com> Seymore4Head <Seymore4Head at Hotmail.invalid> writes:
>
>> Will Python work like this:
>
>Python is a capable general-purpose language, so yes, it can pretty
>much do anything you want.  The trick is knowing how to do it.
>
>> Make a list of 0-50.
>> Then can I add to that list so the second item will hold something
>> like cheese, eggs, milk.
>
>You want one item to have cheese, eggs, and milk?  What's the point
>of calling it one "item" if it holds three things?
>
>> Say then I want to add the price of cheese, eggs and milk.
>> Say then I want to add another list of price of cheese, eggs milk from
>> another store.
>
>> Can this be done starting with just a list of numbers from 0-50?
>> Please no hints, just answer directly how it is done.
>
>Each list item could be a tuple consisting of the item name and a dict
>containing the item's price at various stores, for example:
>
>    # start with an empty list
>    shopping_list = []
>
>    # make a 'cheese' item
>    cheese = ('Cheese', { 'Walmart' : 5.00,
>                          'Publix': 5.50,
>                          'Costco': 4.99 } )
>
>    # add cheese to the shopping list
>    shopping_list.append(cheese)

The thing is I am not really sure what I want.  I do know I need more
practice to find out.  Since I am taking a course now, I can't really
ask a direct question and my first example wasn't so good.

I think what I am going to have to have is a master list that keeps
track of several things and I will need to change some of them so I
know that rules out tuples.

I need more practice examples with indexing and don't know where to
find it.

Thanks

It is hard to ask questions when you don't know all the terms yet.  I
also know that makes it even harder for you guys to answer them.  :)

```