Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. def findPalindrome(filename):
  2. #an empty list to put palindromes into
  3. list3 = ()
  4. #open the file
  5. for line in open(filename):
  6. #strip the lines of blank space
  7. list1 = line.strip()
  8. #Split the lines into words
  9. list2 = line.split()
  10. #call one of the words
  11. for x in list2:
  12. #test if it is a palindrome
  13. if isPalindrome(x):
  14. #add to list3
  15. list3.append(x)
  16. #return the list of palindromes
  17. return list3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement