Is_prime. Need help


Replace this line with your code.


ok I posted this topic by mistake.
How can I delete this post :stuck_out_tongue:


I actually don't think there's a way to delete topics for the time being, and I don't know if one will ever be implemented. Glad to see you're doing well with the lessons though!


what's wrong here??

def is_prime(x):
for x<2:
return False
for x == 2:
return True
for n> 2 and n<x:
if x%n == 0:
return False
return True


To check those conditions, use if instead of for

Replace it with if x<2: and if x == 2:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.