listOne = [0 for i in range(100)] listTwo = [0] * 100
I believe (correct me if i am wrong) in the first example it just loops 100 times and calls append(0) on the list.
No idea, how second one is executed.




Posted 09 January 2013 - 08:16 AM
listOne = [0 for i in range(100)] listTwo = [0] * 100
Posted 09 January 2013 - 08:36 AM
listOne = [0 for i in range(100)] print(listOne) print(len(listOne)) listTwo = [0] * 100 print(listTwo) print(len(listTwo))
listThree = [i * 2 for i in range(100)] print(listThree)
This post has been edited by andrewsw: 09 January 2013 - 08:37 AM
Posted 09 January 2013 - 09:19 AM
darek9576, on 09 January 2013 - 09:07 AM, said:
This post has been edited by andrewsw: 09 January 2013 - 09:20 AM
Posted 10 January 2013 - 11:49 PM
|
|
Query failed: connection to localhost:3312 failed (errno=111, msg=Connection refused).
|
