I cannot get my "if" command to work properly <p>I am trying to add two numbers, even if they contain "-" or ".", but my if command is wrong somehow, here is the code:</p> <pre><code>def add(): print "\nAddition" print " " print "What is your first number?" preadd1=raw_input(prompt) print "What is your second number?" preadd2=raw_input(prompt) if preadd1.isdigit() and preadd2.isdigit(): add1=int(preadd1) add2=int(preadd2) add_answer= add1+add2 print " " print add_answer add() elif preadd1=="pike" or preadd2=="pike": pike() elif "-" in preadd1 or "." in preadd1 or "-" in preadd2 or "." in preadd2 and preadd1.replace("-","").isdigit() and preadd1.replace(".","").isdigit() and preadd2.replace("-","").isdigit() and preadd2.replace(".","").isdigit(): add1=float(preadd1) add2=float(preadd2) add_answer=add1+add2 print "" print add_answer add() else: print "\nPlease enter two numbers." add() add() </code></pre> <p>when I enter a non-number like "-sf" it returns the error:</p> <pre><code>ValueError: could not convert string to float: -sf </code></pre> <p>this makes no sense to me, seeing as a made sure <code>preadd1.replace("-","").isdigit() and preadd1.replace(".","").isdigit() and preadd2.replace("-","").isdigit() and preadd2.replace(".","").isdigit()</code></p> <p>Please help.</p>