>>> a=1234
>>> b=0
>>> b+=1
>>> while b<1235:
---------try a/b
SyntaxError: invalid syntax
a =1234
print [x for x in range (1, a) if a%x==0]
You may not be able to do it from the command prompt (>>>). The b+=1 needs to be INSIDE the loop.
Instead of a "try", you should use the modulo (%) operator to test the division.
print [(x,a/x) for x in range (1, int (a**(.5))) if a%x==0]
Edit: If you want to use a while loop, then
a = 1234
b = 1
while b<=a:
.... if a%b==0: print b
.... b += 1
I tried
>>> a=1234
>>> b=0
>>> b+=1
>>> while b<1235:
---------try a/b
SyntaxError: invalid syntax