Skip to content

item unpacking doesn't work in a loop variable #14

Closed
@basnijholt

Description

@basnijholt
dct = {'a': 1, 'b': 2}
for key, val in dct.items():
    val

gives

Exception in <jupyter_15> line 3:
        val
        ^
NameError: name 'val' is not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions