Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = [1,2]
- for ctr in range(0,len(a)):
- print ctr
- if len(a) < 10:
- a.append(2)
- while len(a) < 10:
- a.append(2)
- a.extend([2] * (10 - len(a)))
- a += [2] * (10 - len(a))
- a += [2] * (10 - len(a))
- a = [1,2]
- while len(a) < 10:
- a.append(2)
- >>> from itertools import chain, islice, repeat
- >>> list(islice(chain(a, repeat(2)), 10))
- [1, 2, 2, 2, 2, 2, 2, 2, 2, 2]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement