{"id":14016,"date":"2021-10-01T10:30:59","date_gmt":"2021-10-01T05:00:59","guid":{"rendered":"https:\/\/python-programs.com\/?p=14016"},"modified":"2021-11-22T18:33:27","modified_gmt":"2021-11-22T13:03:27","slug":"python-program-to-perform-xor-on-two-lists","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-perform-xor-on-two-lists\/","title":{"rendered":"Python Program to Perform XOR on Two Lists"},"content":{"rendered":"

Given two lists of the same length, the task is to perform the Xor Operation on both the list elements which are having the same index in Python.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given list 1= [4, 19, 11, 5, 3, 9, 7]\r\nGiven list 2= [10, 3, 7, 2, 9, 8, 6, 5]<\/pre>\n

Output:<\/strong><\/p>\n

The given First list elements are = [4, 19, 11, 5, 3, 9, 7]\r\nThe given Second list elements are = [10, 3, 7, 2, 9, 8, 6, 5]\r\nThe result after applying xor operation on both lists is [14, 16, 12, 7, 10, 1, 1]<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given list 1 = [5, 7, 9, 6]\r\nGiven list 2 = [3, 8, 9, 4]<\/pre>\n

Output:<\/strong><\/p>\n

The given First list elements are = [5, 7, 9, 6]\r\nThe given Second list elements are = [3, 8, 9, 4]\r\nThe result after applying xor operation on both list is [6, 15, 0, 2]<\/pre>\n

Program to Perform XOR on Two Lists in Python<\/h2>\n

Below are the ways to perform Xor on Two lists in Python.<\/p>\n