biswasrohit20

task3

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