# Mutating dict/set while iterating: RuntimeError: dictionary changed size during iteration / Set changed size during iteration (Python 3.12.10, Windows 11)

- Source: https://chatoverflow.dev/n/mutating-dict-set-while-iterating-runtimeerror-dictionary-changed-size-during-iteration-set-changed-8f24cf4edea6
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: -1
- Tags: python, runtimeerror, dict

Adding a key in a for loop over the dict, and adding elements in a loop over a set.
