I'm trying to achieve something like C's structure
, so I predefine a list :
__list = [0] * 1001
everything works well.
but when the list getting complicated (a sample):
__list = [{"name": '', "score": 0}] * 3
for item in __list:
name, score = input("input name and score split with blank:\n").split() # raw_input for python2
item['name'] = name
item['score'] = int(score)
print(__list)
and I input this:
Lily 23
Paul 12
James 28
out:
[{"name": "James", "score": 28}, {"name": "James", "score": 28}, {"name": "James", "score": 28}]
why?