# Trouble converting string to float

Can anyone help determine why binary, hexadecimal and not expressions wont work?

class cruncher():

``````def add(self, operand1, operand2):

def subtract(self,operand1, operand2):
subtract = operand1 - operand2
return subtract

def multiply(self,operand1, operand2):
multiplication = operand1 * operand2
return multiplication

def power(self,operand1, operand2):
power_of = operand1 ** operand2
return power_of

def divide(self,operand1, operand2):
divided = operand1 / operand2
return divided

def int_divide(self,operand1 , operand2):
int_divided = operand1 // operand2
return int_divided

def modulo(self,operand1, operand2):
modulod = operand1 % operand2
return modulod

operand1 = 0

def binary(self,operand1, operand2):
binarys = bin(operand2)
operand1 = 0
return binarys

def greater_than(self,operand1, operand2):
greater_then = operand1 > operand2
return greater_then

def less_than(self,operand1, operand2):
less_then = operand1 < operand2
return less_then

def greater_equal(self,operand1, operand2):
greater_or_equal = operand1 >= operand2
return greater_or_equal

def less_equal(self,operand1, operand2):
less_or_equal = operand1 <= operand2
return less__or_equal

def expression_and(self,operand1, operand2):
and_expression = operand1 and operand2
return and_expression

def expression_or(self,operand1, operand2):
or_expression = operand1 or operand2
return or_expression

def expression_not(self,operand2):
not_expression = not operand2
return not_expression

def dtree(self, operand1,operator,operand2):

if operator == "+":

elif operator == "-":

elif operator == "*":

elif operator == "**":

elif operator == "/":

elif operator == "//":

elif operator == "%":

elif operator == "0x":

elif operator == "b":

elif operator == ">":

elif operator == "<":

elif operator == ">=":

elif operator == "and":

elif operator == "<=":

elif operator == "or":

elif operator == "not":
else:
return("Invalid input")
``````

def crunch():

``````crunch = cruncher()

cal_list = cal_str.split()
operand1 = cal_list[0]

if cal_list[1] == 'and' or cal_list[1] == 'or' or cal_list[1] == 'not' or cal_list[1] == '0x' or cal_list[1] == 'b':
operand1 = str(operand1)
else:
operand1 = float(operand1)

operator = cal_list[1]
operand2 = cal_list[2]

if cal_list[1] == 'and' or cal_list[1] == 'or' or cal_list[1] == 'not' or cal_list[1] == '0x' or cal_list[1] == 'b':
operand2 = str(operand2)
else:
operand2 = float(operand2)

print(operand1, cal_list[1],operand2)