AI

create_member • 3-step mini assignment

Focus: state dictionary, ID counter increment, and what key-value pairs should store.

Questions

3 tasks • submit code-ish answers

Assume the program keeps all data in a Python dictionary called state. You are not writing the full function yet—just the pieces that make it work.

Q1. Explain the state dictionary structure

State + dictionaries

For each key, explain (1) what it stores, (2) why it’s useful. Keep it short but specific.

Not checked

Q2. Build and store a member record in state["members"]

Key-value pairs

Using the values below, write a Python dictionary named member. Then write the line that stores it into state["members"] using member_id as the key.

Not checked

Q3. Update the state after creating a member

Index + increment

Write one line for each: (1) store email → member_id in state["email_index"], (2) increment state["next_member_num"].

Not checked

Live state preview

Simulated • for learning

This panel shows what the state would look like if your Q2/Q3 code were applied (best-effort simulation).

members: 0 email_index: 0 next_member_num: 1001
state
{}
members
{}
email_index
{}

Hints

Hidden

Click “Show hints” if you want guidance (or keep them hidden for assessment).