Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def convertToEvenFirst(d):
- l1 = []
- for k in d:
- l1.append(d[k])
- even = []
- odd = []
- for i in range(len(l1)):
- for j in range(len(l1)):
- if l1[i][j] % 2 == 0:
- even.append(l1[i][j])
- else:
- odd.append(l1[i][j])
- all = even + odd
- def divide_chunks(l, n):
- for i in range(0, len(l), n):
- yield l[i:i + n]
- return list(divide_chunks(all,len(l1)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement