The Python Guide Reimagined

Pynexa

Walk through the dragon's gate into Python — every definition, every loop, every program. Hand-crafted lessons that make you understand, not just copy.

Daily

Sharpen up. Every day.

Challenge of the day
0 days

Flatten a nested list

Flatten [[1,2],[3,[4,5]]] into [1,2,3,4,5].

def flat(x):
    for i in x:
        yield from flat(i) if isinstance(i,list) else [i]

Sign in to appear on the leaderboard.

Tip of the day

collections.Counter turns 10 lines of counting into one.

Leaderboard
0 solved today

Recommended

Level-up resources