473,749 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can someone help me debug my script?

1 New Member
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 1675
Rabbit
12,516 Recognized Expert Moderator MVP
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
8993
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 different Data Base Instance and set corresponding environmental variables correctly. Script works fine for a single Data Base Instance. I need to be able to run it consecutively for several others instances. This requires login in as a different...
4
2029
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 scripts those.) I'm looking for something that can be included in an .asp to write out values for debugging. Does anyone know what scope those variables reside in? Please help if you can.
1
2082
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, ability is missing in IE and the latest versions of Netscape. Maybe someone knows a better way and can improve on this code, the following JavaScript code demonstrates how to write debug statements in a JavaScript program. I sure lots of people...
11
3076
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 code is function RemoveHTMLScript(strText) { var regEx = /<script\w*<\/script>/g
14
1524
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 JavaScript to successfully create a "JavaScript Error" 2 out of 3 times! <Grin> The books I have read are great in regards to understanding what the code is doing, but in my novice opinion don't teach me the "when to use what"
4
1851
by: Malik Arykov | last post by:
Hello, All! how debug embedded javascript?
0
3226
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 converted/developed with VB.NET. What I want from debugging is to be able to step into the methods in the DLLs called from ASP scripts using Visual Studio .NET. Background: For typical script debugging issues, you can read and follow the two documents on...
46
24256
by: Ian Boyd | last post by:
IIS5, on a Windows 2000 Server machine. Debeg.WriteLine "Hello, world!" How can i view it?
4
1272
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"> var sUnsolvedSudoku var sSolvedSudoku var sStyle var sHeader var sTodaysDate var d_names = new Array("Sunday", "Monday", "Tuesday","Wednesday", "Thursday", "Friday", "Saturday"); var d = new Date();
0
8996
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9566
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9388
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.