Error invalid syntax while statement
Garland Fulton
stackslip at gmail.com
Sat Jan 8 00:46:51 EST 2011
On Fri, Jan 7, 2011 at 8:28 PM, Ned Deily <nad at acm.org> wrote:
> In article
> <AANLkTik2eii-mWHG-eH_xe9KfHiyLHyEfZpVm7yZgKEt at mail.gmail.com>,
> Garland Fulton <stackslip at gmail.com> wrote:
> > I don't understand what I'm doing wrong i've tried several different
> cases
> > for what i am doing here. Will someone please point my error out.
>
> > 15 print("counter: ", counter
>
> Missing ")" on line 15.
>
> --
> Ned Deily,
> nad at acm.org
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
1 #!/bin/bash/python
2 import math
3 try:
4 x = int(input("Enter your number: "))
5 if 0 > x > 2147483647:
6 raise Exception()
7 else:
8 end = 0
9 count = 0
10 count1 = x
11 counter = 0
12 print("end: ", end)
13 print("count: ", count)
14 print("count1: ", count1)
15 print("counter: ", counter)
16
17 while end == 0: #
<-------------------returns syntax error on this while statement
18 if(count < x):
19
20 sol = math.pow(count, 2) + math.pow(count1, 2)
21 count += 1
22 count1 -= 1
23 print("end: ", end)
24 print("count: ", count)
25 print("count1: ", count1)
26 print("counter: ", counter)
27 if sol == x:
28 counter += x
29 else:
30 end = 1
31 except Exception as ran:
32 print("Value not within range", ran)
File "blah.py", line 17
while (end == 0): #
<-------------------returns syntax error on this while statement
^
IndentationError: unexpected indent
Thank you and I'm sorry for the very blind question, it was because of the
missing par-ends I have spent a while on this won't happen again. What is
wrong with my shebang line?
Thank you for the syntax tips!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110107/a3610e2d/attachment-0001.html>
More information about the Python-list
mailing list