title: Program Binary Decimal Conversion 1
signature: def programBinaryDecimalConversion1(n: String) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Int , expected: Int): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(n: String, expected: Int): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        "uEmIAgF", 
        0    
      )}")   
  
  
      println(s"TEST-1...${driver(
        "753310137", 
        20    
      )}")   
  
  
      println(s"TEST-2...${driver(
        "010011010", 
        154    
      )}")   
  
  
      println(s"TEST-3...${driver(
        "kNi", 
        0    
      )}")   
  
  
      println(s"TEST-4...${driver(
        "04562016903312", 
        130    
      )}")   
  
  
      println(s"TEST-5...${driver(
        "000111101", 
        61    
      )}")   
  
  
      println(s"TEST-6...${driver(
        "bk", 
        0    
      )}")   
  
  
      println(s"TEST-7...${driver(
        "9", 
        0    
      )}")   
  
  
      println(s"TEST-8...${driver(
        "1", 
        1    
      )}")   
  
  
      println(s"TEST-9...${driver(
        "XxT nXLlk", 
        0    
      )}")   
  
  }
  
source_py: def program_binary_decimal_conversion_1(n):
      num = n
      dec_value = 0
      base1 = 1
      len1 = len(num)
      for i in range((len1 - 1), (- 1), (- 1)):
          if (num[i] == '1'):
              dec_value += base1
          base1 = (base1 * 2)
      return dec_value
source_cpp: int program_binary_decimal_conversion_1(string n) {
    string num = n;
    int dec_value = 0;
    int base = 1;
    int len = num . length ( );
    for ( int i = len - 1;
    i >= 0;
    i -- ) {
      if ( num [ i ] == '1' ) dec_value += base;
      base = base * 2;
    }
    return dec_value;
  }