Skip to content

Dictionary and looping #8

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))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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