Binary Converter Coderbyte Solution


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.

Binary Converter Solution in java

import java.util.Scanner;

public class BinaryConverter {
int BinaryConverter(String str) {
return Integer.parseInt(str, 2);

public static void main (String[] args) {
// keep this function call here
Scanner s = new Scanner(;
BinaryConverter c = new BinaryConverter();

Binary Converter Solution in Python

def BinaryConverter(str):
return int(str, 2)
# keep this function call here
# to see how to enter arguments in Python scroll down
print BinaryConverter(raw_input())

Post a Comment

* Please Don't Spam Here. All the Comments are Reviewed by Admin.
Post a Comment (0)
Our website uses cookies to enhance your experience. Learn More
Accept !