Last active
August 29, 2015 14:03
-
-
Save alexandre/44e6d630d6e4f77d669c to your computer and use it in GitHub Desktop.
converter um valor em decimal para binário
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
| conv = [] | |
| def dec2bin(num): | |
| (num/2 > 0 and (dec2bin(int(num/2)), conv.append(num%2))) | |
| dec2bin(int(input('Decimal: '))) | |
| print(''.join(map(str, conv))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment