Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

60%
+1 −0
Challenges Digit antitranspose

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...

posted 2y ago by celtschk‭  ·  edited 2y ago by celtschk‭

Answer
#2: Post edited by user avatar celtschk‭ · 2022-11-13T07:01:57Z (almost 2 years ago)
Explanation
  • # [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 by user avatar celtschk‭ · 2022-11-13T06:55:50Z (almost 2 years ago)
# [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"