有人能帮我调试脚本吗?

嗨,这是一个非常简单的脚本,但由于我是新手,我不知道我做错了什么。另外,如果你可以,我会很感激关于一个好的Python集成开发环境的提示。

选择 | 换行 | 行号
  1. #!/usr/local/bin/python
  2.  
  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 ")
  7.  
  8.  
  9. def main():
  10.     choice = raw_input("What type of question are you doing?" ;
  11.     " /n Midpoint = M, Gradient = G and Sides = S")
  12.  
  13. print x1
  14. print x2
  15. print y1
  16. print y2
  17.  
  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"
  27.  
  28. return 0;

谢谢安迪

# 回答1


请在发布代码时使用代码标签。尤其是对蟒蛇来说。
没有什么需要调试的,因为您还没有告诉我们您收到了什么错误(如果有的话)。你也没有告诉我们它应该做什么,如果有的话。你还没有告诉我们它做错了什么,如果有的话。
但我可以给出一些一般性的建议。首先,Python使用空白来形成其代码块。所以你要做的第一件事就是确保你所有的空白都整齐有序。其次,Python不使用任何东西来结束一行代码。我不知道你为什么有时要用分号。

标签: python

添加新评论