By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,806 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,806 IT Pros & Developers. It's quick & easy.

Can someone help me debug my script?

P: 1
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.

Expand|Select|Wrap|Line Numbers
  1. #!/usr/local/bin/python
  3. x1 = raw_input("What is x1 ")
  4. x2 = raw_input("What is x2 ")
  5. y1 = raw_input("What is y1 ")
  6. y2 = raw_input("What is y2 ")
  9. def main():
  10.     choice = raw_input("What type of question are you doing?" ;
  11.     " /n Midpoint = M, Gradient = G and Sides = S")
  13. print x1
  14. print x2
  15. print y1
  16. print y2
  18. if choice = "M":
  19.     print "(x1 + x2)/2, (y1 + y2)"
  20.     elif choice = "G":
  21.     print "(y1 - y2)/(x1 - x2)"
  22.     elif choice = "S":
  23.     print "((x1 - y1)**2 + (x2 - y2)**2)**1/2)"
  24.     else:
  25.         print"Sorry, your input was not recognised,";
  26.         print "make sure to use /n capital letters"
  28. return 0;
Thanks Andy
Sep 12 '12 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 10K+
P: 12,441
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.
Sep 12 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.