1a. List and set Flashcards
1
Q
list comprehension
for i in range(9):
for j in [10,20,30,40,50]:
mylist.append(i+j)
[10, 20, 30, 40, 50, 11, 21, 31, 41, 51,
A
mylist = [i+j for i in range(9) for j in [10,20,30,40,50]]
puzzle = [[int(quiz[c+r*9]) for c in range(9)] for r in range(9)]
2
Q
change a [1,2,3] into string
A
x = str(x) this won’t work as it becomes “[1,2,3]”
- [str(a) for a in x]
- map(str,x)