Skip to main content
2 of 2
edited title
Lukas Lang
  • 34.4k
  • 1
  • 56
  • 99

Modify list elements if last two entries are equal

Suppose I have a list as follows

{{1, 1, 1, 1, 1, 3}, {1, 1, 3, 4, 1, 1}}

and I want to check the last two coordinates are equal or not. If that is the case then I want it to print out T after that list. So the result should be

{{1, 1, 1, 1, 1, 3}, {1, 1, 3, 4, 1, 1,T}}

I am thinking about using "if" but I have no idea how to do it.

kompaui
  • 135
  • 2