Error invalid syntax while statement
Garland Fulton
stackslip at gmail.com
Sat Jan 8 00:18:42 EST 2011
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.
Thank you.
1 #!/bin/bash/python
2 import math
3 try:
4 x = int(input("Enter your number: "))
5 if( 0 > x | 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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110107/bfff85b5/attachment.html>
More information about the Python-list
mailing list