473,385 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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.



Expand|Select|Wrap|Line Numbers
  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;
Thanks Andy
Sep 12 '12 #1
1 1661
Rabbit
12,516 Expert Mod 8TB
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

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

Similar topics

2
by: Dmitry | last post by:
Hi folks! I need to find a way to switch to a different Unix user from within the Perl script that is currently ran unattended. Script must switch user in order to execute proper profile for...
4
by: Rigs | last post by:
Hi, Does anyone happen to have a debug script that will display the variable name and value for all of the local variables on an .asp page? (not session nor application, as I already have...
1
by: Robert | last post by:
Simple way of writing debug print statements in your JavaScript code. You need to have enabled popups in your browser. I liked the ability to write to the java console in Netscape 4.x. This,...
11
by: rajarao | last post by:
hi I want to remove the content embedded in <script> and </script> tags submitted via text box. My java script should remove the content embedded between <script> and </script> tag. my current...
14
by: Rich | last post by:
I have a project that I would Greatly Appreciate some direction. My goal is to create a "Sales Assistant Script" that recommends products based upon Response's to questions. I know enough...
4
by: Malik Arykov | last post by:
Hello, All! how debug embedded javascript?
0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
46
by: Ian Boyd | last post by:
IIS5, on a Windows 2000 Server machine. Debeg.WriteLine "Hello, world!" How can i view it?
4
tpgames
by: tpgames | last post by:
I'm trying to make the code work with images, and work without using dates. I'm trying to alter someone elses script. The board doesn't show up with images. Thanks! <script type="text/javascript">...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.