title: How to build a python dictionary in a loop?
body: <p>I am trying to add keys and value to a python dictionary in a loop. I am quite new to python and I am not able to get it right.</p>
  
  <p>This is my piece of code, where i want to loop through and build the dictionary in a loop  with the key being the album name and value being the song list.</p>
  
  <pre><code>    for alb in l.songs:
         if alb.album not in song_database:
             song_database[alb.album] = alb.name
  </code></pre>
  
  <p>had it been perl i would have done something like this, i am just assuming the kys and values are coming from two different arrays.</p>
  
  <pre><code>    foeach(@album_name){
      my $key = $_;
        foreach(@song_name){
          push (@{song_hash{"key"}},$_);
        }
      }
  </code></pre>
  
  <p>I would like to know how to do it in python ?</p>