Created
June 6, 2017 08:40
-
-
Save mikkipastel/f710e77a105f51151ec763a7d16427eb to your computer and use it in GitHub Desktop.
Digital Circuit Design
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
import math | |
def base2decimal(num, base): | |
result = 0 | |
for i in range(len(str(num))): | |
if (i < len(str(num))): | |
result += int(int(str(num)[i]) * math.pow(base, i)) | |
print (result) | |
if __name__=="__main__": | |
base2decimal(33, 4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment