Created
January 4, 2021 13:51
-
-
Save blacksheep557/4794509155f68967d3218bb469158189 to your computer and use it in GitHub Desktop.
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
| map_1 = {'1': {'name': 'Binary', 'callback': bin}, '2': {'name': 'Octal', 'callback': oct}} | |
| for conv_id in map_1: | |
| conversion_object = map_1[conv_id] | |
| name = conversion_object['name'] | |
| print(f'{conv_id} {name}') | |
| conv_id = input("Enter the conversion : ") | |
| input_number = int(input("Enter the number : ")) | |
| conversion_object = map_1[conv_id] | |
| callback = conversion_object['callback'] | |
| print(callback(input_number)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment