title: Swap Two Nibbles Byte
signature: function swap_two_nibbles_byte(x)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(x, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(x), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver(57, 147);
      @printf("TEST-0...%s\n",result);
      
      result = driver(99, 54);
      @printf("TEST-1...%s\n",result);
      
      result = driver(66, 36);
      @printf("TEST-2...%s\n",result);
      
      result = driver(97, 22);
      @printf("TEST-3...%s\n",result);
      
      result = driver(95, 245);
      @printf("TEST-4...%s\n",result);
      
      result = driver(42, 162);
      @printf("TEST-5...%s\n",result);
      
      result = driver(95, 245);
      @printf("TEST-6...%s\n",result);
      
      result = driver(89, 149);
      @printf("TEST-7...%s\n",result);
      
      result = driver(3, 48);
      @printf("TEST-8...%s\n",result);
      
      result = driver(84, 69);
      @printf("TEST-9...%s\n",result);
      
  end
  
  main()
source_py: def swap_two_nibbles_byte(x):
      return (((x & 15) << 4) | ((x & 240) >> 4))
source_cpp: int swap_two_nibbles_byte(int x) {
    return ( ( x & 0x0F ) << 4 | ( x & 0xF0 ) >> 4 );
  }