def dec_hex_ch(dec):
    if not dec:
        return ('ERROR - No ingreso nada')
    elif dec.isdecimal() == False:
        return ('ERROR - Debe ingresar solo numeros')
    else:
        resp = decimal_to_hexa(int(dec))
        return (f'El numero {dec} es {resp} en hexadecimal.')
Example #2
0
def check(num):
    if not num:
        return 'ERROR -- Ingreso vacio'
    if num.isdigit() == False :
        return 'ERROR -- No puede ingresar palabras'
    else:
        resp = decimal_to_hexa(int(num))
    return resp
Example #3
0
 def test_10_to_hex_A(self):
     hexa_num = decimal_to_hexa(10)
     self.assertEqual(hexa_num, 'A')
Example #4
0
 def test_5_to_hex_5(self):
     hexa_num = decimal_to_hexa(5)
     self.assertEqual(hexa_num, '5')
Example #5
0
 def test_921_to_hex_(self):
     hexa_num = decimal_to_hexa(921)
     self.assertEqual(hexa_num, '399')
Example #6
0
 def test_234_to_hex_EA(self):
     hexa_num = decimal_to_hexa(234)
     self.assertEqual(hexa_num, 'EA')
Example #7
0
 def test_1234_to_hex_4D2(self):
     hexa_num = decimal_to_hexa(1234)
     self.assertEqual(hexa_num, '4D2')
Example #8
0
 def test_4095_to_hex_FFF(self):
     hexa_num = decimal_to_hexa(4095)
     self.assertEqual(hexa_num, 'FFF')
Example #9
0
 def test_16_to_hex_10(self):
     hexa_num = decimal_to_hexa(16)
     self.assertEqual(hexa_num, '10')
Example #10
0
 def test_17_to_hex_11(self):
     hexa_num = decimal_to_hexa(17)
     self.assertEqual(hexa_num, '11')