Question: I am trying to make a hexadecimal convertor. The program keep telling me there is something wrong with my math operators, but I believe the

I am trying to make a hexadecimal convertor. The program keep telling me there is something wrong with my math operators, but I believe the problem is somewhere in the constructor. The tester program gives me a score of 63/100. Any advice on where I am going wrong would be great.I am trying to make a hexadecimal convertor. The program keep tellingme there is something wrong with my math operators, but I believethe problem is somewhere in the constructor. The tester program gives mea score of 63/100. Any advice on where I am going wrongwould be great. class Hexadecimal: def init_ _(self, decimal-"1128") if type (decimal)

class Hexadecimal: def init_ _(self, decimal-"1128") if type (decimal) is int: if decimal 0: self. decimal=decimal else: raise ValueError ("Must be greater than zero." elif type (decimal) is list: zaise ValueEzror ("Cannot enter lists.") elif type (decimal) is float: decimal = int (decimal) if decimal 0: self. decimal decimal else: raise ValueError ("Cannot have negative floats.") elif type (decimal) is str: try: if decimal not in ["A", "B",C","D", "E", "F: decimal except ValueError as Ex: float (decimal) raise ValueError ("Cannot convert string to float.") else: self. decimalint (decimal) elif type (decimal) is str:' values = {'A': 10, 'B' :11, decimaldecimal.upper ) h values [] for letter in decimal: 'C' :12, "D":13, 'E' :14, 'F' :15) if letter in values: h_values.append (valuesietter]) else: raise ValueErro "Invalid Hexadecimal") class Hexadecimal: def init_ _(self, decimal-"1128") if type (decimal) is int: if decimal 0: self. decimal=decimal else: raise ValueError ("Must be greater than zero." elif type (decimal) is list: zaise ValueEzror ("Cannot enter lists.") elif type (decimal) is float: decimal = int (decimal) if decimal 0: self. decimal decimal else: raise ValueError ("Cannot have negative floats.") elif type (decimal) is str: try: if decimal not in ["A", "B",C","D", "E", "F: decimal except ValueError as Ex: float (decimal) raise ValueError ("Cannot convert string to float.") else: self. decimalint (decimal) elif type (decimal) is str:' values = {'A': 10, 'B' :11, decimaldecimal.upper ) h values [] for letter in decimal: 'C' :12, "D":13, 'E' :14, 'F' :15) if letter in values: h_values.append (valuesietter]) else: raise ValueErro "Invalid Hexadecimal")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!