Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def findPalindrome(filename):
- #an empty list to put palindromes into
- list3 = ()
- #open the file
- for line in open(filename):
- #strip the lines of blank space
- list1 = line.strip()
- #Split the lines into words
- list2 = line.split()
- #call one of the words
- for x in list2:
- #test if it is a palindrome
- if isPalindrome(x):
- #add to list3
- list3.append(x)
- #return the list of palindromes
- return list3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement