I am currently writing a program that will solve the pythagorean theorem. However, I have a bug in the program. Whenever I put in a negative number for length a or b, it prints out "A cannot be less than zero" but goes ahead and solves for C anyway and prints out the length of C even though the user hasn't input b yet. How can I make it so when the user inputs a negative number it prints out the statement "A cannot be less than zero" and then loops again to inputting a length for the side, instead of how it is now where after it prints out the statement it redirects to the end?
Here is my code:
 import math
    print"This program will solve the pythagorean theorem for you"
    unit=raw_input('Enter the unit you will be using')
    a=float(raw_input('Enter the length of side a'))
    if a<=0:
      print"A cannot be less than zero"
    else:
        b=float(raw_input('Enter the length of side b'))
    if b<=0:
      print"B cannot be less than zero"
    else:
        c2=(a**2)+(b**2)
        c=math.sqrt(c2)
        c=str(c)
        print "The length of side C is: "+ c + " " + unit + "."
 
     
     
     
    