On 9/16/2010 12:05 AM, Rance Hall wrote:
Im working on a little piece of test code to test an idea for a larger script.
Here is what I've got so far:
l = []
for i in range(0,10)
l.append(i)
for i in range(0,10)
print('%s. %s' % (i, l[i])
This gives me:
0. 0
1. 1
2. 2 .... etc
which is what I expect, but what I want is to get something like
0. 1
1. 2
2. 3 .....
so that the output is clearly different on either side of the "."
I tried changing the append to l.append(i+1)
which almost worked but the output started with 1. 2 I was curious
what happend to the 0. 1 line
It works for me (after adding : at the end of the for statements, and a
parenthesis at the end of the print call).
>>> l = []
>>> for i in range(0,10)
... l.append(i+1)
...
>>> for i in range(0,10)
... print('%s. %s' % (i, l[i]))
...
0. 1
1. 2
2. 3
3. 4
etc.
[snip]
--
Bob Gailer
919-636-4239
Chapel Hill NC
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor