Expand|Select|Wrap|Line Numbers
- number = raw_input(" Enter a number ")
- x = 2
- coollist = []
- while x <= sqrt(int(number):
- if number % loop == 0:
- coollist.append(x)
- else:
- x += 1
- print coollist
admin-trs-imac-2:programmingstuff yandong$ python factors.py
File "factors.py", line 4
while x <= sqrt(int(number):
^
SyntaxError: invalid syntax
When I take out the colon, I get a syntax error in my if statement, again saying that the colon is invalid syntax.When I take that out, i get another syntax error saying that
admin-trs-imac-2:programmingstuff yandong$ python factors.py
File "factors.py", line 5
x += 1
^
SyntaxError: invalid syntax
Am i doing something majorly wrong? I cannot figure out what.
(by the way there are indents in the correct places but they do not show up)
(Also the arrow in the syntax error in the while loop should be pointing to the colon)