DEV Community

Matthew Fitzgerald
Matthew Fitzgerald

Posted on

First Post 1/24

Hello,

This is my first post on this platform, and I'd like to leave a puzzle. Code below!

Cheers,
Matt

Code:

from itertools import chain, cycle
from functools import reduce
import base64

encoded = 'SSBhbSBuZXcgaGVyZSwgYW5kIGxvb2tpbmcgZm9yd2FyZCB0byBwb3N0aW5n'

decoded = base64.b64decode(encoded).decode('utf-8')

indices = chain.from_iterable(
[reduce(lambda x, y: x + y, [[i] for i in range(len(decoded))][::j]) for j in range(1, 2)]
)
unscrambled = ''.join(decoded[i] for i in indices if i < len(decoded))

vars()[decoded[:3]] = unscrambled

(lambda x: print(x))(reduce(lambda a, b: a + b, cycle([decoded])))

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →