Results 1 to 3 of 3

Thread: Python syntax error

  1. #1
    Join Date
    Oct 2009
    Posts
    67

    Python syntax error

    Hey guys
    I am have an syntax error in my python code. I am trying to make a problem on slope intercept equations. This is my first block and I already have problems. When I run the program I get a window saying "there is an error in your program". My code is follows.
    Code:
    def SIform ():
        x(1) = input('enter the x value of the first point: ');
        y(1) = input('enter the y value of the first point: ')
        #those numbers are the first point i.e. (x,y)
        x(2) = input('enter the x value of the second point: ')
        y(2) = input('enter the y value of the second point: ')
        #these numbers are the second point i.e. (x,y)
        M = (y(2) - y(1)) / (x(2) - x(1))

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: Python syntax error

    Hi
    I is a long time I have coded in python. However, I think your code contains semi-colons, I believe that semi-colon may be your problem. I have only needed to use that when using C++. This is just as a suggestion because when I coded I had some problems by trying to do this myself. Make sure that all of the variables are floating points because of that you will not be able to divide properly and you will only get the integer version. This may be your problem check it out.

  3. #3
    Join Date
    Oct 2009
    Posts
    67

    Re: Python syntax error

    Hi,
    Thanks for replying back.
    Actually I never had any problem with the variables. The code had nothing to do with the variables. I works now after having it print what m equals. By the thanks again for replying. And surely I will post back in future if I have any problems.

Similar Threads

  1. JScript compilation error syntax error
    By B.Prajapati in forum Technology & Internet
    Replies: 4
    Last Post: 14-02-2011, 03:24 AM
  2. Getting Error "invalid syntax" in Python
    By kyosang in forum Software Development
    Replies: 5
    Last Post: 29-01-2010, 10:53 PM
  3. What is a syntax error?
    By Chrisch in forum Software Development
    Replies: 3
    Last Post: 24-11-2009, 09:53 AM
  4. PHP WordPress Parse Error: syntax error, unexpected $end in
    By Bisujaksha in forum Software Development
    Replies: 2
    Last Post: 22-05-2009, 09:27 AM
  5. DOS commands, Syntax Error
    By softte in forum Operating Systems
    Replies: 3
    Last Post: 17-02-2009, 03:08 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,305,417.25121 seconds with 17 queries