Post History
Python 3, 35 bytes lambda m:list(zip(*m[::-1]))[::-1] Try it online! The format is a list of tuples. The content of the tuples could be any type; in my tests I used single-digit strings bec...
Answer
#2: Post edited
- # [Python 3], 35 bytes
- <!-- language-all: lang-python -->
- lambda m:list(zip(*m[::-1]))[::-1]
- [Try it online!][TIO-laf05s9f]
- [Python 3]: https://docs.python.org/3/
- [TIO-laf05s9f]: https://tio.run/##fVLBbpwwEL37K0abA1C5aYBlN0LaQ6T2kFulHLNR5S4m6wZsxJgqyYpv33ps6JJLQMLz5r2ZeQx0b/ZodH6ud/tzI9rflYC2bBTa@F118Zf2sSy/pk9JEk44syuwEu1BoERQGuxRQm36Vlh4Vn@lnnNW4AvEaOAeDkLDnwEtHEz3Bp1AK0HoCkRVAZpWunzbCkwYu3TewYmtbtKM5@uCb7a3KyhhdVtkfLtO@Sa/WXGieZZzz3t6W@SOW2eeXGqJXPZy9EUbyEsnahySFKaZjzOeEqKDoMs65Co8WueE3JMAJR0qNnw27aLCO/IBpQJJLtwVrHN/@9wU@jTxbGS09F5obAStDtD2Sj9D3Zv28/0rbY1HSneD/WYG645ZHtNXBlODHbpGYuJDp0XTDFYZzVgla6jkwVQyxqRk4K5e2qHX8Ohr4teEmsErDcVr7Bpl44hHyRM57ofJyfxRGWm9k1/hDTgERxP01mfxtbKyxXga66vcTzG5WTZJvGB6tf@KD42DpHOhjeuIRtA0GgOnZavR7fz0oXLc66AYAY9maCq/5Fk0RqGzQJS922vwlcBuN/lZzI1@3j08/Pi@167m/A8 "Python 3 – Try It Online"
- # [Python 3], 35 bytes
- <!-- language-all: lang-python -->
- lambda m:list(zip(*m[::-1]))[::-1]
- [Try it online!][TIO-laf05s9f]
- The format is a list of tuples. The content of the tuples could be any type; in my tests I used single-digit strings because I was lazy when writing the testing code.
- `seq[::-1]` reverses a sequence (tuple ot list). `zip(*seq)` does a normal transpose (it gives a tuple generator, which is why I use tuples for the rows), which I convert to a list (I use a list because `tuple` has one character more than `list`).
- [Python 3]: https://docs.python.org/3/
- [TIO-laf05s9f]: https://tio.run/##fVLBbpwwEL37K0abA1C5aYBlN0LaQ6T2kFulHLNR5S4m6wZsxJgqyYpv33ps6JJLQMLz5r2ZeQx0b/ZodH6ud/tzI9rflYC2bBTa@F118Zf2sSy/pk9JEk44syuwEu1BoERQGuxRQm36Vlh4Vn@lnnNW4AvEaOAeDkLDnwEtHEz3Bp1AK0HoCkRVAZpWunzbCkwYu3TewYmtbtKM5@uCb7a3KyhhdVtkfLtO@Sa/WXGieZZzz3t6W@SOW2eeXGqJXPZy9EUbyEsnahySFKaZjzOeEqKDoMs65Co8WueE3JMAJR0qNnw27aLCO/IBpQJJLtwVrHN/@9wU@jTxbGS09F5obAStDtD2Sj9D3Zv28/0rbY1HSneD/WYG645ZHtNXBlODHbpGYuJDp0XTDFYZzVgla6jkwVQyxqRk4K5e2qHX8Ohr4teEmsErDcVr7Bpl44hHyRM57ofJyfxRGWm9k1/hDTgERxP01mfxtbKyxXga66vcTzG5WTZJvGB6tf@KD42DpHOhjeuIRtA0GgOnZavR7fz0oXLc66AYAY9maCq/5Fk0RqGzQJS922vwlcBuN/lZzI1@3j08/Pi@167m/A8 "Python 3 – Try It Online"
#1: Initial revision
# [Python 3], 35 bytes <!-- language-all: lang-python --> lambda m:list(zip(*m[::-1]))[::-1] [Try it online!][TIO-laf05s9f] [Python 3]: https://docs.python.org/3/ [TIO-laf05s9f]: https://tio.run/##fVLBbpwwEL37K0abA1C5aYBlN0LaQ6T2kFulHLNR5S4m6wZsxJgqyYpv33ps6JJLQMLz5r2ZeQx0b/ZodH6ud/tzI9rflYC2bBTa@F118Zf2sSy/pk9JEk44syuwEu1BoERQGuxRQm36Vlh4Vn@lnnNW4AvEaOAeDkLDnwEtHEz3Bp1AK0HoCkRVAZpWunzbCkwYu3TewYmtbtKM5@uCb7a3KyhhdVtkfLtO@Sa/WXGieZZzz3t6W@SOW2eeXGqJXPZy9EUbyEsnahySFKaZjzOeEqKDoMs65Co8WueE3JMAJR0qNnw27aLCO/IBpQJJLtwVrHN/@9wU@jTxbGS09F5obAStDtD2Sj9D3Zv28/0rbY1HSneD/WYG645ZHtNXBlODHbpGYuJDp0XTDFYZzVgla6jkwVQyxqRk4K5e2qHX8Ohr4teEmsErDcVr7Bpl44hHyRM57ofJyfxRGWm9k1/hDTgERxP01mfxtbKyxXga66vcTzG5WTZJvGB6tf@KD42DpHOhjeuIRtA0GgOnZavR7fz0oXLc66AYAY9maCq/5Fk0RqGzQJS922vwlcBuN/lZzI1@3j08/Pi@167m/A8 "Python 3 – Try It Online"