Last active
May 8, 2019 21:41
-
-
Save Sukhrobjon/b409cf8efd9a4c7e6e7e4d8cb09df954 to your computer and use it in GitHub Desktop.
This is sample code for medium article for CS-1.3 class at Make School
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # declaring the dictionary with keys and values | |
| dict_nums = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5} | |
| print(dict_nums) # {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5} | |
| # extracting the keys and putting in a list | |
| list_keys = list(dict_nums.keys()) | |
| print(list_keys) # ['one', 'two', 'three', 'four', 'five'] | |
| # creating set with same items as keys of the dictionary | |
| set_num = set(['one', 'two', 'three', 'four', 'five']) | |
| print(set_num) # {'five', 'four', 'one', 'three', 'two'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment