Advertisement
biswasrohit20

task4

May 17th, 2021
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. def convertToEvenFirst(d):
  2.  
  3. l1 = []
  4. for k in d:
  5. l1.append(d[k])
  6. even = []
  7. odd = []
  8. for i in range(len(l1)):
  9. for j in range(len(l1)):
  10. if l1[i][j] % 2 == 0:
  11. even.append(l1[i][j])
  12. else:
  13. odd.append(l1[i][j])
  14. all = even + odd
  15. def divide_chunks(l, n):
  16. for i in range(0, len(l), n):
  17. yield l[i:i + n]
  18.  
  19. return list(divide_chunks(all,len(l1)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement