Skip to content

Dictionary and looping #8

Open
Open
@Proteusiq

Description

@Proteusiq

Would the following change the existing code be more efficient?

>>> for name in instruments.keys():
...     print('{} - {}'.format(name,
...           instruments[name]))

Or

>>> for name, instrument in instruments.items():
...     print('{} - {}'.format(name,
...           instrument))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions