title: Better way to fill a list with zero
body: <p>i'm trying to write some program that take lines that represent matrix from user input and store it in list of lists.
  If the lists are not the same length, we add zeros to all the lists that are not in the same length of the longest one.
  after that we store all the lists in dictionary.</p>
  <p>I just want to know if I can do it in a more efficient way</p>
  <p>I would like to improve the second loop and instead of a nested loop do it in one loop, is that possible?</p>
  <p>For example:
  the input is:</p>
  <pre><code>1,2,4,6
  3,4
  2,4,1
  end
  </code></pre>
  <p>the output should be :</p>
  <pre><code>{1:[1,2,4,6], 2:[3,4,0,0],3:[2,4,1,0]}
  </code></pre>
  <p>my code is:</p>
  <pre><code>lst = []
  sub_list = []
  
  while sub_list != 'end':
      sub_list = input()
      if sub_list !='end':
          lst.append(list(sub_list.split(',')))
  
  lst = [list(map(int, sublist)) for sublist in lst]
  
  l = len(max(lst,key=len))
  
  for i in lst:
      while len(i) != l:
          i.append(0)
  
  res = {idx + 1: lst[idx] for idx in range(len(lst))}
  
  print(str(res))
  </code></pre>