syntax error in python:
- by pecker
Hello,
I'm learning python. It gives syntax error in this script. I'm unable to figure out.
import exceptions
class FOUND(Exception): pass
x = [1,2,3,4,56,73,29,35,12,32,63,12,76,75,89]
while True:
test = int(raw_input('Enter integer to be checked in list:'))
try:
count = -1
for y in x:
count += 1
if y == test:
raise FOUND
except ValueError,e:
print "Not a valid integer (%d)"%(e)
except FOUND:
print "Found (%d) at (%d)"%(test,count)
else:
print "Not found ,Appending (%d) to list at location (%d)"%(test,count+1)
x.append(test)
finally:
print "The List:"
print x
print " "
Invalid syntax & it highlights comma in this line: 'except ValueError,e:'