Replace this line with your code.
if x==0 or x==1:
elif x==2 or x==3:
for i in (2,x-1):
else: return True
you need only one if
if x < 2:
and you don't need break
It works for all numbers less than 9. It returns wrong output when 9 is passed as an argument.
I wanted to break the loop if it's non prime and hence return false (which is outside the loop).
I thought if it is a prime, then after the normal execution of the loop, else return false would executed.
FYI- I have executed with alternate ways using counter variable. But I want to make this above logic work. Please help me!!