Python Basics

This page covers the Python you need for the preliminary assessment: writing functions, working with lists, and using list comprehensions. Back to Preliminary. Why this matters for RL RL code is full of trajectories (lists of states, actions, rewards), configs (dicts), and custom types (agents, buffers). You need to write clear functions, slice sequences, and aggregate data. Moving averages and rolling computations appear when processing reward sequences or returns. Learning objectives Write a function that returns the moving average of a list; use list comprehensions and loops; structure code for clarity and reuse. ...

March 10, 2026 · 5 min · 853 words · codefrydev