Is_prime. Need help


#1



Replace this line with your code.


#2

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


#3

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!


#4

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
else:
return True


#5

To check those conditions, use if instead of for

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


#6

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