fork download
  1. def checklisting(inputlist, repts):
  2. result = []
  3. temprs = []
  4. ic = 0;
  5. for x in inputlist:
  6. temprs.append(x)
  7. ic += 1
  8. if ic == repts:
  9. ic = 0
  10. result.append(temprs)
  11. temprs = []
  12.  
  13. return result
  14.  
  15. try:
  16. print checklisting(['a', 'b', 'c', 'd'], 4)
  17. except Exception as e:
  18. print e
Success #stdin #stdout 0.01s 8968KB
stdin
Standard input is empty
stdout
[['a', 'b', 'c', 'd']]