Multiple simple solutions with explanation [Python]
Reverse each row \n\nflipped = [row[::-1] for row in A]\n\n2. Invert binary values \n\nHere the trick is to use map as it applies a given function to all elemen
1. **Reverse each row** \n\n`flipped = [row[::-1] for row in A]`\n\n2. **Invert binary values** \n\nHere the trick is to use `map` as it applies a given function to all elements of the list. Here\'s the blueprint from the official documentation:\n\n`map(function_to_apply, list_of_inputs)`\n\nDon\'t forget to **cast it to list**!\n\nWe can now solve the problem with a compact expression like this:\n\n```\ntranslation = {0:1, 1:0}\nreturn [list(map(lambda x: translation[x], row[::-1])) for row in A] \n```\n\nWhenever you want to operate with binary values, consider using bitwise operators. In this case "AND" allows us to translate 0 to 1 and viceversa:\n\n```\nfor row in A:\n  for i in range((len(row) + 1) // 2):\n    row[i], row[~i] = row[~i] ^ 1, row[i] ^ 1\n    return A \n```\n\nNow combining this wisdom with our previous list comprehension solution:\n\n```\nreturn [[i ^ 1 for i in row[::-1]] for row in A]\n```
['Python']