Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79339
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news.astraweb.com!border5.newsrouter.astraweb.com!not-for-mail |
|---|---|
| From | Seymore4Head <Seymore4Head@Hotmail.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: Building lists |
| Date | Mon, 20 Oct 2014 17:25:31 -0400 |
| Message-ID | <glua4ald1elnllqms3mk0aghvgd8vo72av@4ax.com> (permalink) |
| References | <obja4a5ij57rtuaivtvcuqsufhuhk3a2su@4ax.com> <m23sfm$fto$1@reader1.panix.com> |
| X-Newsreader | Forte Agent 4.2/32.1118 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| Lines | 53 |
| Organization | Unlimited download news at news.astraweb.com |
| NNTP-Posting-Host | 92308ca6.news.astraweb.com |
| X-Trace | DXC=93mTe7aaEf8CObSL`Ra@h6L?0kYOcDh@:Ull>Z8KblW7:_j98XRZO97l9B_G1R=S=7<>a^elBcbL9L\a2J2U=lb>>;G_[[=?VT6n8RJ]a;aAX?iZkK5V;eOo5 |
| Xref | csiph.com comp.lang.python:79339 |
Show key headers only | View raw
On Mon, 20 Oct 2014 20:48:54 +0000 (UTC), John Gordon
<gordon@panix.com> wrote:
>In <obja4a5ij57rtuaivtvcuqsufhuhk3a2su@4ax.com> Seymore4Head <Seymore4Head@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. :)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 14:10 -0400
Re: Building lists sohcahtoa82@gmail.com - 2014-10-20 11:18 -0700
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 14:21 -0400
Re: Building lists sohcahtoa82@gmail.com - 2014-10-20 11:33 -0700
Re: Building lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-20 20:55 +0100
Re: Building lists MRAB <python@mrabarnett.plus.com> - 2014-10-20 20:40 +0100
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 15:49 -0400
Re: Building lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-20 13:58 -0600
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 16:23 -0400
Re: Building lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-20 14:45 -0600
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 16:55 -0400
Re: Building lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-20 21:47 +0100
Re: Building lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-20 20:57 +0100
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 16:24 -0400
Re: Building lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-20 22:40 +0000
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 18:44 -0400
Re: Building lists Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-21 10:55 +1100
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 20:05 -0400
Re: Building lists Larry Hudson <orgnut@yahoo.com> - 2014-10-21 00:11 -0700
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-21 08:54 -0400
Re: Building lists Larry Hudson <orgnut@yahoo.com> - 2014-10-21 00:40 -0700
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-21 08:55 -0400
Re: Building lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-20 22:30 +0000
Re: Building lists MRAB <python@mrabarnett.plus.com> - 2014-10-20 23:57 +0100
Re: Building lists John Gordon <gordon@panix.com> - 2014-10-20 20:48 +0000
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 17:25 -0400
Re: Building lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-20 15:34 -0600
Re: Building lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-20 21:31 -0400
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-21 08:55 -0400
Re: Building lists Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-10-21 10:54 +1300
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 17:57 -0400
Re: Building lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-20 21:27 -0400
csiph-web