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 Encode with ROT13.5

Python 3, 145 bytes lambda s:[dict({chr(i+c):chr((i+13)%26+c)for i in range(26)for c in(65,97)},**{chr(i+48):chr((i+5)%10+48)for i in range(10)}).get(c,c)for c in s] Try it online! Generates...

posted 1y ago by dino‭

Answer
#1: Initial revision by user avatar dino‭ · 2022-11-22T16:59:01Z (over 1 year ago)
# [Python 3], 145 bytes

<!-- language-all: lang-python -->

    lambda s:[dict({chr(i+c):chr((i+13)%26+c)for i in range(26)for c in(65,97)},**{chr(i+48):chr((i+5)%10+48)for i in range(10)}).get(c,c)for c in s]

[Try it online!][TIO-lasgkgcw]

[Python 3]: https://docs.python.org/3/
[TIO-lasgkgcw]: https://tio.run/##XZBRT4MwFIXf@RU3NRvtJGSMjW2YqS/@AV/VmK4UVnWFtHdmhvDbsdSFJb7dfuece0/a/OCh1mlfwg5e@y9@3BccbP5SKIG0FQdD1a1g@TC4KUnZZJE5UNYGFCgNhutK0kXmiXCEZqtou2ZdNJtd4svNmF@xSTIfwL98MmcdiyuJVERiXAX2rUdp8V1wK60r2Aak0hxBmU9AaQwnkANBtwK@5RkqI6UmUUAWy2zjpfU2SQdwM5k@RnF@9@Dp9eWk5xqTNF7BFJ72VbaJ595ymR296M7aBYGvrZsTRiDPjRQoi6HntWSsUB4tZXkAUJ/QOV3tMIw/avczJfVZxpzYGKWRliFpPesI7O6BtH@ZjoSDh1srDY57duPN/hc "Python 3 – Try It Online"

Generates and concatonates 2 dicts:

`{chr(i+c):chr((i+13)%26+c)for i in range(26)for c in(65,97)}` -> `{'A': 'N', 'a': 'n', 'B': 'O', 'b': 'o', 'C': 'P', 'c': 'p', 'D': 'Q', 'd': 'q', 'E': 'R', 'e': 'r', 'F': 'S', 'f': 's', 'G': 'T', 'g': 't', 'H': 'U', 'h': 'u', 'I': 'V', 'i': 'v', 'J': 'W', 'j': 'w', 'K': 'X', 'k': 'x', 'L': 'Y', 'l': 'y', 'M': 'Z', 'm': 'z', 'N': 'A', 'n': 'a', 'O': 'B', 'o': 'b', 'P': 'C', 'p': 'c', 'Q': 'D', 'q': 'd', 'R': 'E', 'r': 'e', 'S': 'F', 's': 'f', 'T': 'G', 't': 'g', 'U': 'H', 'u': 'h', 'V': 'I', 'v': 'i', 'W': 'J', 'w': 'j', 'X': 'K', 'x': 'k', 'Y': 'L', 'y': 'l', 'Z': 'M', 'z': 'm'}` for ROT13

`{chr(i+48):chr((i+5)%10+48)for i in range(10)}` -> `{'0': '5', '1': '6', '2': '7', '3': '8', '4': '9', '5': '0', '6': '1', '7': '2', '8': '3', '9': '4'}` for ROT5

It then gets the corresponding item from the concatonated dicts for each character in the input string.

Inputs as a string, outputs as a list