Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80903

Re: import math error

References <a25f78c5-aa53-406f-a828-288ee4f7dcc5@googlegroups.com>
From Mayank Tripathi <oquanox@gmail.com>
Date 2014-11-16 20:48 +0000
Subject Re: import math error
Newsgroups comp.lang.python
Message-ID <mailman.15900.1416170926.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Why the colon in '(1,1,2)'?

On Mon Nov 17 2014 at 1:41:10 AM ryguy7272 <ryanshuell@gmail.com> wrote:

> When I type 'import math', it seems like my Python recognizes this
> library.  Great.  When I try to run the following script, I get an error,
> which suggests (to me) the math library is not working correctly.
>
> Script:
> import math
> def main():
>         print "This program finds the real solutions to a quadratic"
>         print
>         a, b, c = input("Please enter the coefficients (a, b, c): ")
>         discRoot = math.sqrt(b * b - 4 * a * c)
>         root1 = (-b + discRoot) / (2 * a)
>         root2 = (-b - discRoot) / (2 * a)
>         print
>         print "The solutions are:", root1, root2
> main()
>
> Error:
> Traceback (most recent call last):
>   File "C:\Users\Ryan\Desktop\QuadraticEquation.py", line 11, in <module>
>     main()
>   File "C:\Users\Ryan\Desktop\QuadraticEquation.py", line 5, in main
>     a, b, c = input("Please enter the coefficients (a, b, c): ")
>   File "<string>", line 1
>     (1,1,2):
>            ^
> SyntaxError: unexpected EOF while parsing
>
> The last line is line 11.  It seems like I need this, but that's what's
> causing the error.  Does anyone here have any idea what is wrong here?
>
> Thanks.
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

import math error ryguy7272 <ryanshuell@gmail.com> - 2014-11-16 12:07 -0800
  Re: import math error Mayank Tripathi <oquanox@gmail.com> - 2014-11-16 20:48 +0000
  Re: import math error Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-16 14:41 -0700
  Re:import math error Dave Angel <davea@davea.name> - 2014-11-16 17:55 -0500

csiph-web