Re: [Tutor] Traversing lists or getting the element you want.

2014-02-03 Thread Kipton Moravec
Thanks to all that helped on this one. I missed in my reading that you can address an element of a list as y[i]. Going back through "Think Python" book, they have one example of it. And spend 1/4 page out of the 263 pages in the book. They spend much more time on other parts of lists like slices

Re: [Tutor] Traversing lists or getting the element you want.

2014-02-03 Thread Peter Otten
Kipton Moravec wrote: > I am new to Python, and I do not know how to traverse lists like I > traverse arrays in C. This is my first program other than "Hello World". > I have a Raspberry Pi and they say Python is the language of choice for > that little machine. So I am going to try to learn it. >

Re: [Tutor] Traversing lists or getting the element you want.

2014-02-03 Thread spir
On 02/02/2014 09:46 PM, Kipton Moravec wrote: I am new to Python, and I do not know how to traverse lists like I traverse arrays in C. This is my first program other than "Hello World". I have a Raspberry Pi and they say Python is the language of choice for that little machine. So I am going to t

Re: [Tutor] Traversing lists or getting the element you want.

2014-02-02 Thread Steven D'Aprano
On Sun, Feb 02, 2014 at 02:46:38PM -0600, Kipton Moravec wrote: > I am new to Python, and I do not know how to traverse lists like I > traverse arrays in C. You can do this, but normally shouldn't: data = [2, 4, 8, 16, 32] for i in range(0, len(data)): x = data[i] print(x) That is a mor

Re: [Tutor] Traversing lists or getting the element you want.

2014-02-02 Thread Dave Angel
Kipton Moravec Wrote in message: > I am new to Python, and I do not know how to traverse lists like I > traverse arrays in C. This is my first program other than "Hello World". > I have a Raspberry Pi and they say Python is the language of choice for > that little machine. So I am going to try to

Re: [Tutor] Traversing lists or getting the element you want.

2014-02-02 Thread David Hutto
Kind of sure this is the translation line for line: #We define some vars before utilizing them x,and y are list comprehension # You said int for x, so it's created in ints, and y is in floats x = [num for num in range(0,496)] # You said double for y, so the it's created in floats, and x is an int

Re: [Tutor] Traversing lists or getting the element you want.

2014-02-02 Thread David Hutto
On Sun, Feb 2, 2014 at 6:44 PM, David Hutto wrote: > > > > On Sun, Feb 2, 2014 at 3:46 PM, Kipton Moravec wrote: > >> I am new to Python, and I do not know how to traverse lists like I >> traverse arrays in C. This is my first program other than "Hello World". >> I have a Raspberry Pi and they s

Re: [Tutor] Traversing lists or getting the element you want.

2014-02-02 Thread David Hutto
On Sun, Feb 2, 2014 at 3:46 PM, Kipton Moravec wrote: > I am new to Python, and I do not know how to traverse lists like I > traverse arrays in C. This is my first program other than "Hello World". > I have a Raspberry Pi and they say Python is the language of choice for > that little machine. So

[Tutor] Traversing lists or getting the element you want.

2014-02-02 Thread Kipton Moravec
I am new to Python, and I do not know how to traverse lists like I traverse arrays in C. This is my first program other than "Hello World". I have a Raspberry Pi and they say Python is the language of choice for that little machine. So I am going to try to learn it. I have data in the form of x,