title: Python: Print the longest word in a sentence that contains specific letters
body: <p>If there is no word contains &quot;a&quot; or &quot;A&quot; in a sentence, print -1.</p>
  <p>Here is my code, I can print the words if they contain &quot;a&quot; or &quot;A&quot;, but if not I can't manage to print -1 out.</p>
  <p>Where should I change?</p>
  <pre><code>def newsentence ():
      letters = set('aA')
      new_ls = [word for word in sentence if letters &amp; set(word)]
      return new_ls
  
  def findlongest ():
      if 'a' or 'A' in sentence: 
          longest = max(newsentence(), key=len)
      else:
          longest== -1
      return(longest)
      
  sentence = list(input().split())
  print(findlongest())
  </code></pre>