Can someone help me debug my script?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Encchhh
    New Member
    • Sep 2012
    • 1

    #1

    Can someone help me debug my script?

    Hi, its a really simple script, but since I'm new to python I have no clue what I am doing wrong. Also if you could, I would appreciate tips on a good IDE for python.



    Code:
    #!/usr/local/bin/python
    
    x1 = raw_input("What is x1 ")
    x2 = raw_input("What is x2 ")
    y1 = raw_input("What is y1 ")
    y2 = raw_input("What is y2 ")
    
    
    def main():
        choice = raw_input("What type of question are you doing?" ;
        " /n Midpoint = M, Gradient = G and Sides = S")
    
    print x1
    print x2
    print y1
    print y2
    
    if choice = "M":
        print "(x1 + x2)/2, (y1 + y2)"
        elif choice = "G":
        print "(y1 - y2)/(x1 - x2)"
        elif choice = "S":
        print "((x1 - y1)**2 + (x2 - y2)**2)**1/2)"
        else:
            print"Sorry, your input was not recognised,";
            print "make sure to use /n capital letters"
    
    return 0;
    Thanks Andy
    Last edited by Rabbit; Sep 12 '12, 07:28 PM. Reason: Please use code tags when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Please use code tags when posting code. Especially for python.

    There's nothing to debug because you haven't told us what errors you're getting, if any. You also haven't told us what it's supposed to do, if anything. And you haven't told us what it's doing wrong, if anything.

    But I can give some general suggestions. First, python uses white space to form its code blocks. So the first thing you want to do is make sure all your white space is in order. Second, python doesn't use anything to end a line of code. I don't know why you're using semi-colons some of the times.

    Comment

    Working...