title: Need to shorten get function
body: <p>I am trying to understand the last line in this code -  I know it is getting the equivalent plaintext charcter in <code>encdic</code> (encyption dictionary and join it all together to create an encrypt message. what is the <code>l.lower</code> code doing (taking upper characters and converting it to lower? If all characters are already lower case - how do i shorten the last line</p>
  
  <pre><code>return s.join(encdic.get(c.lower(), c) for c in plaintext)
  plaintext = "hhis is a fairly long piece of plainhexh fourscore and seven" 
  d = 'gikaclmnqrpoxzybdefijstuvw' #decryption key
  encdic = dict(zip(alphabet, d)) #create decryption dictionary
  decdic = dict(zip(d, alphabet)) #create decryption dictionary
  
  def encrypt(plaintext, d):
      s=""
      return s.join(encdic.get(c.lower(), c) for c in plaintext)
  </code></pre>
  
  <p>When I shorten the code to:</p>
  
  <pre><code>return s.join(encdic.get(c) for c in plaintext)
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>TypeError: sequence item 4: expected str instance, NoneType found
  </code></pre>
  
  <p>How can I fix this?</p>
  
  <p>Update:</p>
  
  <p>I've changed the code to:</p>
  
  <pre><code>return s.join(encdic.get(c,c) for c in plaintext) 
  </code></pre>
  
  <p><em>seems</em> to work without error but why?</p>