Forum: Python Nov 17th, 2009 |
| Replies: 2 Views: 259 L = [ 0 , 2, 1 , -1 , -1 , -1, -1 ]
for i in L:
if i <= 0:
L.pop ( i )
print L
What I was expecting was that L = [ 0, 2, 1 ]
but the result was [ 2 , 1 , -1, -1 ] |
Forum: Python Jun 20th, 2009 |
| Replies: 5 Views: 241 I think I know where I went wrong.
I was thinking in terms of C. So I thought that number can be directly entered in list as we do in array in C after declaring it. There is slightly different... |
Forum: Python Jun 20th, 2009 |
| Replies: 5 Views: 241 Thanks. I really wanted to see how to enter numbers in the list without initialization it completely. The second solution in your thread solved the problem.
Thanks once again. |
Forum: Python Jun 20th, 2009 |
| Replies: 5 Views: 241 Question:
Prompt user to enter ten two digit number. The program should compute the sum of all positive values and print the sum of values added.
Over here what I had done is:
Chosen list to... |