lundi 1 mai 2017

Marking syntax error ":" at end of if statement Python 3 [on hold]

Having trouble with a syntax error- the offending code is a colon ( : ) at the end of an if statement (line 3).

primelist=[2]
for i in range(3, 2000000, 2):
    if all(i%x!=0 for x in range(2, (int(i**(1/2)))):
        primelist.append(i)
print("Done list")
Σ=sum(primelist)
print(Σ)

What is the problem here? How can I fix it?

Aucun commentaire:

Enregistrer un commentaire