integer base 2
+13 · 1 file changed
-
medium/09-BinaryConverter.py+13 −0
@@ -0,0 +1,13 @@ +__author__ = 'ovidiucs' +def BinaryConverter(str): + + return int(str,2) + + + +# keep this function call here +# to see how to enter arguments in Python scroll down +print BinaryConverter("101") +# Using the Python language, have the function BinaryConverter(str) return the +# decimal form of the binary value. For example: if 101 is passed return 5, or if +# 1000 is passed return 8.