Skip to content

Instantly share code, notes, and snippets.

@fatosmorina
Created August 22, 2021 07:03
Show Gist options
  • Save fatosmorina/42a718f412439b04e0a77d7004278597 to your computer and use it in GitHub Desktop.
Save fatosmorina/42a718f412439b04e0a77d7004278597 to your computer and use it in GitHub Desktop.
odd_value_elements = {key: num for (key, num) in
dictionary.items() if num % 2 == 1}
print(odd_value_elements) # {'first_element': 1, 'third_element': 3}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment