Re: Small problem with print and comma

2006-07-31 Thread Diez B. Roggisch
Dustan wrote: Dennis Lee Bieber wrote: for i in range(0,len(param)): print a[i], for it in param: print it, That's one way. However, if you need the position (this is for future reference; you don't need the position number here): for i in range(len(param)+1): print a[i],

Small problem with print and comma

2006-07-30 Thread [EMAIL PROTECTED]
Hi, I have a small problem with my function: printList. I use print with a ',' . Somehow the last digit of the last number isn't printed. I wonder why. import random def createRandomList(param): length = param a = [] creating random list for i in range(0,length):

Re: Small problem with print and comma

2006-07-30 Thread faulkner
why don't you iterate over the list instead of indices? for elem in L: print elem, you don't need the 0 when you call range: range(0, n) == range(n) the last element of a range is n-1: range(n)[-1] == n-1 you don't need while to iterate backwards. the third argument to range is step. range(n-1,

Re: Small problem with print and comma

2006-07-30 Thread Tim Chase
I have a small problem with my function: printList. I use print with a ',' . Somehow the last digit of the last number isn't printed. I wonder why. Posting actual code might help...the code you sent has a horrible mix of tabs and spaces. You've also got some craziness in your creating

Re: Small problem with print and comma

2006-07-30 Thread Dustan
Dennis Lee Bieber wrote: for i in range(0,len(param)): print a[i], for it in param: print it, That's one way. However, if you need the position (this is for future reference; you don't need the position number here): for i in range(len(param)+1): print