I am trying to write my own prime number and perfect square checker using Python, The function should print 'Foo' if this is a prime number, print 'Bar' if this is a perfect square, print 'FooBar' if it is neither here is my code:
def FooBar():
prime = True
perfSqr = False
for target in range(100,100001):
for num in range(1,target+1):
if target % num == 0 and num != target:
prime = False
if target // num == num and target % num == 0:
perfSqr = True
if prime is True:
print 'Foo'
elif perfSqr is True:
print 'Bar'
else:
print 'FooBar'
if __name__ == '__main__':
FooBar()
somehow, I cannot get it running at all, can anyone give me some hint ?