Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. def user_input():
  2. filename = input("please enter full name and extenstion of file to be compared: ")
  3.  
  4. with open(filename, 'r') as open_file:
  5. made_to_list = open_file.read()
  6. made_to_list = made_to_list.split() #split makes each name a string element of the array all_text
  7. return made_to_list
  8.  
  9.  
  10. def list_comparator(list1, list2):
  11. common_element = []
  12. for element in list1:
  13. if element in list2:
  14. common_element.append(element)
  15. return common_element
  16.  
  17. if __name__ == '__main__':
  18.  
  19. print("The common items between the two lists u entered are: \n" +str(list_comparator(user_input(), user_input())))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement