[Tutor] A couple beginner questions.
Eric Henry
ehenry@imt.net
Mon, 24 Sep 2001 23:32:11 -0600
Hi there everyone. I decided work on a small project to sort of get my
feet wet in python and programming in general. I've got a couple of
quick questions for you all. First, is there a built in way to apply
some operation to each item in a list? For example adding 2 to [1,2,3],
and getting [3,4,5].
Second, I need to store some information from a table. Each row has 3
values. Somewhat like this:
[1, 3, 4]
[2, 4, 5]
[3, 1, 1]
From what I understand, a dictionary would let me assign each of those
sets of information a key and retrieve them, but what I need to do is
give it say 3 in the second column(the numbers aren't duplicated
anywhere in each column) and have it return one or four. I don't know
how clear that all was, but hopefully someone has some idea what I'm
talking aobut.
I guess that's it for now. Anyway, if someone could give me some ideas
on how to do these two things, I'd really appreciate it. Thanks.
--
Eric Henry