If there is no word contains "a" or "A" in a sentence, print -1.
Here is my code, I can print the words if they contain "a" or "A", but if not I can't manage to print -1 out.
Where should I change?
def newsentence ():
letters = set('aA')
new_ls = [word for word in sentence if letters & 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())